mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: add auto_parse to kb detail. (#11153)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -90,7 +90,7 @@ class CommonService:
|
|||||||
else:
|
else:
|
||||||
query_records = cls.model.select()
|
query_records = cls.model.select()
|
||||||
if reverse is not None:
|
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"
|
order_by = "create_time"
|
||||||
if reverse is True:
|
if reverse is True:
|
||||||
query_records = query_records.order_by(cls.model.getter_by(order_by).desc())
|
query_records = query_records.order_by(cls.model.getter_by(order_by).desc())
|
||||||
|
|||||||
@ -268,6 +268,7 @@ class Connector2KbService(CommonService):
|
|||||||
Connector.id,
|
Connector.id,
|
||||||
Connector.source,
|
Connector.source,
|
||||||
Connector.name,
|
Connector.name,
|
||||||
|
cls.model.auto_parse,
|
||||||
Connector.status
|
Connector.status
|
||||||
]
|
]
|
||||||
return list(cls.model.select(*fields)\
|
return list(cls.model.select(*fields)\
|
||||||
|
|||||||
@ -268,44 +268,41 @@ class QWenCV(GptV4):
|
|||||||
tmp.write(video_bytes)
|
tmp.write(video_bytes)
|
||||||
tmp_path = tmp.name
|
tmp_path = tmp.name
|
||||||
|
|
||||||
video_path = f"file://{tmp_path}"
|
video_path = f"file://{tmp_path}"
|
||||||
messages = [
|
messages = [
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": [
|
"content": [
|
||||||
{
|
{
|
||||||
"video": video_path,
|
"video": video_path,
|
||||||
"fps": 2,
|
"fps": 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Please summarize this video in proper sentences.",
|
"text": "Please summarize this video in proper sentences.",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
def call_api():
|
def call_api():
|
||||||
response = MultiModalConversation.call(
|
response = MultiModalConversation.call(
|
||||||
api_key=self.api_key,
|
api_key=self.api_key,
|
||||||
model=self.model_name,
|
model=self.model_name,
|
||||||
messages=messages,
|
messages=messages,
|
||||||
)
|
)
|
||||||
summary = response["output"]["choices"][0]["message"].content[0]["text"]
|
summary = response["output"]["choices"][0]["message"].content[0]["text"]
|
||||||
return summary, num_tokens_from_string(summary)
|
return summary, num_tokens_from_string(summary)
|
||||||
|
|
||||||
try:
|
|
||||||
return call_api()
|
|
||||||
except Exception as e1:
|
|
||||||
import dashscope
|
|
||||||
|
|
||||||
dashscope.base_http_api_url = "https://dashscope-intl.aliyuncs.com/api/v1"
|
|
||||||
try:
|
try:
|
||||||
return call_api()
|
return call_api()
|
||||||
except Exception as e2:
|
except Exception as e1:
|
||||||
raise RuntimeError(f"Both default and intl endpoint failed.\nFirst error: {e1}\nSecond error: {e2}")
|
import dashscope
|
||||||
finally:
|
|
||||||
if tmp_path and tmp_path.exists():
|
dashscope.base_http_api_url = "https://dashscope-intl.aliyuncs.com/api/v1"
|
||||||
tmp_path.unlink()
|
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):
|
class HunyuanCV(GptV4):
|
||||||
|
|||||||
Reference in New Issue
Block a user