Refactor payload to ensure validated parser_config usage
Updated payload construction to always use validated parser_config.
This commit is contained in:
parent
ada337ef2b
commit
8d09b403e0
1 changed files with 2 additions and 4 deletions
|
|
@ -412,7 +412,6 @@ class KnowledgebaseService(CommonService):
|
|||
return {"code": RetCode.DATA_ERROR, "message": "Tenant does not exist."}
|
||||
|
||||
# Build payload
|
||||
parser_config = get_parser_config(parser_id, kwargs.get("parser_config"))
|
||||
kb_id = get_uuid()
|
||||
payload = {
|
||||
"id": kb_id,
|
||||
|
|
@ -420,11 +419,10 @@ class KnowledgebaseService(CommonService):
|
|||
"tenant_id": tenant_id,
|
||||
"created_by": tenant_id,
|
||||
"parser_id": (parser_id or "naive"),
|
||||
"parser_config": parser_config,
|
||||
**kwargs
|
||||
**kwargs # Includes optional fields such as description, language, permission, avatar, parser_config, etc.
|
||||
}
|
||||
|
||||
# Default parser_config (align with kb_app.create) — do not accept external overrides
|
||||
# Update parser_config (always override with validated default/merged config)
|
||||
payload["parser_config"] = get_parser_config(parser_id, kwargs.get("parser_config"))
|
||||
|
||||
return payload
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue