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,10 @@
import type { EmailCodeDTO, LoginDTO, LoginVO, RegisterDTO } from './types';
import { post } from '@/utils/request';
export const login = (data: LoginDTO) => post<LoginVO>('/auth/login', data).json();
// 邮箱验证码
export const emailCode = (data: EmailCodeDTO) => post('/resource/email/code', data).json();
// 注册账号
export const register = (data: RegisterDTO) => post('/auth/register', data).json();

View File

@@ -0,0 +1,150 @@
export interface LoginDTO {
username: string;
password: string;
code?: string;
clientId?: string;
grantType?: string;
tenantId?: string;
uuid?: string;
// 二次确认密码
confirmPassword?: string;
}
export interface LoginVO {
access_token?: string;
token?: string;
userInfo?: LoginUser;
}
/**
* LoginUser登录用户身份权限
*/
export interface LoginUser {
/**
* 微信头像
*/
avatar?: string;
/**
* 浏览器类型
*/
browser?: string;
/**
* 部门ID
*/
deptId?: number;
/**
* 部门名
*/
deptName?: string;
/**
* 过期时间
*/
expireTime?: number;
/**
* 登录IP地址
*/
ipaddr?: string;
/**
* 获取登录id
*/
loginId?: string;
/**
* 登录地点
*/
loginLocation?: string;
/**
* 登录时间
*/
loginTime?: number;
/**
* 菜单权限
*/
menuPermission?: string[];
/**
* 用户名
*/
nickName?: string;
/**
* 操作系统
*/
os?: string;
/**
* 数据权限 当前角色ID
*/
roleId?: number;
/**
* 角色权限
*/
rolePermission?: string[];
/**
* 角色对象
*/
roles?: RoleDTO[];
/**
* 租户ID
*/
tenantId?: string;
/**
* 用户唯一标识
*/
token?: string;
/**
* 用户ID
*/
userId?: number;
/**
* 用户名
*/
username?: string;
/**
* 用户类型
*/
userType?: string;
}
/**
* RoleDTO角色
*/
export interface RoleDTO {
/**
* 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限
*/
dataScope?: string;
/**
* 角色ID
*/
roleId?: number;
/**
* 角色权限
*/
roleKey?: string;
/**
* 角色名称
*/
roleName?: string;
}
// 邮箱验证码
export interface EmailCodeDTO {
username?: string;
}
// 邮箱注册
export interface RegisterDTO {
/**
* 邮箱
*/
username: string;
/**
* 密码
*/
password: string;
/**
* 验证码
*/
code: string;
/**
* 确认密码
*/
confirmPassword?: string;
}

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;
}

View File

@@ -0,0 +1,4 @@
export * from './auth';
export * from './chat';
export * from './model';
export * from './session';

View File

@@ -0,0 +1,7 @@
import type { GetSessionListVO } from './types';
import { get } from '@/utils/request';
// 获取当前用户的模型列表
export function getModelList() {
return get<GetSessionListVO[]>('/system/model/modelList').json();
}

View File

@@ -0,0 +1,14 @@
// 查询用户模型列表返回的数据结构
export interface GetSessionListVO {
id?: number;
category?: string;
modelName?: string;
modelDescribe?: string;
modelPrice?: number;
modelType?: string;
modelShow?: string;
systemPrompt?: string;
apiHost?: string;
apiKey?: string;
remark?: string;
}

View File

@@ -0,0 +1,27 @@
import type {
ChatSessionVo,
CreateSessionDTO,
// CreateSessionVO,
GetSessionListParams,
} from './types';
import { del, get, post, put } from '@/utils/request';
export function get_session_list(params: GetSessionListParams) {
return get<ChatSessionVo[]>('/system/session/list', params).json();
}
export function create_session(data: CreateSessionDTO) {
return post('/system/session', data).json();
}
export function update_session(data: ChatSessionVo) {
return put('/system/session', data).json();
}
export function get_session(id: string) {
return get<ChatSessionVo>(`/system/session/${id}`).json();
}
export function delete_session(ids: string[]) {
return del(`/system/session/${ids}`).json();
}

View File

@@ -0,0 +1,154 @@
import type { Component } from 'vue';
export interface GetSessionListParams {
/**
* 创建者
*/
createBy?: number;
/**
* 创建部门
*/
createDept?: number;
/**
* 创建时间
*/
createTime?: Date;
/**
* 主键
*/
id?: number;
/**
* 排序的方向desc或者asc
*/
isAsc?: string;
/**
* 排序列
*/
orderByColumn?: string;
/**
* 当前页数
*/
pageNum?: number;
/**
* 分页大小
*/
pageSize?: number;
/**
* 请求参数
*/
params?: { [key: string]: { [key: string]: any } };
/**
* 备注
*/
remark?: string;
/**
* 会话内容
*/
sessionContent?: string;
/**
* 会话标题
*/
sessionTitle?: string;
/**
* 更新者
*/
updateBy?: number;
/**
* 更新时间
*/
updateTime?: Date;
/**
* 用户id
*/
userId: number;
}
/**
* ChatSessionVo会话管理视图对象 chat_session
*/
export interface ChatSessionVo {
/**
* 主键
*/
// id?: number
id?: string;
/**
* 备注
*/
remark?: string;
/**
* 会话内容
*/
sessionContent?: string;
/**
* 会话标题
*/
sessionTitle?: string;
/**
* 用户id
*/
userId?: number;
/**
* 创建时间
*/
createTime?: Date;
/**
* 自定义的消息前缀图标字段
*/
prefixIcon?: Component;
}
/**
* ChatSessionBo会话管理业务对象 chat_session
*/
export interface CreateSessionDTO {
/**
* 创建者
*/
createBy?: number;
/**
* 创建部门
*/
createDept?: number;
/**
* 创建时间
*/
createTime?: Date;
/**
* 主键
*/
// id?: number;
id?: string;
/**
* 请求参数
*/
params?: { [key: string]: { [key: string]: any } };
/**
* 备注
*/
remark?: string;
/**
* 会话内容
*/
sessionContent?: string;
/**
* 会话标题
*/
sessionTitle: string;
/**
* 更新者
*/
updateBy?: number;
/**
* 更新时间
*/
updateTime?: Date;
/**
* 用户id
*/
userId: number;
}
// export interface CreateSessionVO {
// id: number;
// }