mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 01:56:01 +08:00
fix tongyi tool calls (#6896)
This commit is contained in:
parent
2ab9af3b38
commit
f8617db012
@ -497,12 +497,13 @@ You should also complete the text started with ``` but not tell ``` directly.
|
|||||||
content = prompt_message.content
|
content = prompt_message.content
|
||||||
if not content:
|
if not content:
|
||||||
content = ' '
|
content = ' '
|
||||||
tongyi_messages.append({
|
message = {
|
||||||
'role': 'assistant',
|
'role': 'assistant',
|
||||||
'content': content if not rich_content else [{"text": content}],
|
'content': content if not rich_content else [{"text": content}]
|
||||||
'tool_calls': [tool_call.model_dump() for tool_call in
|
}
|
||||||
prompt_message.tool_calls] if prompt_message.tool_calls else None
|
if prompt_message.tool_calls:
|
||||||
})
|
message['tool_calls'] = [tool_call.model_dump() for tool_call in prompt_message.tool_calls]
|
||||||
|
tongyi_messages.append(message)
|
||||||
elif isinstance(prompt_message, ToolPromptMessage):
|
elif isinstance(prompt_message, ToolPromptMessage):
|
||||||
tongyi_messages.append({
|
tongyi_messages.append({
|
||||||
"role": "tool",
|
"role": "tool",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user