diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts index 8fde0654..3e4a534e 100644 --- a/frontend/src/api/agent/index.ts +++ b/frontend/src/api/agent/index.ts @@ -212,3 +212,26 @@ export function deleteIMChannel(id: string) { export function toggleIMChannel(id: string) { return post<{ data: IMChannel }>(`/api/v1/im-channels/${id}/toggle`); } + +// ===== 推荐问题 ===== + +// 推荐问题 +export interface SuggestedQuestion { + question: string; + source: 'faq' | 'document' | 'agent_config'; + knowledge_base_id?: string; +} + +// 获取智能体推荐问题 +// 根据智能体关联的知识库范围返回推荐问题,用于前端对话面板快捷提问 +export function getSuggestedQuestions( + agentId: string, + params?: { knowledge_base_ids?: string[]; knowledge_ids?: string[]; limit?: number } +) { + const query = new URLSearchParams(); + if (params?.knowledge_base_ids?.length) query.set('knowledge_base_ids', params.knowledge_base_ids.join(',')); + if (params?.knowledge_ids?.length) query.set('knowledge_ids', params.knowledge_ids.join(',')); + if (params?.limit) query.set('limit', String(params.limit)); + const qs = query.toString(); + return get<{ data: { questions: SuggestedQuestion[] } }>(`/api/v1/agents/${agentId}/suggested-questions${qs ? '?' + qs : ''}`); +} diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 89d5ad4b..79be0eaa 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -1696,6 +1696,8 @@ export default { chat: { title: 'Chat', newChat: 'New Chat', + suggestedQuestions: 'You can ask me', + suggestedQuestionsLoading: 'Loading suggestions...', inputPlaceholder: 'Enter your message...', send: 'Send', thinking: 'Thinking...', diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 232cef4d..6f73439f 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -289,6 +289,8 @@ export default { chat: { title: "대화", newChat: "새 대화", + suggestedQuestions: "이렇게 물어보세요", + suggestedQuestionsLoading: "추천 질문 로딩 중...", inputPlaceholder: "메시지를 입력하세요...", send: "전송", thinking: "생각 중...", diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index 9b70b050..84787563 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -1857,6 +1857,8 @@ export default { chat: { title: 'Диалог', newChat: 'Новый чат', + suggestedQuestions: 'Вы можете спросить меня', + suggestedQuestionsLoading: 'Загрузка предложений...', inputPlaceholder: 'Введите ваше сообщение...', send: 'Отправить', thinking: 'Думаю...', diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index ee9233f5..9f3e61f7 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -297,6 +297,8 @@ export default { chat: { title: "对话", newChat: "新对话", + suggestedQuestions: "你可以这样问我", + suggestedQuestionsLoading: "正在加载推荐问题...", inputPlaceholder: "请输入您的消息...", send: "发送", thinking: "思考中...", diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 2e648cbe..195ea886 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -2,6 +2,25 @@