Upload 2 files
Browse files
api.py
CHANGED
|
@@ -132,10 +132,9 @@ def handle_stream_request(apikey, session_id, query, endpoint_id, model_name, te
|
|
| 132 |
"responseMode": "stream",
|
| 133 |
"modelConfigs": {
|
| 134 |
"fulfillmentPrompt": "--No Use\n{context}\n--No Use--\n" + CLAUDE_SYSTEM_PROMPT + "{question}",
|
| 135 |
-
"temperature":
|
| 136 |
}
|
| 137 |
}
|
| 138 |
-
logging.info("Temperature: %s", temperature)
|
| 139 |
|
| 140 |
headers = {
|
| 141 |
"apikey": apikey,
|
|
@@ -216,10 +215,9 @@ def handle_non_stream_request(apikey, session_id, query, endpoint_id, model_name
|
|
| 216 |
"responseMode": "sync",
|
| 217 |
"modelConfigs": {
|
| 218 |
"fulfillmentPrompt": "--No Use\n{context}\n--No Use--\n" + CLAUDE_SYSTEM_PROMPT + "{question}",
|
| 219 |
-
"temperature":
|
| 220 |
}
|
| 221 |
}
|
| 222 |
-
logging.info("Temperature: %s", temperature)
|
| 223 |
|
| 224 |
headers = {"apikey": apikey, "Content-Type": "application/json"}
|
| 225 |
|
|
@@ -262,7 +260,6 @@ def chat_completions():
|
|
| 262 |
if not isinstance(messages, list) or not messages:
|
| 263 |
return jsonify({"error": "消息格式错误:messages必须是非空列表,且至少包含一条消息"}), 400
|
| 264 |
|
| 265 |
-
logging.info(f"接收到请求:{json.dumps(data, ensure_ascii=False, indent=2)}")
|
| 266 |
model = data.get("model", "gpt-4o")
|
| 267 |
endpoint_id = get_endpoint_id(model)
|
| 268 |
is_stream = bool(data.get("stream", False))
|
|
|
|
| 132 |
"responseMode": "stream",
|
| 133 |
"modelConfigs": {
|
| 134 |
"fulfillmentPrompt": "--No Use\n{context}\n--No Use--\n" + CLAUDE_SYSTEM_PROMPT + "{question}",
|
| 135 |
+
"temperature": 0.7
|
| 136 |
}
|
| 137 |
}
|
|
|
|
| 138 |
|
| 139 |
headers = {
|
| 140 |
"apikey": apikey,
|
|
|
|
| 215 |
"responseMode": "sync",
|
| 216 |
"modelConfigs": {
|
| 217 |
"fulfillmentPrompt": "--No Use\n{context}\n--No Use--\n" + CLAUDE_SYSTEM_PROMPT + "{question}",
|
| 218 |
+
"temperature": 0.7
|
| 219 |
}
|
| 220 |
}
|
|
|
|
| 221 |
|
| 222 |
headers = {"apikey": apikey, "Content-Type": "application/json"}
|
| 223 |
|
|
|
|
| 260 |
if not isinstance(messages, list) or not messages:
|
| 261 |
return jsonify({"error": "消息格式错误:messages必须是非空列表,且至少包含一条消息"}), 400
|
| 262 |
|
|
|
|
| 263 |
model = data.get("model", "gpt-4o")
|
| 264 |
endpoint_id = get_endpoint_id(model)
|
| 265 |
is_stream = bool(data.get("stream", False))
|