Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix QWenSeq2txt bug (#2245)

Kevin Hu0fe19f3fbc9b
diff --git a/api/apps/llm_app.py b/api/apps/llm_app.py
index 5e045e1c39..056dba8c7c 100644
--- a/api/apps/llm_app.py
+++ b/api/apps/llm_app.py
@@ -43,7 +43,7 @@ def set_api_key():
chat_passed, embd_passed, rerank_passed = False, False, False
factory = req["llm_factory"]
msg = ""
- for llm in LLMService.query(fid=factory):
+ for llm in LLMService.query(fid=factory)[:3]:
if not embd_passed and llm.model_type == LLMType.EMBEDDING.value:
mdl = EmbeddingModel[factory](
req["api_key"], llm.llm_name, base_url=req.get("base_url"))
diff --git a/rag/llm/sequence2txt_model.py b/rag/llm/sequence2txt_model.py
index 626a65e452..fcd6859d59 100644
--- a/rag/llm/sequence2txt_model.py
+++ b/rag/llm/sequence2txt_model.py
@@ -71,7 +71,7 @@ class QWenSeq2txt(Base):
ans = ""
if result.status_code == HTTPStatus.OK:
for sentence in result.get_sentence():
- ans += str(sentence + '\n')
+ ans += sentence.text.decode('utf-8') + '\n'
return ans, num_tokens_from_string(ans)
return "**ERROR**: " + result.message, 0