更新安装文档,添加关于GitHub Models API的警告信息,并调整配置项说明

This commit is contained in:
2025-01-25 00:06:27 +08:00
parent c8e776d5ff
commit ef71514ce2
5 changed files with 94 additions and 12 deletions

View File

@ -13,9 +13,9 @@ class ConfigModel(BaseModel):
# marshoai_support_image_models: list = ["gpt-4o","gpt-4o-mini"]
marshoai_default_name: str = "marsho"
marshoai_at: bool = False
marshoai_aliases: set[str] = {
marshoai_aliases: list[str] = [
"小棉",
}
]
marshoai_main_colour: str = "FFAAAA"
marshoai_default_model: str = "gpt-4o-mini"
marshoai_prompt: str = (
@ -40,6 +40,7 @@ class ConfigModel(BaseModel):
marshoai_enable_tools: bool = False
marshoai_enable_plugins: bool = True
marshoai_load_builtin_tools: bool = True
marshoai_fix_toolcalls: bool = True
marshoai_toolset_dir: list = []
marshoai_disabled_toolkits: list = []
marshoai_azure_endpoint: str = "https://models.inference.ai.azure.com"

View File

@ -292,7 +292,7 @@ async def marsho(
choice = response.choices[0]
# Sprint(choice)
# 当tool_calls非空时将finish_reason设置为TOOL_CALLS
if choice.message.tool_calls != None:
if choice.message.tool_calls != None and config.marshoai_fix_toolcalls:
choice["finish_reason"] = CompletionsFinishReason.TOOL_CALLS
if choice["finish_reason"] == CompletionsFinishReason.STOPPED:
# 当对话成功时将dict的上下文添加到上下文类中
@ -325,10 +325,13 @@ async def marsho(
while choice.message.tool_calls != None:
# await UniMessage(str(response)).send()
tool_calls = choice.message.tool_calls
if tool_calls[0]["function"]["name"].startswith("$"):
choice.message.tool_calls[0][
"type"
] = "builtin_function" # 兼容 moonshot AI 内置函数的临时方案
try:
if tool_calls[0]["function"]["name"].startswith("$"):
choice.message.tool_calls[0][
"type"
] = "builtin_function" # 兼容 moonshot AI 内置函数的临时方案
except:
pass
tool_msg.append(choice.message.as_dict())
for tool_call in tool_calls:
if isinstance(