Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,8 @@ async def get_models():
|
|
65 |
"owned_by": "flowise",
|
66 |
"permission": [],
|
67 |
"root": "flowise",
|
68 |
-
"parent": None
|
|
|
69 |
})
|
70 |
|
71 |
return {"object": "list", "data": models}
|
@@ -109,22 +110,25 @@ async def create_chat_completion(request: ChatCompletionRequest):
|
|
109 |
"id": "chatcmpl-" + os.urandom(12).hex(),
|
110 |
"object": "chat.completion",
|
111 |
"created": int(start_time), # Используем время начала запроса
|
112 |
-
"model":
|
113 |
"choices": [
|
114 |
{
|
115 |
"index": 0,
|
|
|
|
|
116 |
"message": {
|
117 |
"role": "assistant",
|
118 |
"content": assistant_response
|
119 |
-
}
|
120 |
-
"finish_reason": "stop"
|
121 |
}
|
122 |
],
|
123 |
"usage": {
|
124 |
"prompt_tokens": prompt_tokens,
|
125 |
"completion_tokens": completion_tokens,
|
126 |
"total_tokens": prompt_tokens + completion_tokens
|
127 |
-
}
|
|
|
|
|
128 |
}
|
129 |
except requests.RequestException as e:
|
130 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
65 |
"owned_by": "flowise",
|
66 |
"permission": [],
|
67 |
"root": "flowise",
|
68 |
+
"parent": None,
|
69 |
+
"system_fingerprint": "phi4-r1" # Добавляем system_fingerprint
|
70 |
})
|
71 |
|
72 |
return {"object": "list", "data": models}
|
|
|
110 |
"id": "chatcmpl-" + os.urandom(12).hex(),
|
111 |
"object": "chat.completion",
|
112 |
"created": int(start_time), # Используем время начала запроса
|
113 |
+
"model": "phi4-r1", # Используем тот же model_id что и в прямом API
|
114 |
"choices": [
|
115 |
{
|
116 |
"index": 0,
|
117 |
+
"logprobs": None, # Добавляем поле logprobs
|
118 |
+
"finish_reason": "stop",
|
119 |
"message": {
|
120 |
"role": "assistant",
|
121 |
"content": assistant_response
|
122 |
+
}
|
|
|
123 |
}
|
124 |
],
|
125 |
"usage": {
|
126 |
"prompt_tokens": prompt_tokens,
|
127 |
"completion_tokens": completion_tokens,
|
128 |
"total_tokens": prompt_tokens + completion_tokens
|
129 |
+
},
|
130 |
+
"stats": {}, # Добавляем пустой объект stats
|
131 |
+
"system_fingerprint": "phi4-r1" # Добавляем system_fingerprint
|
132 |
}
|
133 |
except requests.RequestException as e:
|
134 |
raise HTTPException(status_code=500, detail=str(e))
|