feat: 微信公众号技能包重命名(weixin_public_account)并增强功能
- 将 wechat_official_account 重命名为 weixin_public_account,符合中文命名规范 - 新增 DOCX 文档生成技能、聊天历史、请求 ID 中间件 - 增强工作流、热点服务、文章服务等模块功能 - 前端同步重命名组件和 API - 新增架构文档 AR13/AR14、专员文档更新 - 补充测试用例(seed_specialists_test, db_migration_test) Co-Authored-AI: yes
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
import http from './http'
|
||||
|
||||
// 会话持久化:列出当前用户的 AI 对话会话
|
||||
export function listChatConversations() {
|
||||
return http.get('/ai-chat/conversations')
|
||||
}
|
||||
|
||||
// 会话持久化:获取某个会话的历史消息
|
||||
export function getChatConversationMessages(conversationId) {
|
||||
return http.get(`/ai-chat/conversations/${conversationId}/messages`)
|
||||
}
|
||||
|
||||
export function quickActions() {
|
||||
return http.get('/ai-chat/quick-actions')
|
||||
}
|
||||
@@ -32,20 +42,36 @@ export function getSecretsStatus() {
|
||||
return http.get('/ai/secrets-status')
|
||||
}
|
||||
|
||||
// 管理员:AI 通路测试 —— 获取某路由的候选模型清单(配置 model ∪ 自动发现)
|
||||
export function getRouteTestModels(routeId) {
|
||||
return http.post('/ai/route-test/models', { route_id: routeId })
|
||||
}
|
||||
|
||||
// 管理员:AI 通路测试 —— 对单个模型或候选模型逐个发起真实测试
|
||||
// models 为空 → 只测配置 model;填多个 → 逐个试跑
|
||||
export function runRouteTest(params) {
|
||||
return http.post('/ai/route-test/run', params || {})
|
||||
}
|
||||
|
||||
// SSE 流式对话:后端 text/event-stream,每行 "data: {json}\n\n"
|
||||
export async function streamChat(message, context, history, handlers) {
|
||||
// conversationId 可选:传入后请求体会携带 conversation_id,用于会话持久化
|
||||
export async function streamChat(message, context, history, handlers, conversationId = '') {
|
||||
const token = localStorage.getItem('token')
|
||||
const onChunk = typeof handlers === 'function' ? handlers : handlers?.onChunk
|
||||
const onMeta = typeof handlers === 'function' ? null : handlers?.onMeta
|
||||
const onDone = typeof handlers === 'function' ? null : handlers?.onDone
|
||||
const aiRouteId = typeof handlers === 'function' ? '' : (handlers?.aiRouteId || '')
|
||||
const payload = { message, context, history, ai_route_id: aiRouteId }
|
||||
if (conversationId) {
|
||||
payload.conversation_id = conversationId
|
||||
}
|
||||
const resp = await fetch('/api/ai-chat/message', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({ message, context, history, ai_route_id: aiRouteId }),
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
|
||||
if (!resp.ok) {
|
||||
|
||||
Reference in New Issue
Block a user