Skip to content

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

Fix: add auto_parse to kb detail. (#11153)

Kevin Hudd5b8e2e1a87
diff --git a/api/db/services/common_service.py b/api/db/services/common_service.py
index 8c8a4191e8..5b906b5a86 100644
--- a/api/db/services/common_service.py
+++ b/api/db/services/common_service.py
@@ -90,7 +90,7 @@ class CommonService:
else:
query_records = cls.model.select()
if reverse is not None:
- if not order_by or not hasattr(cls, order_by):
+ if not order_by or not hasattr(cls.model, order_by):
order_by = "create_time"
if reverse is True:
query_records = query_records.order_by(cls.model.getter_by(order_by).desc())
diff --git a/api/db/services/connector_service.py b/api/db/services/connector_service.py
index c05c87c8ef..c6188c490c 100644
--- a/api/db/services/connector_service.py
+++ b/api/db/services/connector_service.py
@@ -268,6 +268,7 @@ class Connector2KbService(CommonService):
Connector.id,
Connector.source,
Connector.name,
+ cls.model.auto_parse,
Connector.status
]
return list(cls.model.select(*fields)\
diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.py
index cf57b720be..b37028428c 100644
--- a/rag/llm/cv_model.py
+++ b/rag/llm/cv_model.py
@@ -268,44 +268,41 @@ class QWenCV(GptV4):
tmp.write(video_bytes)
tmp_path = tmp.name
- video_path = f"file://{tmp_path}"
- messages = [
- {
- "role": "user",
- "content": [
- {
- "video": video_path,
- "fps": 2,
- },
- {
- "text": "Please summarize this video in proper sentences.",
- },
- ],
- }
- ]
-
- def call_api():
- response = MultiModalConversation.call(
- api_key=self.api_key,
- model=self.model_name,
- messages=messages,
- )
- summary = response["output"]["choices"][0]["message"].content[0]["text"]
- return summary, num_tokens_from_string(summary)
+ video_path = f"file://{tmp_path}"
+ messages = [
+ {
+ "role": "user",
+ "content": [
+ {
+ "video": video_path,
+ "fps": 2,
+ },
+ {
+ "text": "Please summarize this video in proper sentences.",
+ },
+ ],
+ }
+ ]
- try:
- return call_api()
- except Exception as e1:
- import dashscope
+ def call_api():
+ response = MultiModalConversation.call(
+ api_key=self.api_key,
+ model=self.model_name,
+ messages=messages,
+ )
+ summary = response["output"]["choices"][0]["message"].content[0]["text"]
+ return summary, num_tokens_from_string(summary)
- dashscope.base_http_api_url = "https://dashscope-intl.aliyuncs.com/api/v1"
try:
return call_api()
- except Exception as e2:
- raise RuntimeError(f"Both default and intl endpoint failed.\nFirst error: {e1}\nSecond error: {e2}")
- finally:
- if tmp_path and tmp_path.exists():
- tmp_path.unlink()
+ except Exception as e1:
+ import dashscope
+
+ dashscope.base_http_api_url = "https://dashscope-intl.aliyuncs.com/api/v1"
+ try:
+ return call_api()
+ except Exception as e2:
+ raise RuntimeError(f"Both default and intl endpoint failed.\nFirst error: {e1}\nSecond error: {e2}")
class HunyuanCV(GptV4):