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

Add more functions #364

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add more functions #364

wants to merge 6 commits into from

Conversation

sastpg
Copy link

@sastpg sastpg commented May 6, 2023

bot: Chatbot = None
cookies: list = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cookies->cookies_list


user_session = dict()
user_chathistory = dict()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_chathistory->user_chat_history

Copy link
Contributor

@Winspain Winspain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor variable name

@sastpg
Copy link
Author

sastpg commented May 8, 2023

Thanks for review, refactoring variable name done.

@sastpg
Copy link
Author

sastpg commented May 8, 2023

Specifications about the new antiinterception feature: here

@linmp4
Copy link

linmp4 commented May 9, 2023

画图功能好像不行?

@sastpg
Copy link
Author

sastpg commented May 9, 2023

画图功能好像不行?

  1. 目前还是只能发生成的图片的链接
  2. 如果用的是国内服务器而且没有魔法的话,画图功能是不行的,因为有个redict_url是错误的

1 similar comment
@sastpg
Copy link
Author

sastpg commented May 9, 2023

画图功能好像不行?

  1. 目前还是只能发生成的图片的链接
  2. 如果用的是国内服务器而且没有魔法的话,画图功能是不行的,因为有个redict_url是错误的

@sastpg

This comment was marked as duplicate.

@sastpg
Copy link
Author

sastpg commented May 10, 2023

画图功能好像不行?

亲测newbing画图功能没有问题,只要加个魔法重启就行了。不知道你遇到的是什么问题。
image

@heqiang233
Copy link

老哥,我是国外服务器,提示这个输入的内容可能违反微软的图片生成内容策略。过多的策略冲突可能会导致你被暂停访问。

@sastpg
Copy link
Author

sastpg commented May 10, 2023

可能是你的cookies的原因。你可以:

  1. 尝试更新你的cookies,如果没用可以按照下面的check一下
  2. 代码中使create_img函数获取cookie直接是self.cookies[0]["value"],请确认你config.json中的cookie的第一项的name是否是_U,如果不是的话那是无效的。需要把cookies第一项改成包含name: _U 的那一项。
  3. 如果上述都不奏效,那么可以可以在BingImageCreator.py里面增加一些url的输出看看是否正确。

个人认为很可能是第2条。如果成功了或者还有问题欢迎交流

@heqiang233
Copy link

感谢老哥的帮助,果然是我的cookie的原因。
我一开始直接把全部都导进去了,现在照你说的就可以了

@linmp4
Copy link

linmp4 commented May 14, 2023

不能画图的问题相当诡异,已知"image_create_prefix": ["画"]是没有问题的,但提问的时候是不进context.get('type', None) == 'IMAGE_CREATE'这个判断的,调试发现是context.get('type')为空:

def reply(self, query: str, context=None):
log.info("[NewBing reply] 2 {}", context.get('type') == None)
if not context or not context.get('type') or context.get('type') == 'TEXT':
return asyncio.run(self.__reply(query, context))
elif context.get('type', None) == 'IMAGE_CREATE':
log.info("[NewBing create_img]")
return self.create_img(query)

如果强行进IMAGE_CREATE的话:

[INFO][2023-05-14 08:45:43][log.py:32] - [NewBing] image_query=画knight
Sending request...
Waiting for results...
........[INFO][2023-05-14 08:45:57][log.py:32] - [NewBing] image_list=['https://tse3.mm.bing.net/th/id/OIG.T1TIWTeMp_.7VoVlES0i', 'https://tse3.mm.bing.net/th/id/OIG.rXmJkCRcCKzNPiJqh9W3', 'https://tse2.mm.bing.net/th/id/OIG.SiJpOU.G82xob2oHHzLa', 'https://tse3.mm.bing.net/th/id/OIG.T0Z5L8qjSimwAmV8LLBC']
[ERROR][2023-05-14 08:45:57][wechat_channel.py:154] - can only concatenate str (not "list") to str
Traceback (most recent call last):
File "H:\github\bot-on-anything\channel\wechat\wechat_channel.py", line 152, in _do_send
self.send(channel_conf_val(const.WECHAT, "single_chat_reply_prefix") + reply, reply_user_id)
TypeError: can only concatenate str (not "list") to str

@linmp4
Copy link

linmp4 commented May 15, 2023

不能画图的问题相当诡异,已知"image_create_prefix": ["画"]是没有问题的,但提问的时候是不进context.get('type', None) == 'IMAGE_CREATE'这个判断的,调试发现是context.get('type')为空:

def reply(self, query: str, context=None): log.info("[NewBing reply] 2 {}", context.get('type') == None) if not context or not context.get('type') or context.get('type') == 'TEXT': return asyncio.run(self.__reply(query, context)) elif context.get('type', None) == 'IMAGE_CREATE': log.info("[NewBing create_img]") return self.create_img(query)

如果强行进IMAGE_CREATE的话:

[INFO][2023-05-14 08:45:43][log.py:32] - [NewBing] image_query=画knight Sending request... Waiting for results... ........[INFO][2023-05-14 08:45:57][log.py:32] - [NewBing] image_list=['https://tse3.mm.bing.net/th/id/OIG.T1TIWTeMp_.7VoVlES0i', 'https://tse3.mm.bing.net/th/id/OIG.rXmJkCRcCKzNPiJqh9W3', 'https://tse2.mm.bing.net/th/id/OIG.SiJpOU.G82xob2oHHzLa', 'https://tse3.mm.bing.net/th/id/OIG.T0Z5L8qjSimwAmV8LLBC'] [ERROR][2023-05-14 08:45:57][wechat_channel.py:154] - can only concatenate str (not "list") to str Traceback (most recent call last): File "H:\github\bot-on-anything\channel\wechat\wechat_channel.py", line 152, in _do_send self.send(channel_conf_val(const.WECHAT, "single_chat_reply_prefix") + reply, reply_user_id) TypeError: can only concatenate str (not "list") to str

执行pip install --no-cache-dir -r requirements.txt就好了

@linmp4
Copy link

linmp4 commented Jun 8, 2023

EdgeGPT更新了接口

@sastpg
Copy link
Author

sastpg commented Jun 8, 2023

有空我会更新一下

@ymeimei
Copy link

ymeimei commented Jul 13, 2023

现在不论发啥回复全变成*号了

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

Successfully merging this pull request may close these issues.

5 participants