Merge branch 'codex/run-ha-v4-redis-stream'
This commit is contained in:
commit
725e2077a0
@ -175,12 +175,24 @@ class KnowledgeBaseManager:
|
|||||||
|
|
||||||
kb_repo = KnowledgeBaseRepository()
|
kb_repo = KnowledgeBaseRepository()
|
||||||
rows = await kb_repo.get_all()
|
rows = await kb_repo.get_all()
|
||||||
|
|
||||||
all_databases = []
|
all_databases = []
|
||||||
|
metadata_reloaded_types: set[str] = set()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
kb_instance = self._get_or_create_kb_instance(row.kb_type or "lightrag")
|
kb_type = row.kb_type or "lightrag"
|
||||||
|
kb_instance = self._get_or_create_kb_instance(kb_type)
|
||||||
db_info = kb_instance.get_database_info(row.db_id)
|
db_info = kb_instance.get_database_info(row.db_id)
|
||||||
if db_info:
|
if not db_info and kb_type not in metadata_reloaded_types:
|
||||||
|
try:
|
||||||
|
await kb_instance._load_metadata()
|
||||||
|
metadata_reloaded_types.add(kb_type)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Failed to reload metadata for kb_type={kb_type}: {e}")
|
||||||
|
db_info = kb_instance.get_database_info(row.db_id)
|
||||||
|
|
||||||
|
if not db_info:
|
||||||
|
logger.warning(f"Skip database due to missing metadata: db_id={row.db_id}, kb_type={kb_type}")
|
||||||
|
continue
|
||||||
|
|
||||||
# 补充 share_config 和 additional_params
|
# 补充 share_config 和 additional_params
|
||||||
db_info["share_config"] = row.share_config or {"is_shared": True, "accessible_departments": []}
|
db_info["share_config"] = row.share_config or {"is_shared": True, "accessible_departments": []}
|
||||||
db_info["additional_params"] = ensure_chunk_defaults_in_additional_params(row.additional_params)
|
db_info["additional_params"] = ensure_chunk_defaults_in_additional_params(row.additional_params)
|
||||||
|
|||||||
@ -825,7 +825,10 @@ const enqueueLoadingChunkForTyping = (threadId, chunk) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const msg = chunk.msg || {}
|
const msg = chunk.msg || {}
|
||||||
const contentChars = splitChars(msg.content)
|
const msgType = String(msg.type || '').toLowerCase()
|
||||||
|
const isToolMessage = msgType === 'tool' || msgType.includes('tool')
|
||||||
|
const streamText = typeof chunk.response === 'string' ? chunk.response : ''
|
||||||
|
const contentChars = !isToolMessage ? splitChars(streamText) : []
|
||||||
if (contentChars.length === 0) {
|
if (contentChars.length === 0) {
|
||||||
typingChunkQueue.push({ threadId, chunk, isChar: false })
|
typingChunkQueue.push({ threadId, chunk, isChar: false })
|
||||||
scheduleTypingRender()
|
scheduleTypingRender()
|
||||||
@ -838,6 +841,7 @@ const enqueueLoadingChunkForTyping = (threadId, chunk) => {
|
|||||||
isChar: true,
|
isChar: true,
|
||||||
chunk: {
|
chunk: {
|
||||||
...chunk,
|
...chunk,
|
||||||
|
response: char,
|
||||||
msg: {
|
msg: {
|
||||||
...msg,
|
...msg,
|
||||||
content: char
|
content: char
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user