feat(agent): add question suggestions with after-answer follow-ups

Enable agents to configure starter prompts and async follow-up questions after completed answers, with durable caching, analytics events, and chat/embed UI integration.
This commit is contained in:
wizardchen
2026-07-14 11:06:13 +08:00
committed by lyingbug
parent a6c85dad28
commit 087fcc9fe7
50 changed files with 3781 additions and 179 deletions
+183 -7
View File
@@ -713,6 +713,14 @@ definitions:
Dedicated chat model ID for the query-understanding (rewrite + intent) step.
When empty, the main conversation ModelID is used as a fallback.
type: string
question_suggestions:
allOf:
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionSuggestionConfig'
description: |-
===== Conversation Question Suggestions =====
QuestionSuggestions owns both the static/knowledge-backed prompts shown
before the first user turn and the contextual follow-up questions shown
after a completed assistant answer.
rerank_model_id:
description: ReRank model ID for retrieval
type: string
@@ -747,13 +755,6 @@ definitions:
===== Skills Settings (only for smart-reasoning mode) =====
Skills selection mode: "all" = all preloaded skills, "selected" = specific skills, "none" = no skills
type: string
suggested_prompts:
description: |-
===== Suggested Prompts =====
推荐问题列表,用于在前端对话面板展示快捷提问
items:
type: string
type: array
supported_file_types:
description: |-
===== File Type Restriction Settings =====
@@ -1045,6 +1046,33 @@ definitions:
required:
- query_text
type: object
github_com_Tencent_WeKnora_internal_types.FollowUpSuggestionConfig:
properties:
additional_instruction:
type: string
allow_regenerate:
type: boolean
categories:
items:
type: string
type: array
count:
type: integer
enabled:
type: boolean
knowledge_fallback:
type: boolean
max_context_turns:
type: integer
mode:
type: string
model_id:
type: string
suppress_on_fallback:
type: boolean
suppress_when_answer_asks_question:
type: boolean
type: object
github_com_Tencent_WeKnora_internal_types.GraphNode:
properties:
attributes:
@@ -1938,6 +1966,11 @@ definitions:
description: Agent total execution duration in milliseconds (from query start
to answer start)
type: integer
agent_id:
description: |-
AgentID is the agent used for this individual assistant turn. Unlike the
session's last_request_state it remains stable when users switch agents.
type: string
agent_steps:
description: |-
Agent execution steps (only for assistant messages generated by agent)
@@ -1997,6 +2030,11 @@ definitions:
items:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem'
type: array
model_id:
description: |-
ModelID is the requested/effective chat model binding captured for this
turn. It is useful for reproducibility and suggestion generation.
type: string
request_id:
description: Request identifier for tracking API requests
type: string
@@ -2447,6 +2485,13 @@ definitions:
10)'
type: integer
type: object
github_com_Tencent_WeKnora_internal_types.QuestionSuggestionConfig:
properties:
follow_ups:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.FollowUpSuggestionConfig'
starters:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.StarterSuggestionConfig'
type: object
github_com_Tencent_WeKnora_internal_types.QueueStat:
properties:
active:
@@ -2928,6 +2973,19 @@ definitions:
- organization_id
- permission
type: object
github_com_Tencent_WeKnora_internal_types.StarterSuggestionConfig:
properties:
count:
type: integer
enabled:
type: boolean
items:
items:
type: string
type: array
mode:
type: string
type: object
github_com_Tencent_WeKnora_internal_types.StorageConfig:
properties:
app_id:
@@ -3006,6 +3064,13 @@ definitions:
required:
- invite_code
type: object
github_com_Tencent_WeKnora_internal_types.SuggestionAttribution:
properties:
question_id:
type: string
suggestion_set_id:
type: string
type: object
github_com_Tencent_WeKnora_internal_types.SyncLog:
properties:
created_at:
@@ -4179,6 +4244,11 @@ definitions:
type: integer
type: array
type: object
internal_handler.EnsureMessageSuggestionsRequest:
properties:
regenerate:
type: boolean
type: object
internal_handler.EvaluationRequest:
properties:
chat_id:
@@ -4848,6 +4918,18 @@ definitions:
description: '"local", "minio", "cos", "tos", "s3", "oss", "ks3"'
type: string
type: object
internal_handler.SuggestionEventRequest:
properties:
event_type:
type: string
question_id:
type: string
suggestion_set_id:
type: string
required:
- event_type
- suggestion_set_id
type: object
internal_handler.TestProviderRequest:
properties:
parameters:
@@ -5213,6 +5295,8 @@ definitions:
items:
type: string
type: array
suggestion_attribution:
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.SuggestionAttribution'
summary_model_id:
description: Optional summary model ID for this request (overrides session
default)
@@ -12017,6 +12101,72 @@ paths:
summary: 知识问答
tags:
- 问答
/sessions/{session_id}/messages/{message_id}/suggestions:
get:
parameters:
- description: 会话 ID
in: path
name: session_id
required: true
type: string
- description: 助手消息 ID
in: path
name: message_id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
security:
- Bearer: []
- ApiKeyAuth: []
summary: 获取回答后推荐问题
tags:
- 会话
post:
consumes:
- application/json
description: 对已完成的助手消息异步生成或重新生成推荐问题;相同配置快照会复用持久化结果
parameters:
- description: 会话 ID
in: path
name: session_id
required: true
type: string
- description: 助手消息 ID
in: path
name: message_id
required: true
type: string
- description: 生成选项
in: body
name: request
schema:
$ref: '#/definitions/internal_handler.EnsureMessageSuggestionsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"202":
description: Accepted
schema:
additionalProperties: true
type: object
security:
- Bearer: []
- ApiKeyAuth: []
summary: 确保生成回答后推荐问题
tags:
- 会话
/sessions/{session_id}/pin:
post:
description: 将指定会话置顶(用户维度)
@@ -12079,6 +12229,32 @@ paths:
summary: 停止生成
tags:
- 问答
/sessions/{session_id}/suggestion-events:
post:
consumes:
- application/json
description: 记录曝光、点击或关闭事件
parameters:
- description: 会话 ID
in: path
name: session_id
required: true
type: string
- description: 事件
in: body
name: request
required: true
schema:
$ref: '#/definitions/internal_handler.SuggestionEventRequest'
responses:
"204":
description: No Content
security:
- Bearer: []
- ApiKeyAuth: []
summary: 上报推荐问题事件
tags:
- 会话
/sessions/{session_id}/title:
post:
consumes: