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:
+276
-7
@@ -10674,6 +10674,111 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/messages/{message_id}/suggestions": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"会话"
|
||||
],
|
||||
"summary": "获取回答后推荐问题",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "会话 ID",
|
||||
"name": "session_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "助手消息 ID",
|
||||
"name": "message_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "对已完成的助手消息异步生成或重新生成推荐问题;相同配置快照会复用持久化结果",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"会话"
|
||||
],
|
||||
"summary": "确保生成回答后推荐问题",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "会话 ID",
|
||||
"name": "session_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "助手消息 ID",
|
||||
"name": "message_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "生成选项",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.EnsureMessageSuggestionsRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"202": {
|
||||
"description": "Accepted",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/pin": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -10774,6 +10879,49 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/suggestion-events": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "记录曝光、点击或关闭事件",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"会话"
|
||||
],
|
||||
"summary": "上报推荐问题事件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "会话 ID",
|
||||
"name": "session_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "事件",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.SuggestionEventRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/title": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -14481,6 +14629,14 @@ const docTemplate = `{
|
||||
"description": "Dedicated chat model ID for the query-understanding (rewrite + intent) step.\nWhen empty, the main conversation ModelID is used as a fallback.",
|
||||
"type": "string"
|
||||
},
|
||||
"question_suggestions": {
|
||||
"description": "===== Conversation Question Suggestions =====\nQuestionSuggestions owns both the static/knowledge-backed prompts shown\nbefore the first user turn and the contextual follow-up questions shown\nafter a completed assistant answer.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QuestionSuggestionConfig"
|
||||
}
|
||||
]
|
||||
},
|
||||
"rerank_model_id": {
|
||||
"description": "ReRank model ID for retrieval",
|
||||
"type": "string"
|
||||
@@ -14520,13 +14676,6 @@ const docTemplate = `{
|
||||
"description": "===== Skills Settings (only for smart-reasoning mode) =====\nSkills selection mode: \"all\" = all preloaded skills, \"selected\" = specific skills, \"none\" = no skills",
|
||||
"type": "string"
|
||||
},
|
||||
"suggested_prompts": {
|
||||
"description": "===== Suggested Prompts =====\n推荐问题列表,用于在前端对话面板展示快捷提问",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"supported_file_types": {
|
||||
"description": "===== File Type Restriction Settings =====\nSupported file types for this agent (e.g., [\"csv\", \"xlsx\", \"xls\"])\nEmpty means all file types are supported\nWhen set, only files with matching extensions can be used with this agent",
|
||||
"type": "array",
|
||||
@@ -14921,6 +15070,47 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.FollowUpSuggestionConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"additional_instruction": {
|
||||
"type": "string"
|
||||
},
|
||||
"allow_regenerate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.GraphNode": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -16123,6 +16313,10 @@ const docTemplate = `{
|
||||
"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\nsession'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)\nThis contains the detailed reasoning process and tool calls made by the agent\nStored for user history display, but NOT included in LLM context to avoid redundancy",
|
||||
"type": "array",
|
||||
@@ -16194,6 +16388,10 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.MentionedItem"
|
||||
}
|
||||
},
|
||||
"model_id": {
|
||||
"description": "ModelID is the requested/effective chat model binding captured for this\nturn. It is useful for reproducibility and suggestion generation.",
|
||||
"type": "string"
|
||||
},
|
||||
"request_id": {
|
||||
"description": "Request identifier for tracking API requests",
|
||||
"type": "string"
|
||||
@@ -16784,6 +16982,17 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.QuestionSuggestionConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"follow_ups": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.FollowUpSuggestionConfig"
|
||||
},
|
||||
"starters": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StarterSuggestionConfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.QueueStat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -17424,6 +17633,26 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.StarterSuggestionConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"mode": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.StorageConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -17536,6 +17765,17 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.SuggestionAttribution": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"suggestion_set_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.SyncLog": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -19060,6 +19300,14 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.EnsureMessageSuggestionsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"regenerate": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.EvaluationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -20015,6 +20263,24 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.SuggestionEventRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"event_type",
|
||||
"suggestion_set_id"
|
||||
],
|
||||
"properties": {
|
||||
"event_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"question_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"suggestion_set_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.TestProviderRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -20533,6 +20799,9 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"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)",
|
||||
"type": "string"
|
||||
|
||||
Reference in New Issue
Block a user