mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-07 16:56:36 +08:00
if role is tool then set to user
This commit is contained in:
@@ -57,7 +57,14 @@ def _build_tools(
|
||||
function_declarations.append(function)
|
||||
|
||||
if function_declarations:
|
||||
tools.append({"functionDeclarations": function_declarations})
|
||||
# 按照 function 的 name 去重
|
||||
names, functions = set(), []
|
||||
for item in function_declarations:
|
||||
if item.get("name") not in names:
|
||||
names.add(item.get("name"))
|
||||
functions.append(item)
|
||||
|
||||
tools.append({"functionDeclarations": functions})
|
||||
|
||||
return tools
|
||||
|
||||
|
||||
Reference in New Issue
Block a user