Initial commit: HZHub project setup with RuoYi-AI base

This commit is contained in:
2026-03-26 09:47:46 +00:00
commit 3584e491cc
5005 changed files with 318595 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import type { ChatMessageVo, GetChatListParams, SendDTO, workflowVo } from './types';
import { get, post } from '@/utils/request';
// 发送消息
export const send = (data: SendDTO) => post('/chat/send', data);
// 新增对应会话聊天记录
export function addChat(data: ChatMessageVo) {
return post('/system/message', data).json();
}
// 获取当前会话的聊天记录
export function getChatList(params: GetChatListParams) {
return get<ChatMessageVo[]>('/system/message/list', params).json();
}
// 获取知识库列表
export function getKnowledgeList() {
return get('/system/info/list').json();
}
// 获取工作流列表
export function getWorkflowList(params: workflowVo) {
// 将参数转换为查询字符串
const queryString = new URLSearchParams(params as Record<string, string>).toString();
// 拼接 URL
const url = `/admin/workflow/search?${queryString}`;
// 发送 POST 请求
return post<workflowVo[]>(url, {}).json();
}

View File

@@ -0,0 +1,283 @@
/**
* 工作流请求体
*/
export interface WorkFlowRunner {
workflowId?: string;
inputs?: {
name: string;
type: string;
content: {
value: string;
type: string;
};
}[];
}
/**
* 人机交互信息体
*/
export interface ReSumeRunner {
runtimeUuid?: string;
feedbackContent?: string;
}
/**
* SSE 事件类型
*/
export type SseEventType = 'content' | 'reasoning' | 'done' | 'error' | 'message';
/**
* SSE 事件数据
*/
export interface SseEventData {
/**
* 事件类型
*/
event: SseEventType;
/**
* 消息内容
*/
content?: string;
/**
* 推理内容(深度思考模式)
*/
reasoningContent?: string;
/**
* 错误信息
*/
error?: string;
/**
* 是否完成
*/
done?: boolean;
}
/**
* ChatRequest描述对话请求对象
*/
export interface SendDTO {
/**
* 传入的模型(必填)
*/
model: string;
/**
* 对话消息(必填)
*/
content: string;
/**
* 工作流请求体
*/
workFlowRunner?: WorkFlowRunner;
/**
* 人机交互信息体
*/
reSumeRunner?: ReSumeRunner;
/**
* 是否为人机交互用户继续输入
*/
isResume?: boolean;
/**
* 是否启用工作流
*/
enableWorkFlow?: boolean;
/**
* 会话id
*/
sessionId?: string;
/**
* 知识库id
*/
knowledgeId?: string;
/**
* 应用ID
*/
appId?: string;
/**
* 对话id(每个聊天窗口都不一样)
*/
uuid?: number;
/**
* 是否启用深度思考
*/
enableThinking?: boolean;
/**
* 是否支持联网
*/
enableInternet?: boolean;
}
/**
* Message描述
*/
export interface Message {
content?: string;
name?: string;
reasoning_content?: string;
/**
* 目前支持四个中角色参考官网,进行情景输入:
* https://platform.openai.com/docs/guides/chat/introduction
*/
role?: 'system' | 'user' | 'assistant' | 'function' | 'tool';
tool_call_id?: string;
/**
* The tool calls generated by the model, such as function calls.
*/
tool_calls?: ToolCalls[];
}
/**
* ToolCallsThe tool calls generated by the model, such as function calls.
*/
export interface ToolCalls {
function?: ToolCallFunction;
/**
* The ID of the tool call.
*/
id?: string;
/**
* The type of the tool. Currently, only function is supported.
*/
type?: string;
}
/**
* ToolCallFunctionToolCall 的 Function参数
* The function that the model called.
*/
export interface ToolCallFunction {
/**
* 方法参数
*/
arguments?: string;
/**
* 方法名
*/
name?: string;
}
export interface GetChatListParams {
/**
* 消息内容
*/
content?: string;
/**
* 创建者
*/
createBy?: number;
/**
* 创建部门
*/
createDept?: number;
/**
* 创建时间
*/
createTime?: Date;
/**
* 扣除金额
*/
deductCost?: number;
/**
* 主键
*/
id?: number;
/**
* 排序的方向desc或者asc
*/
isAsc?: string;
/**
* 模型名称
*/
modelName?: string;
/**
* 排序列
*/
orderByColumn?: string;
/**
* 当前页数
*/
pageNum?: number;
/**
* 分页大小
*/
pageSize?: number;
/**
* 请求参数
*/
params?: { [key: string]: { [key: string]: any } };
/**
* 备注
*/
remark?: string;
/**
* 对话角色
*/
role?: string;
/**
* 会话id
*/
sessionId?: string;
/**
* 累计 Tokens
*/
totalTokens?: number;
/**
* 更新者
*/
updateBy?: number;
/**
* 更新时间
*/
updateTime?: Date;
/**
* 用户id
*/
userId?: number;
}
/**
* ChatMessageVo聊天消息视图对象 chat_message
*/
export interface ChatMessageVo {
/**
* 消息内容
*/
content?: string;
/**
* 扣除金额
*/
deductCost?: number;
/**
* 主键
*/
id?: number;
/**
* 模型名称
*/
modelName?: string;
/**
* 备注
*/
remark?: string;
/**
* 对话角色
*/
role?: string;
/**
* 会话id
*/
sessionId?: string;
/**
* 累计 Tokens
*/
totalTokens?: number;
/**
* 用户id
*/
userId?: number;
}
export interface workflowVo {
currentPage?: number;
pageSize?: number;
}