anychat的网页版使用flask开发,感觉有bug,体验不好,常常返回空串,乱码,有时还会阻塞不动。
使用他们的免Key接口,可以自己写一个客户端或者网页版,根据自己的需求订制
可以使用python自己写一个客户端,也可以搞个自己订制的在线版本给客户使用,主要是不用记网页了,而且可以根据需要自己切换源
# --*-- coding:utf-8 --*--
import requests
import json
login_url = "http://175.6.7.167:25678/free/"
data = {
"key": "AnyGPT is all you need",
"prompt": "讲个故事",
"context": "human",
"human_history": [],
"assistant_history": [],
"transcript_in": []
}
headers = {
"Content-Type": "application/json",
"charset":"UTF-8"
#"Authorization": f"Bearer {apiKey}",
}
response = requests.post(url=login_url, data=json.dumps(data), headers=headers,timeout=(10, 20000),stream=True)
print(response.status_code)
print(response.url)
print(response.headers)
print(json.loads(response.text))
运行效果,也可以使用其他的api,看到合适的逆向研究一下接口接过来就好。

环境:
vscode,python3.11, anaconda,vscode的python的插件。如果缺少库,根据提示安装
conda instll requests
文章讲述了在使用AnyChat网页版时遇到的诸如bug、空串、乱码和阻塞等问题,并提供了一个使用PythonFlask框架开发的免Key接口示例,用户可以自定义客户端或网页版以改善体验,同时提到了VSCode、Python3.11和Anaconda的开发环境。
1139

被折叠的 条评论
为什么被折叠?



