mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-07 16:11:16 +08:00
### What problem does this PR solve?
This reverts commit 1a608ac411.
### Type of change
- [x] Other (please describe):
This commit is contained in:
@@ -151,7 +151,7 @@ Model selection guidance
|
||||
- Chat model is tied to the chat assistant.
|
||||
Set during chat creation using --chat-payload:
|
||||
```
|
||||
{"name": "...", "llm_id": "<model_name>@<provider>", "llm_setting": {}}
|
||||
{"name": "...", "llm": {"model_name": "<model_name>@<provider>"}}
|
||||
```
|
||||
Or set tenant defaults via --set-tenant-info with --tenant-llm-id.
|
||||
- --model is required by the OpenAI-compatible endpoint but does not override
|
||||
@@ -190,7 +190,7 @@ Example: chat benchmark creating dataset + upload + parse + chat (login + regist
|
||||
--document-path test/benchmark/test_docs/Doc2.pdf \
|
||||
--document-path test/benchmark/test_docs/Doc3.pdf \
|
||||
--chat-name "bench_chat" \
|
||||
--chat-payload '{"name":"bench_chat","llm_id":"glm-4-flash@ZHIPU-AI","llm_setting":{}}' \
|
||||
--chat-payload '{"name":"bench_chat","llm":{"model_name":"glm-4-flash@ZHIPU-AI"}}' \
|
||||
--message "What is the purpose of RAGFlow?" \
|
||||
--model "glm-4-flash@ZHIPU-AI"
|
||||
```
|
||||
|
||||
@@ -26,8 +26,8 @@ def create_chat(
|
||||
body = dict(payload or {})
|
||||
if "name" not in body:
|
||||
body["name"] = name
|
||||
if dataset_ids is not None and "kb_ids" not in body:
|
||||
body["kb_ids"] = dataset_ids
|
||||
if dataset_ids is not None and "dataset_ids" not in body:
|
||||
body["dataset_ids"] = dataset_ids
|
||||
res = client.request_json("POST", "/chats", json_body=body)
|
||||
if res.get("code") != 0:
|
||||
raise ChatError(f"Create chat failed: {res.get('message')}")
|
||||
@@ -35,23 +35,24 @@ def create_chat(
|
||||
|
||||
|
||||
def get_chat(client: HttpClient, chat_id: str) -> Dict[str, Any]:
|
||||
res = client.request_json("GET", f"/chats/{chat_id}")
|
||||
res = client.request_json("GET", "/chats", params={"id": chat_id})
|
||||
if res.get("code") != 0:
|
||||
raise ChatError(f"Get chat failed: {res.get('message')}")
|
||||
data = res.get("data", {})
|
||||
data = res.get("data", [])
|
||||
if not data:
|
||||
raise ChatError("Chat not found")
|
||||
return data
|
||||
return data[0]
|
||||
|
||||
|
||||
def resolve_model(model: Optional[str], chat_data: Optional[Dict[str, Any]]) -> str:
|
||||
if model:
|
||||
return model
|
||||
if chat_data:
|
||||
llm_id = chat_data.get("llm_id")
|
||||
if llm_id:
|
||||
return llm_id
|
||||
raise ChatError("Model name is required; provide --model or use a chat with llm_id.")
|
||||
llm = chat_data.get("llm") or {}
|
||||
llm_name = llm.get("model_name")
|
||||
if llm_name:
|
||||
return llm_name
|
||||
raise ChatError("Model name is required; provide --model or use a chat with llm.model_name.")
|
||||
|
||||
|
||||
def _parse_stream_error(response) -> Optional[str]:
|
||||
|
||||
@@ -20,7 +20,7 @@ PYTHONPATH="${REPO_ROOT}/test" uv run -m benchmark chat \
|
||||
--document-path "${SCRIPT_DIR}/test_docs/Doc2.pdf" \
|
||||
--document-path "${SCRIPT_DIR}/test_docs/Doc3.pdf" \
|
||||
--chat-name "bench_chat" \
|
||||
--chat-payload '{"name":"bench_chat","llm_id":"glm-4-flash@ZHIPU-AI","llm_setting":{}}' \
|
||||
--chat-payload '{"name":"bench_chat","llm":{"model_name":"glm-4-flash@ZHIPU-AI"}}' \
|
||||
--message "What is the purpose of RAGFlow?" \
|
||||
--model "glm-4-flash@ZHIPU-AI" \
|
||||
--iterations 10 \
|
||||
|
||||
@@ -10,7 +10,7 @@ BASE_URL="http://127.0.0.1:9380"
|
||||
LOGIN_EMAIL="qa@infiniflow.org"
|
||||
LOGIN_PASSWORD="123"
|
||||
DATASET_PAYLOAD='{"name":"bench_dataset","embedding_model":"BAAI/bge-small-en-v1.5@Builtin"}'
|
||||
CHAT_PAYLOAD='{"name":"bench_chat","llm_id":"glm-4-flash@ZHIPU-AI","llm_setting":{}}'
|
||||
CHAT_PAYLOAD='{"name":"bench_chat","llm":{"model_name":"glm-4-flash@ZHIPU-AI"}}'
|
||||
DATASET_ID=""
|
||||
|
||||
cleanup_dataset() {
|
||||
|
||||
Reference in New Issue
Block a user