JC321 commited on
Commit
4b38e7c
·
verified ·
1 Parent(s): 5702960

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -143,9 +143,9 @@ def chatbot_response(message, history):
143
  try:
144
  messages = [{"role": "system", "content": SYSTEM_PROMPT}]
145
 
146
- # 添加历史(最近3轮)
147
  if history:
148
- for item in history[-3:]:
149
  if isinstance(item, (list, tuple)) and len(item) == 2:
150
  messages.append({"role": "user", "content": item[0]})
151
  messages.append({"role": "assistant", "content": item[1]})
@@ -154,8 +154,8 @@ def chatbot_response(message, history):
154
 
155
  tool_calls_log = []
156
 
157
- # LLM 调用循环(最多3轮工具调用)
158
- for iteration in range(3):
159
  response = client.chat_completion(
160
  messages=messages,
161
  model="Qwen/Qwen2.5-72B-Instruct:novita",
@@ -217,6 +217,7 @@ def chatbot_response(message, history):
217
  stream = client.chat_completion(
218
  messages=messages,
219
  model="Qwen/Qwen2.5-72B-Instruct:novita",
 
220
  max_tokens=2000,
221
  temperature=0.5,
222
  stream=True
 
143
  try:
144
  messages = [{"role": "system", "content": SYSTEM_PROMPT}]
145
 
146
+ # 添加历史(最近5轮)
147
  if history:
148
+ for item in history[-5:]:
149
  if isinstance(item, (list, tuple)) and len(item) == 2:
150
  messages.append({"role": "user", "content": item[0]})
151
  messages.append({"role": "assistant", "content": item[1]})
 
154
 
155
  tool_calls_log = []
156
 
157
+ # LLM 调用循环(最多5轮工具调用)
158
+ for iteration in range(5):
159
  response = client.chat_completion(
160
  messages=messages,
161
  model="Qwen/Qwen2.5-72B-Instruct:novita",
 
217
  stream = client.chat_completion(
218
  messages=messages,
219
  model="Qwen/Qwen2.5-72B-Instruct:novita",
220
+ tools=MCP_TOOLS,
221
  max_tokens=2000,
222
  temperature=0.5,
223
  stream=True