Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增一种快捷在chatgpt-on-wechat里使用dify的方法 #1894

Closed
1 task done
fatwang2 opened this issue Apr 14, 2024 · 27 comments
Closed
1 task done

新增一种快捷在chatgpt-on-wechat里使用dify的方法 #1894

fatwang2 opened this issue Apr 14, 2024 · 27 comments

Comments

@fatwang2
Copy link
Contributor

⚠️ 搜索是否存在类似issue

  • 我已经搜索过issues和disscussions,没有发现相似issue

总结

我看之前有人提dify相关的PR没有通过,我换了种方式实现在cow里无缝接入dify,接入后可以使用dify的agent、workflow、knowledge base等功能,同时也可以通过dify快速接入各种新的大模型,点击链接即可部署 dify2openai

举例

No response

动机

No response

@Fone520
Copy link

Fone520 commented May 21, 2024

牛逼兄dei!!!

@fatwang2
Copy link
Contributor Author

我看一直没人回,以为大家不需要了,其实我还有一个 coze 的,类似

@Fone520
Copy link

Fone520 commented May 21, 2024

我看一直没人回,以为大家不需要了,其实我还有一个 coze 的,类似

刚好需要,哈哈哈谢谢啦大佬

@Fone520
Copy link

Fone520 commented May 21, 2024

coze免费可太爽了

我看一直没人回,以为大家不需要了,其实我还有一个 coze 的,类似

@fatwang2
Copy link
Contributor Author

coze 的 API 不是免费的,跟 OpenAI 一个价

@perryrighthere
Copy link

大佬,dify2openai啥时候能支持多模态,非常感谢!!!

@MILKMILKKING
Copy link

我一直没人回,以为大家都不需要了,其实我还有一个小秘密,类似

我想要听这个小秘密!给点提示

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jun 3, 2024 via email

@MILKMILKKING
Copy link

哈哈哈 是翻译问题,我看成了你还有一个小秘密。

@anycallzh
Copy link

我看一直没人回,以为大家不需要了,其实我还有一个 coze 的,类似

期待大佬的coze调用秘密

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jun 4, 2024 via email

@MILKMILKKING
Copy link

coze 的 API 不是免费的,跟 OpenAI 一个价

弱弱的问一下,COZE API不是免费的话,那调用这个优势在哪里呢?只是因为可以编排工作流吗?是不是可以有免费实现的方法?

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jun 4, 2024 via email

@tianzecn
Copy link

dify转为api后,速度会有影响吗,功能是不是有缺失

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jun 22, 2024 via email

@tianzecn
Copy link

你可以看下我的项目说明 brokenman1 @.>于2024年6月22日 周六14:11写道:

dify转为api后,速度会有影响吗,功能是不是有缺失 — Reply to this email directly, view it on GitHub <#1894 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A77NZSTJJJDYAZXSL4HNLY3ZIUIS7AVCNFSM6AAAAABGGHI7F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBTHAZTANBQG4 . You are receiving this because you authored the thread.Message ID: @.
>

请问自已服务器部署的DIFY能转为openaiapi吗。。

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jun 22, 2024 via email

@balcklive
Copy link

@fatwang2 老铁,这个dify2openai和chatgpt-on-wechat放在一起跑通过吗?我试了好像不行啊,我的配置文件如下:

"channel_type": "wx",
"model": "dify",
"open_ai_api_key": "xxxxx",
"proxy": "http://myipAddress:3000/v1/chat/completions",
"hot_reload": false,

报错内容如下:
[WARNING][2024-07-07 23:03:23][chat_gpt_session.py:86] - num_tokens_from_messages() is not implemented for model dify. Returning num tokens assuming gpt-3.5-turbo.
[WARNING][2024-07-07 23:03:23][chat_gpt_bot.py:150] - [CHATGPT] APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
[WARNING][2024-07-07 23:03:28][chat_gpt_bot.py:160] - [CHATGPT] 第1次重试
[WARNING][2024-07-07 23:03:28][chat_gpt_bot.py:150] - [CHATGPT] APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
[WARNING][2024-07-07 23:03:33][chat_gpt_bot.py:160] - [CHATGPT] 第2次重试
[WARNING][2024-07-07 23:03:34][chat_gpt_bot.py:150] - [CHATGPT] APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
[INFO][2024-07-07 23:03:34][wechat_channel.py:217] - [WX] sendMsg=Reply(type=ERROR, content=[ERROR]
我连接不到你的网络), receiver=@93c919ba28217dc1a9da47fd28e3f2ce9a9190068d98329a0b4a285025128b66

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jul 7, 2024 via email

