chatgpt-on-wechat
chatgpt-on-wechat copied to clipboard
修改为使用chatgpt
修改为使用https://github.com/acheong08/ChatGPT/blob/main/src/revChatGPT/Official.py的chatgpt
已经可以成功运行了嘛,需要什么环境 和 配置项呢? 可以讨论下是否需要把 official.py 全部拷贝过来,直接把revChatGPT的包import进来是否可行呢
这个可以稳定运行,就是回复依旧比较慢,但是比起之前浏览器版本稳定非常多。不支持图片。用下来直觉上还是与之前的chatgpt不一样,但是相似,感觉是一个分支。另外这个是免费的,我看了两天,没看到账户被扣钱
环境就是需要在之前环境上额外 pip install tiktoken 配置项我在之前config.json上没看到有模型选项,我看到代码里是直接写死的,所以我在bridge.bridge.Bridge.py里直接修改成chatGPT了
关于“可以讨论下是否需要把 official.py 全部拷贝过来,直接把revChatGPT的包import进来是否可行呢” 我是直接copy的official.py,然后加了若干行来实现你这里bot需要的接口。就下面这些代码
def Singleton(cls): instance = {}
def _singleton_wrapper(*args, **kargs):
if cls not in instance:
instance[cls] = cls(*args, **kargs)
return instance[cls]
return _singleton_wrapper
@Singleton class ChatGPTBot(Bot):
def __init__(self):
print("create")
self.bot = Chatbot(conf().get('open_ai_api_key'))
def reply(self, query, context=None):
if not context or not context.get('type') or context.get('type') == 'TEXT':
if len(query) < 10 and "reset" in query:
self.bot.reset()
return "reset OK"
return self.bot.ask(query)["choices"][0]["text"]
xyc @.***
------------------ 原始邮件 ------------------ 发件人: "zhayujie/chatgpt-on-wechat" @.>; 发送时间: 2023年2月5日(星期天) 下午4:57 @.>; @.@.>; 主题: Re: [zhayujie/chatgpt-on-wechat] 修改为使用chatgpt (PR #39)
已经可以成功运行了嘛,需要什么环境 和 配置项呢? 可以讨论下是否需要把 official.py 全部拷贝过来,直接把revChatGPT的包import进来是否可行呢
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
感谢PR!我稍后把你的代码合入master
配置项我在之前config.json上没看到有模型选项,我看到代码里是直接写死的
这个我一会加一个配置项,做成可选的
环境就是需要在之前环境上额外 pip install tiktoken
这句我没看太清楚,是 pip install tiktoken 吗?你是在windows环境上
pip install tiktoken就是在之前openai版本已安装的基础上需要额外安装tiktoken这个库,不需要其他的特殊配置,我是部署到服务器上的
附张截图
我看了下代码,这段代码底层也是调用的官方接口 (GPT-3模型),但是手动实现了对话,是不错的参考
但是在wx场景,特别是群聊模式下,不支持对每个用户分配独立的上下文会话
我在最新的代码里优化了这一点 https://github.com/zhayujie/chatgpt-on-wechat/commit/7425d9075ae362ef18988e4e1e36ebdfe5de279e
期待优化~ 模型是不一样的,我看到OpenAIBot用的是model="text-davinci-003",每一次调用都是会被计费的,https://github.com/acheong08/ChatGPT/blob/main/src/revChatGPT/Official.py里使用的是"text-chat-davinci-002-20221122",这个目前没看到会被计费
这个可以稳定运行,就是回复依旧比较慢,但是比起之前浏览器版本稳定非常多。不支持图片。用下来直觉上还是与之前的chatgpt不一样,但是相似,感觉是一个分支。另外这个是免费的,我看了两天,没看到账户被扣钱
The reason for the different reply is that this model is older from 2022/11/22, essentially the pre-release version
pip install tiktoken就是在之前openai版本已安装的基础上需要额外安装tiktoken这个库,不需要其他的特殊配置,我是部署到服务器上的
pip3 install revChatGPT
also installs openai
and tiktoken
as dependencies
这个可以稳定运行,就是回复依旧比较慢,但是比起之前浏览器版本稳定非常多。不支持图片。用下来直觉上还是与之前的chatgpt不一样,但是相似,感觉是一个分支。另外这个是免费的,我看了两天,没看到账户被扣钱
The reason for the different reply is that this model is older from 2022/11/22, essentially the pre-release version
yes,I think so
davinci
问当前的机器人日期,回答是2020年,
这个老版居然要付费.
davinci-002-20221122 新版却免费?
这么神奇
没了。
没了。
yes. That model does not exist...
the model "text-chat-davinci-002-20221122" is available now 这会儿又可以用了
haha wth
bot/chatgpt/chat_gpt_bot.py 中调整为: "text-chat-davinci-002-20221122" 后
这里不需要调整么?
https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bot/openai/open_ai_bot.py#L41
bot/chatgpt/chat_gpt_bot.py 中调整为: "text-chat-davinci-002-20221122" 后
这里不需要调整么?
https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bot/openai/open_ai_bot.py#L41
这里不能改,open_ai_bot.py是为了调用gpt-3的,而且gpt-3有图像生成功能,和text-chat-davinci-002-20221122有差别的。如果要使用chat_gpt_bot.py,只要本地修改下面的"openAI"为"chatGPT"就行 https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bridge/bridge.py#L9
为了
大佬,改成chatGPT后,能登录,就是一直抛错The server is overloaded or not ready yet. 是不是没得解啊
为了
大佬,改成chatGPT后,能登录,就是一直抛错The server is overloaded or not ready yet. 是不是没得解啊
没解...等吧,马上各种类似的大模型都会开放公测了
bot/chatgpt/chat_gpt_bot.py 中调整为: "text-chat-davinci-002-20221122" 后 这里不需要调整么? https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bot/openai/open_ai_bot.py#L41
这里不能改,open_ai_bot.py是为了调用gpt-3的,而且gpt-3有图像生成功能,和text-chat-davinci-002-20221122有差别的。如果要使用chat_gpt_bot.py,只要本地修改下面的"openAI"为"chatGPT"就行
https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bridge/bridge.py#L9
本地修改下面的"openAI"为"chatGPT"后,报这个
create
[ERROR][2023-02-12 18:08:18][wechat_channel.py:116] - That model does not exist
是不是模型被删除了?
bot/chatgpt/chat_gpt_bot.py 中调整为: "text-chat-davinci-002-20221122" 后 这里不需要调整么? https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bot/openai/open_ai_bot.py#L41
这里不能改,open_ai_bot.py是为了调用gpt-3的,而且gpt-3有图像生成功能,和text-chat-davinci-002-20221122有差别的。如果要使用chat_gpt_bot.py,只要本地修改下面的"openAI"为"chatGPT"就行 https://github.com/zhayujie/chatgpt-on-wechat/blob/865432c53254ab3ab40850cb62517828055bbdb0/bridge/bridge.py#L9
本地修改下面的"openAI"为"chatGPT"后,报这个
create [ERROR][2023-02-12 18:08:18][wechat_channel.py:116] - That model does not exist
是不是模型被删除了?
是的
现在也就只能调用openai
的text-davinci-003
了把?
我刚去看了一下 我一个下午 就text-davinci-003
用了2.3
块钱了
现在也就只能调用
openai
的text-davinci-003
了把? 我刚去看了一下 我一个下午 就text-davinci-003
用了2.3
块钱了
是的