Skip to content

微信支持引用,修复切换模型deepseek提示不存在问题 #2448

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bot/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def set_system_prompt(self, system_prompt):
self.reset()

def add_query(self, query):
split_result = query.split(' --> ')
if len(split_result) == 2:
self.messages.append({"role": "user", "content": split_result[1]})
self.messages.append({"role": "user", "content": split_result[0]})
return
user_item = {"role": "user", "content": query}
self.messages.append(user_item)

Expand Down
22 changes: 20 additions & 2 deletions channel/chat_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
if first_in and "」\n- - - - - - -" in content: # 初次匹配 过滤引用消息
logger.debug(content)
logger.debug("[chat_channel]reference query skipped")
return None

content = convert_format(content)
# return None
nick_name_black_list = conf().get("nick_name_black_list", [])
if context.get("isgroup", False): # 群聊
# 校验关键字
Expand Down Expand Up @@ -397,3 +397,21 @@ def check_contain(content, keyword_list):
if content.find(ky) != -1:
return True
return None


def convert_format(input_str):
# 分割字符串为上下两部分
parts = input_str.split('\n- - - - - - - - - - - - - - -\n')

# 从第一部分提取xxx
first_part = parts[0].strip()
content = first_part.split(':')[1].strip()[:-1]

# 获取第二部分的yyy
second_part = parts[1].strip()

# 组合成新格式
result = f"{second_part} --> {content}"

return result

2 changes: 1 addition & 1 deletion common/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

CLAUDE_3_HAIKU = "claude-3-haiku-20240307"

GITEE_AI_MODEL_LIST = ["Yi-34B-Chat", "InternVL2-8B", "deepseek-coder-33B-instruct", "InternVL2.5-26B", "Qwen2-VL-72B", "Qwen2.5-32B-Instruct", "glm-4-9b-chat", "codegeex4-all-9b", "Qwen2.5-Coder-32B-Instruct", "Qwen2.5-72B-Instruct", "Qwen2.5-7B-Instruct", "Qwen2-72B-Instruct", "Qwen2-7B-Instruct", "code-raccoon-v1", "Qwen2.5-14B-Instruct"]
GITEE_AI_MODEL_LIST = ["Yi-34B-Chat", "InternVL2-8B", "deepseek-coder-33B-instruct", "deepseek-chat", "InternVL2.5-26B", "Qwen2-VL-72B", "Qwen2.5-32B-Instruct", "glm-4-9b-chat", "codegeex4-all-9b", "Qwen2.5-Coder-32B-Instruct", "Qwen2.5-72B-Instruct", "Qwen2.5-7B-Instruct", "Qwen2-72B-Instruct", "Qwen2-7B-Instruct", "code-raccoon-v1", "Qwen2.5-14B-Instruct"]

MODEL_LIST = [
GPT35, GPT35_0125, GPT35_1106, "gpt-3.5-turbo-16k",
Expand Down