@balcklive
Copy link

@fatwang2 哪个变量啊

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jul 8, 2024 via email

@balcklive
Copy link

这是 apibase,不是 proxy balcklive @.>于2024年7月8日 周一22:42写道:

@fatwang2 https://github.com/fatwang2 哪个变量啊 — Reply to this email directly, view it on GitHub <#1894 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A77NZSRBQF2FUXBNHTPNKS3ZLKQPFAVCNFSM6AAAAABGGHI7F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJUGI4DANJQGY . You are receiving this because you were mentioned.Message ID: @.
>

正确的变量名是:open_ai_api_base;是吗?

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jul 8, 2024 via email

@bberppub
Copy link

牛的牛的,马上star

@fattank
Copy link

fattank commented Jul 14, 2024

请教楼主,你的项目如何让微信不封号?

@fatwang2
Copy link
Contributor Author

fatwang2 commented Jul 14, 2024 via email

@6vision 6vision closed this as completed Jul 18, 2024
@t89210827
Copy link

image
Please press confirm on your phone.
Loading the contact, this may take a little while.
<PIL.PngImagePlugin.PngImageFile image mode=1 size=450x450 at 0x7F992F1ABFA0>
[DEBUG][2024-09-05 15:37:53][wechat_channel.py:151] - Login success
[INFO][2024-09-05 15:37:53][wechat_channel.py:131] - Wechat login success, user_id: @eed8d3d14cb9b084cb1ba3543893beee22c322617e746023625868cd25404423, nickname: bot
Start auto replying.
[DEBUG][2024-09-05 15:38:24][wechat_channel.py:180] - [WX]receive text msg: {"MsgId": "7785080238091107815", "FromUserName": "@24e853d03600c3d2b28e1046b1f7adeb", "ToUserName": "@eed8d3d14cb9b084cb1ba3543893beee22c322617e746023625868cd25404423", "MsgType": 1, "Content": "bot 上户口", "Status": 3, "ImgStatus": 1, "CreateTime": 1725521903, "VoiceLength": 0, "PlayLength": 0, "FileName": "", "FileSize": "", "MediaId": "", "Url": "", "AppMsgType": 0, "StatusNotifyCode": 0, "StatusNotifyUserName": "", "RecommendInfo": {"UserName": "", "NickName": "", "QQNum": 0, "Province": "", "City": "", "Content": "", "Signature": "", "Alias": "", "Scene": 0, "VerifyFlag": 0, "AttrStatus": 0, "Sex": 0, "Ticket": "", "OpCode": 0}, "ForwardFlag": 0, "AppInfo": {"AppID": "", "Type": 0}, "HasProductId": 0, "Ticket": "", "ImgHeight": 0, "ImgWidth": 0, "SubMsgType": 0, "NewMsgId": 7785080238091107815, "OriContent": "", "EncryFileName": "", "User": {"MemberList": [], "Uin": 0, "UserName": "@24e853d03600c3d2b28e1046b1f7adeb", "NickName": "行", "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=660890051&username=@24e853d03600c3d2b28e1046b1f7adeb&skey=@crypt_d3ab0270_9a7734a78f974676277355cd8f7fcad9", "ContactFlag": 3, "MemberCount": 0, "RemarkName": "佟子青", "HideInputBarFlag": 0, "Sex": 1, "Signature": "生有热烈 藏与俗常", "VerifyFlag": 0, "OwnerUin": 0, "PYInitial": "X", "PYQuanPin": "xing", "RemarkPYInitial": "TZQ", "RemarkPYQuanPin": "tongziqing", "StarFriend": 0, "AppAccountFlag": 0, "Statues": 0, "AttrStatus": 106599, "Province": "", "City": "", "Alias": "", "SnsFlag": 401, "UniFriend": 0, "DisplayName": "", "ChatRoomId": 0, "KeyWord": "T77", "EncryChatRoomId": "", "IsOwner": 0}, "Type": "Text", "Text": "bot 上户口"}, cmsg=ChatMessage: id=7785080238091107815, create_time=1725521903, ctype=TEXT, content=bot 上户口, from_user_id=@24e853d03600c3d2b28e1046b1f7adeb, from_user_nickname=行, to_user_id=@eed8d3d14cb9b084cb1ba3543893beee22c322617e746023625868cd25404423, to_user_nickname=bot, other_user_id=@24e853d03600c3d2b28e1046b1f7adeb, other_user_nickname=行, is_group=False, is_at=False, actual_user_id=None, actual_user_nickname=None, at_list=None
[DEBUG][2024-09-05 15:38:24][chat_channel.py:345] - [chat_channel] consume context: Context(type=TEXT, content=上户口, kwargs={'isgroup': False, 'msg': <channel.wechat.wechat_message.WechatMessage object at 0x7f992f1aaa40>, 'origin_ctype': <ContextType.TEXT: 1>, 'openai_api_key': None, 'gpt_model': None, 'session_id': '@24e853d03600c3d2b28e1046b1f7adeb', 'receiver': '@24e853d03600c3d2b28e1046b1f7adeb'})
[DEBUG][2024-09-05 15:38:24][chat_channel.py:168] - [chat_channel] ready to handle context: Context(type=TEXT, content=上户口, kwargs={'isgroup': False, 'msg': <channel.wechat.wechat_message.WechatMessage object at 0x7f992f1aaa40>, 'origin_ctype': <ContextType.TEXT: 1>, 'openai_api_key': None, 'gpt_model': None, 'session_id': '@24e853d03600c3d2b28e1046b1f7adeb', 'receiver': '@24e853d03600c3d2b28e1046b1f7adeb'})
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin GODCMD triggered by event Event.ON_HANDLE_CONTEXT
[DEBUG][2024-09-05 15:38:24][godcmd.py:220] - [Godcmd] on_handle_context. content: 上户口
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin KEYWORD triggered by event Event.ON_HANDLE_CONTEXT
[DEBUG][2024-09-05 15:38:24][keyword.py:52] - [keyword] on_handle_context. content: 上户口
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin LINKAI triggered by event Event.ON_HANDLE_CONTEXT
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin ROLE triggered by event Event.ON_HANDLE_CONTEXT
[INFO][2024-09-05 15:38:24][bridge.py:68] - create bot chatGPT for chat
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin DUNGEON triggered by event Event.ON_HANDLE_CONTEXT
[DEBUG][2024-09-05 15:38:24][dungeon.py:73] - [Dungeon] on_handle_context. content: ['上户口']
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin HELLO triggered by event Event.ON_HANDLE_CONTEXT
[DEBUG][2024-09-05 15:38:24][hello.py:90] - [Hello] on_handle_context. content: 上户口
[DEBUG][2024-09-05 15:38:24][plugin_manager.py:189] - Plugin FINISH triggered by event Event.ON_HANDLE_CONTEXT
[DEBUG][2024-09-05 15:38:24][finish.py:30] - [Finish] on_handle_context. content: 上户口
[DEBUG][2024-09-05 15:38:24][chat_channel.py:190] - [chat_channel] ready to handle context: type=TEXT, content=上户口
[INFO][2024-09-05 15:38:24][chat_gpt_bot.py:49] - [CHATGPT] query=上户口
[DEBUG][2024-09-05 15:38:27][session_manager.py:70] - prompt tokens used=71
[DEBUG][2024-09-05 15:38:27][chat_gpt_bot.py:66] - [CHATGPT] session query=[{'role': 'system', 'content': '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。'}, {'role': 'user', 'content': '上户口'}]
[ERROR][2024-09-05 15:38:27][chat_gpt_bot.py:155] - [CHATGPT] Exception: 'str' object has no attribute 'get'
Traceback (most recent call last):
File "/app/bot/chatgpt/chat_gpt_bot.py", line 123, in reply_text
response = openai.ChatCompletion.create(api_key=api_key, messages=session.messages, **args)
File "/usr/local/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/usr/local/lib/python3.10/site-packages/openai/api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/lib/python3.10/site-packages/openai/api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "/usr/local/lib/python3.10/site-packages/openai/api_requestor.py", line 763, in _interpret_response_line
raise self.handle_error_response(
File "/usr/local/lib/python3.10/site-packages/openai/api_requestor.py", line 418, in handle_error_response
error_code=error_data.get("code"),
AttributeError: 'str' object has no attribute 'get'

报这个错误 是我哪个配置有问题吗 求助大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests