mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-10 21:55:42 +08:00
fix: align model default handling (#16782)
This commit is contained in:
@@ -37,9 +37,9 @@ class CompilationTemplateService(CommonService):
|
||||
from api.db.services.user_service import TenantService
|
||||
|
||||
ok, tenant = TenantService.get_by_id(tenant_id)
|
||||
if ok and getattr(tenant, "llm_id", None):
|
||||
if ok and getattr(tenant, "tenant_llm_id", None):
|
||||
config = dict(config)
|
||||
config["llm_id"] = tenant.llm_id
|
||||
config["llm_id"] = tenant.tenant_llm_id
|
||||
except Exception:
|
||||
logging.exception(
|
||||
"compilation_template: llm_id default-fill lookup failed for tenant=%s",
|
||||
@@ -91,9 +91,9 @@ class CompilationTemplateService(CommonService):
|
||||
from api.db.services.user_service import TenantService
|
||||
|
||||
ok, tenant = TenantService.get_by_id(tenant_id)
|
||||
if ok and getattr(tenant, "llm_id", None):
|
||||
if ok and getattr(tenant, "tenant_llm_id", None):
|
||||
config = dict(config)
|
||||
config["llm_id"] = tenant.llm_id
|
||||
config["llm_id"] = tenant.tenant_llm_id
|
||||
except Exception:
|
||||
logging.exception(
|
||||
"compilation_template: llm_id lazy-fill lookup failed for tenant=%s",
|
||||
@@ -246,7 +246,11 @@ class CompilationTemplateService(CommonService):
|
||||
"""
|
||||
wiki_dir = os.path.join(
|
||||
get_project_base_directory(),
|
||||
"api", "db", "init_data", "compilation_templates", "wiki",
|
||||
"api",
|
||||
"db",
|
||||
"init_data",
|
||||
"compilation_templates",
|
||||
"wiki",
|
||||
)
|
||||
if not os.path.exists(wiki_dir):
|
||||
logging.warning("Missing wiki presets directory: %s", wiki_dir)
|
||||
@@ -269,10 +273,12 @@ class CompilationTemplateService(CommonService):
|
||||
continue
|
||||
# Missing fields degrade to empty strings so the frontend
|
||||
# doesn't have to null-check every row.
|
||||
presets.append({
|
||||
"id": os.path.splitext(filename)[0],
|
||||
"topic": str(doc.get("topic") or "").strip(),
|
||||
"instruction": str(doc.get("instruction") or ""),
|
||||
"page_example": str(doc.get("page_example") or ""),
|
||||
})
|
||||
presets.append(
|
||||
{
|
||||
"id": os.path.splitext(filename)[0],
|
||||
"topic": str(doc.get("topic") or "").strip(),
|
||||
"instruction": str(doc.get("instruction") or ""),
|
||||
"page_example": str(doc.get("page_example") or ""),
|
||||
}
|
||||
)
|
||||
return presets
|
||||
|
||||
@@ -178,12 +178,19 @@ class TenantService(CommonService):
|
||||
cls.model.id.alias("tenant_id"),
|
||||
cls.model.name,
|
||||
cls.model.llm_id,
|
||||
cls.model.tenant_llm_id,
|
||||
cls.model.embd_id,
|
||||
cls.model.tenant_embd_id,
|
||||
cls.model.rerank_id,
|
||||
cls.model.tenant_rerank_id,
|
||||
cls.model.asr_id,
|
||||
cls.model.tenant_asr_id,
|
||||
cls.model.img2txt_id,
|
||||
cls.model.tenant_img2txt_id,
|
||||
cls.model.tts_id,
|
||||
cls.model.tenant_tts_id,
|
||||
cls.model.ocr_id,
|
||||
cls.model.tenant_ocr_id,
|
||||
cls.model.parser_ids,
|
||||
UserTenant.role,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user