123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- /**
- * {
- * "modelClassId": 41,
- * "modelMcpId": 56,
- * "message": [
- * {
- * "role": "user",
- * "timestamp": 1719242380731,
- * "id": "88",
- * "content": "分析一下最近10条登录日志"
- * }
- * ],
- * "UserId": 10
- * }
- */
- // 消息类型定义
- export type Message = {
- id: number
- role: 'user' | 'assistant' | 'system' | 'meta'
- content: string
- timestamp: number
- }
- export type ChatRequest = {
- modelClassId?: number
- modelMcpId?: number[]
- message: Message[]
- }
- export type ChatResponseType = 'message' | 'toolcall' | 'toolres' | 'error'
- export type ChatResponseBase<T = ChatResponseType> = {
- type: T
- }
- export type Text = ChatResponseBase<'message'> & {
- message: string
- }
- export type ToolCallRequest = ChatResponseBase<'toolcall'> & {
- request: {
- name: string,
- data: string
- }
- }
- export type ToolCallResponse = ChatResponseBase<'toolres'> & {
- response: {
- name: string,
- data: string
- }
- }
- export type ErrorResponse = ChatResponseBase<'error'> & {
- error: string
- }
- export type MetaResponse = ChatResponseBase<'meta'> & {
- meta: string
- }
- export type ChatResponse = Text | ToolCallRequest | ToolCallResponse | ErrorResponse
- // 大语言模型配置相关类型定义
- // 大语言模型配置列表查询参数
- export type LmConfigListParams = {
- keyWord?: string // 搜索关键字
- dateRange?: string[] // 日期范围
- OrderBy?: string // 排序
- pageNum?: number // 分页号码,默认1
- pageSize?: number // 分页数量,最大500,默认10
- modelClass?: string // 模型分类
- modelName?: string // 模型名称
- modelType?: string // 模型类型
- status?: string // 是否启用
- createdAt?: string // 创建时间
- }
- // 大语言模型配置基础信息
- export type LmConfigInfo = {
- id?: number
- modelClass?: string // 模型分类
- modelName?: string // 模型名称
- apiKey?: string // API密钥
- baseUrl?: string // 基础URL
- modelType?: string // 模型类型
- isCallFun?: boolean // 是否调用函数
- maxToken?: number // 最大令牌数
- status: boolean // 是否启用
- createdAt?: string // 创建时间
- updatedAt?: string // 更新时间
- createdBy?: number // 创建者ID
- updatedBy?: number // 更新者ID
- createdUser?: any // 创建用户信息
- actionBtn?: any // 操作按钮
- [key: string]: any // 允许其他字段
- }
- // 大语言模型配置添加请求
- export type LmConfigAddReq = Omit<LmConfigInfo, 'id' | 'createdAt' | 'updatedAt'>
- // 大语言模型配置编辑请求
- export type LmConfigEditReq = LmConfigInfo & {
- id: number // 编辑时ID必须
- }
- // 大语言模型配置状态设置请求
- export type LmConfigStatusReq = {
- id: number
- status: string
- }
- // 删除请求参数
- export type LmConfigDeleteParams = {
- ids: number[]
- }
- // 获取单个配置参数
- export type LmConfigGetParams = {
- id: number
- }
|