update pay ui
This commit is contained in:
@@ -65,31 +65,37 @@ MODEL_CONFIGS = {
|
||||
"api_key": "sk-7363bdb28d7d4bf0aa68eb9449f8f063",
|
||||
"base_url": "https://api.deepseek.com",
|
||||
"model": "deepseek-chat", # 默认模型
|
||||
"max_tokens": 8192, # DeepSeek 限制为 8192
|
||||
},
|
||||
"kimi-k2": {
|
||||
"api_key": "sk-TzB4VYJfCoXGcGrGMiewukVRzjuDsbVCkaZXi2LvkS8s60E5",
|
||||
"base_url": "https://api.moonshot.cn/v1",
|
||||
"model": "moonshot-v1-8k", # 快速模型
|
||||
"max_tokens": 8192, # moonshot-v1-8k 限制为 8k
|
||||
},
|
||||
"kimi-k2-thinking": {
|
||||
"api_key": "sk-TzB4VYJfCoXGcGrGMiewukVRzjuDsbVCkaZXi2LvkS8s60E5",
|
||||
"base_url": "https://api.moonshot.cn/v1",
|
||||
"model": "kimi-k2-thinking", # 深度思考模型
|
||||
"max_tokens": 32768, # Kimi 思考模型支持更大
|
||||
},
|
||||
"glm-4.6": {
|
||||
"api_key": "", # 需要配置智谱AI密钥
|
||||
"base_url": "https://open.bigmodel.cn/api/paas/v4",
|
||||
"model": "glm-4",
|
||||
"max_tokens": 8192,
|
||||
},
|
||||
"deepmoney": {
|
||||
"api_key": "", # 空值
|
||||
"base_url": "http://111.62.35.50:8000/v1",
|
||||
"model": "deepmoney",
|
||||
"max_tokens": 32768,
|
||||
},
|
||||
"gemini-3": {
|
||||
"api_key": "", # 需要配置Google API密钥
|
||||
"base_url": "https://generativelanguage.googleapis.com/v1",
|
||||
"model": "gemini-pro",
|
||||
"max_tokens": 8192,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2451,11 +2457,13 @@ class MCPAgentIntegrated:
|
||||
|
||||
try:
|
||||
# 尝试使用选中的模型流式 API
|
||||
# 从模型配置获取 max_tokens,默认 8192
|
||||
model_max_tokens = model_config.get("max_tokens", 8192) if model_config else 32768
|
||||
stream = planning_client.chat.completions.create(
|
||||
model=planning_model,
|
||||
messages=messages,
|
||||
temperature=1.0,
|
||||
max_tokens=32768,
|
||||
max_tokens=model_max_tokens,
|
||||
stream=True, # 启用流式输出
|
||||
)
|
||||
|
||||
@@ -3673,6 +3681,8 @@ async def stream_role_response(
|
||||
|
||||
# 第一次调用:可能触发工具调用
|
||||
tool_calls_made = []
|
||||
# 从模型配置获取 max_tokens,默认 8192
|
||||
max_tokens = model_config.get("max_tokens", 8192)
|
||||
if openai_tools:
|
||||
response = client.chat.completions.create(
|
||||
model=model_config["model"],
|
||||
@@ -3681,7 +3691,7 @@ async def stream_role_response(
|
||||
tool_choice="auto",
|
||||
stream=False, # 工具调用不使用流式
|
||||
temperature=0.7,
|
||||
max_tokens=32768, # 增大 token 限制以避免输出被截断
|
||||
max_tokens=max_tokens,
|
||||
)
|
||||
|
||||
assistant_message = response.choices[0].message
|
||||
@@ -3741,7 +3751,7 @@ async def stream_role_response(
|
||||
messages=messages,
|
||||
stream=True,
|
||||
temperature=0.7,
|
||||
max_tokens=8192, # 大幅增加 token 限制以避免输出被截断
|
||||
max_tokens=max_tokens,
|
||||
)
|
||||
|
||||
full_content = ""
|
||||
|
||||
Reference in New Issue
Block a user