Compare commits
1 Commits
26f8e0c648
...
fix/new-se
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cf81a1200 |
BIN
_qwen_xinference_demo/__pycache__/api.cpython-310.pyc
Normal file
BIN
_qwen_xinference_demo/__pycache__/api.cpython-310.pyc
Normal file
Binary file not shown.
@@ -239,18 +239,24 @@ def message(req: MessageReq):
|
||||
|
||||
class QueryFromMsgReq(BaseModel):
|
||||
session_id: str
|
||||
message: str | None = None
|
||||
|
||||
|
||||
@app.post("/query_from_message", tags=["opro"])
|
||||
def query_from_message(req: QueryFromMsgReq):
|
||||
s = get_session(req.session_id)
|
||||
if not s:
|
||||
raise AppException(404, "session not found", "SESSION_NOT_FOUND")
|
||||
last_user = None
|
||||
for m in reversed(s.get("chat_history", [])):
|
||||
if m.get("role") == "user" and m.get("content"):
|
||||
last_user = m["content"]
|
||||
break
|
||||
base = last_user or s["original_query"]
|
||||
base = None
|
||||
if req.message:
|
||||
log_chat_message(req.session_id, "user", req.message)
|
||||
base = req.message
|
||||
else:
|
||||
for m in reversed(s.get("chat_history", [])):
|
||||
if m.get("role") == "user" and m.get("content"):
|
||||
base = m["content"]
|
||||
break
|
||||
base = base or s["original_query"]
|
||||
cands = generate_candidates(base, s["history_candidates"], model_name=s.get("model_name"))
|
||||
update_session_add_candidates(req.session_id, cands)
|
||||
return ok({"session_id": req.session_id, "round": s["round"], "candidates": cands})
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
const candRes = await fetch(API_BASE + '/query_from_message', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ session_id: currentSession })
|
||||
body: JSON.stringify({ session_id: currentSession, message: msg })
|
||||
});
|
||||
const candData = await candRes.json();
|
||||
const payload = candData && candData.data ? candData.data : {};
|
||||
|
||||
Reference in New Issue
Block a user