chore: initial baseline with P0-safety .gitignore
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
// =============================================================================
|
||||
// 企微IT智能服务台 — AI Wingman API 调用模块
|
||||
// =============================================================================
|
||||
// 说明:封装与 AI Wingman(坐席智能副驾驶)相关的 HTTP 请求
|
||||
// 对应后端 API:/api/conversations/{id}/wingman
|
||||
// 包括:生成草稿回复、生成会话摘要、生成标签建议
|
||||
// =============================================================================
|
||||
|
||||
import apiClient from './index'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// TypeScript 类型定义 — 与后端 Wingman API 响应格式保持一致
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/** 草稿回复结果 */
|
||||
export interface DraftResult {
|
||||
/** 草稿内容 */
|
||||
content: string
|
||||
/** 置信度(0-1) */
|
||||
confidence: number
|
||||
/** 生成推理说明 */
|
||||
reasoning: string
|
||||
}
|
||||
|
||||
/** 会话摘要结果 */
|
||||
export interface SummaryResult {
|
||||
/** 问题描述 */
|
||||
problem: string
|
||||
/** 原因分析 */
|
||||
cause: string
|
||||
/** 解决方案 */
|
||||
solution: string
|
||||
}
|
||||
|
||||
/** 标签建议结果 */
|
||||
export interface TagsResult {
|
||||
/** 建议标签列表 */
|
||||
suggested_tags: string[]
|
||||
/** 分类 */
|
||||
category: string
|
||||
/** 优先级: low/medium/high */
|
||||
priority: string
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// API 函数
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 生成 AI 草稿回复
|
||||
* 基于当前会话的消息历史,生成坐席可以采纳的草稿回复
|
||||
*
|
||||
* @param conversationId - 会话ID
|
||||
* @returns 草稿回复结果
|
||||
*/
|
||||
export async function generateDraft(conversationId: string): Promise<DraftResult> {
|
||||
const response: AxiosResponse = await apiClient.post(
|
||||
`/conversations/${conversationId}/wingman/draft`
|
||||
)
|
||||
return response.data.data
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成会话自动摘要
|
||||
* 基于完整对话生成结构化摘要,包含问题、原因、解决方案
|
||||
* 通常在结单时调用
|
||||
*
|
||||
* @param conversationId - 会话ID
|
||||
* @returns 会话摘要结果
|
||||
*/
|
||||
export async function generateSummary(conversationId: string): Promise<SummaryResult> {
|
||||
const response: AxiosResponse = await apiClient.post(
|
||||
`/conversations/${conversationId}/wingman/summary`
|
||||
)
|
||||
return response.data.data
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成自动标签建议
|
||||
* 基于对话内容建议标签分类
|
||||
*
|
||||
* @param conversationId - 会话ID
|
||||
* @returns 标签建议结果
|
||||
*/
|
||||
export async function suggestTags(conversationId: string): Promise<TagsResult> {
|
||||
const response: AxiosResponse = await apiClient.post(
|
||||
`/conversations/${conversationId}/wingman/tags`
|
||||
)
|
||||
return response.data.data
|
||||
}
|
||||
Reference in New Issue
Block a user