Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -27,7 +27,7 @@ def model_list():
|
|
27 |
"object": "list",
|
28 |
"data": [
|
29 |
{
|
30 |
-
"id": "qwen",
|
31 |
"object": "model",
|
32 |
"created": time_now,
|
33 |
"owned_by": "tastypear"
|
@@ -44,7 +44,7 @@ def model_list():
|
|
44 |
|
45 |
@app.route("/", methods=["GET"])
|
46 |
def index():
|
47 |
-
return Response(f'QW2.5 OpenAI Compatible API<br><br>'+
|
48 |
f'Set "{os.getenv("SPACE_URL")}/api" as proxy (or API Domain) in your Chatbot.<br><br>'+
|
49 |
f'The complete API is: {os.getenv("SPACE_URL")}/api/v1/chat/completions')
|
50 |
|
@@ -85,19 +85,13 @@ def chat_completions():
|
|
85 |
else:
|
86 |
chat_history.append([messages[i].get("content"), " "])
|
87 |
|
88 |
-
# print(f'{system = }')
|
89 |
-
# print(f'{chat_history = }')
|
90 |
-
# print(f'{prompt = }')
|
91 |
-
|
92 |
-
fn_index = 0
|
93 |
-
|
94 |
# gen a random char(11) hash
|
95 |
chars = string.ascii_lowercase + string.digits
|
96 |
session_hash = "".join(random.choice(chars) for _ in range(11))
|
97 |
|
98 |
json_prompt = {
|
99 |
"data": [prompt, chat_history, system],
|
100 |
-
"fn_index":
|
101 |
"session_hash": session_hash,
|
102 |
"trigger_id": 11,
|
103 |
}
|
@@ -137,7 +131,7 @@ def gen_res_data(data, time_now=0, start=False):
|
|
137 |
"id": "chatcmpl",
|
138 |
"object": "chat.completion.chunk",
|
139 |
"created": time_now,
|
140 |
-
"model": "
|
141 |
"choices": [{"index": 0, "finish_reason": None}],
|
142 |
}
|
143 |
|
|
|
27 |
"object": "list",
|
28 |
"data": [
|
29 |
{
|
30 |
+
"id": "qwen-2-5",
|
31 |
"object": "model",
|
32 |
"created": time_now,
|
33 |
"owned_by": "tastypear"
|
|
|
44 |
|
45 |
@app.route("/", methods=["GET"])
|
46 |
def index():
|
47 |
+
return Response(f'QW2.5 ᴍᴀx OpenAI Compatible API<br><br>'+
|
48 |
f'Set "{os.getenv("SPACE_URL")}/api" as proxy (or API Domain) in your Chatbot.<br><br>'+
|
49 |
f'The complete API is: {os.getenv("SPACE_URL")}/api/v1/chat/completions')
|
50 |
|
|
|
85 |
else:
|
86 |
chat_history.append([messages[i].get("content"), " "])
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
# gen a random char(11) hash
|
89 |
chars = string.ascii_lowercase + string.digits
|
90 |
session_hash = "".join(random.choice(chars) for _ in range(11))
|
91 |
|
92 |
json_prompt = {
|
93 |
"data": [prompt, chat_history, system],
|
94 |
+
"fn_index": 0,
|
95 |
"session_hash": session_hash,
|
96 |
"trigger_id": 11,
|
97 |
}
|
|
|
131 |
"id": "chatcmpl",
|
132 |
"object": "chat.completion.chunk",
|
133 |
"created": time_now,
|
134 |
+
"model": "qwen-2-5",
|
135 |
"choices": [{"index": 0, "finish_reason": None}],
|
136 |
}
|
137 |
|