MCPcopy Create free account
hub / github.com/Felixgithub2017/MMCU / plain_chat

Function plain_chat

TestChatGPT.py:55–68  ·  view source on GitHub ↗
(prompt)

Source from the content-addressed store, hash-verified

53# chatgpt api
54# 将此函数替换为付费api
55def plain_chat(prompt):
56 headers={
57 'Content-type':'application/json',
58 'Accept':'application/json'
59 }
60 url= 'your_paid_chatgpt_api'
61 # 构造 post 数据
62 postdata = {"content": prompt}
63 postdata = json.dumps(postdata)
64 r = requests.post(url, data=postdata, headers=headers)
65 #print(r)
66 json_content = json.loads(r.text)
67 answer = json_content["texts"]
68 return answer
69
70def read_file_lines(file):
71 with open(file, 'r', errors='ignore', encoding='utf8') as f:

Callers 1

evalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected