Skip to content

Commit

Permalink
feat: chatcmpl请求时也忽略空的 system prompt message (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Mar 29, 2024
1 parent 387dfa3 commit 6330763
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/provider/modelmgr/apis/anthropicmsgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def request(
args["model"] = query.use_model.name if query.use_model.model_name is None else query.use_model.model_name

req_messages = [ # req_messages 仅用于类内,外部同步由 query.messages 进行
m.dict(exclude_none=True) for m in query.prompt.messages
m.dict(exclude_none=True) for m in query.prompt.messages if m.content.strip() != ""
] + [m.dict(exclude_none=True) for m in query.messages]

# 删除所有 role=system & content='' 的消息
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/modelmgr/apis/chatcmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def _request(
pending_tool_calls = []

req_messages = [ # req_messages 仅用于类内,外部同步由 query.messages 进行
m.dict(exclude_none=True) for m in query.prompt.messages
m.dict(exclude_none=True) for m in query.prompt.messages if m.content.strip() != ""
] + [m.dict(exclude_none=True) for m in query.messages]

# req_messages.append({"role": "user", "content": str(query.message_chain)})
Expand Down

0 comments on commit 6330763

Please sign in to comment.