feat: 更新hook fetch 库

This commit is contained in:
ccnetcore
2025-06-28 23:07:32 +08:00
parent 5383d2d40e
commit 216b57a4c7
14 changed files with 34 additions and 27 deletions

View File

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

View File

@@ -7,11 +7,11 @@ export const send = (data: SendDTO) => post<null>('/ai-chat/send', data);
// 新增对应会话聊天记录
export function addChat(data: ChatMessageVo) {
return post('/system/message', data);
return post('/system/message', data).json();
}
// 获取当前会话的聊天记录
export function getChatList(params: GetChatListParams) {
// return get<ChatMessageVo[]>('/system/message/list', params);
return get<ChatMessageVo[]>('/message', params);
return get<ChatMessageVo[]>('/message', params).json();
}

View File

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

View File

@@ -9,19 +9,19 @@ import { del, get, post, put } from '@/utils/request';
// 获取会话列表
export function get_session_list(params: GetSessionListParams) {
// return get<ChatSessionVo[]>('/system/session/list', params);
return get<ChatSessionVo[]>('/session', params);
return get<ChatSessionVo[]>('/session', params).json();
}
// 创建会话
export function create_session(data: CreateSessionDTO) {
return post('/session', data);
return post('/session', data).json();
}
// 更新会话
export function update_session(data: ChatSessionVo) {
return put(`/session/${data.id}`, data);
return put(`/session/${data.id}`, data).json();
}
// 会话详情
export function get_session(id: string) {
return get<ChatSessionVo>(`/session/${id}`);
return get<ChatSessionVo>(`/session/${id}`).json();
}
// 删除会话
export function delete_session(ids: string[]) {

View File

@@ -91,7 +91,7 @@ export interface ChatSessionVo {
/**
* 创建时间
*/
createTime?: Date;
creationTime?: Date;
/**
* 自定义的消息前缀图标字段
*/

View File

@@ -2,5 +2,5 @@ import { get } from '@/utils/request';
// 获取用户信息
export function getUserInfo() {
return get<any>('/ai-chat/account');
return get<any>('/ai-chat/account').json();
}