feat(agent): 增强多模态链路与工具调用能力
This commit is contained in:
@@ -107,6 +107,10 @@ class AgentRepository:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
|
||||
next_seq = int(session_row.message_count or 0) + 1
|
||||
if not _has_title(session_row.title):
|
||||
session_title = _derive_session_title(content_text)
|
||||
if session_title is not None:
|
||||
session_row.title = session_title
|
||||
payload_metadata = dict(metadata or {})
|
||||
payload_metadata["run_id"] = run_id
|
||||
message = AgentChatMessage(
|
||||
@@ -264,3 +268,14 @@ class AgentRepository:
|
||||
if rendered:
|
||||
payload["attachments"] = rendered
|
||||
return payload
|
||||
|
||||
|
||||
def _has_title(title: object) -> bool:
|
||||
return isinstance(title, str) and bool(title.strip())
|
||||
|
||||
|
||||
def _derive_session_title(content_text: str) -> str | None:
|
||||
normalized = " ".join(content_text.split())
|
||||
if not normalized:
|
||||
return None
|
||||
return normalized[:80]
|
||||
|
||||
Reference in New Issue
Block a user