feat: 更新hook fetch 库
This commit is contained in:
@@ -31,8 +31,8 @@ public class AzureRestChatService : IChatService
|
||||
}).ToList(),
|
||||
stream = true,
|
||||
max_tokens = 2048,
|
||||
temperature = 0.8,
|
||||
top_p = 0.1,
|
||||
// temperature = 0.8,
|
||||
// top_p = 0.1,
|
||||
// presence_penalty = 0,
|
||||
// frequency_penalty = 0,
|
||||
model = aiModelDescribe.ModelId
|
||||
@@ -55,8 +55,13 @@ public class AzureRestChatService : IChatService
|
||||
// 发送POST请求
|
||||
HttpResponseMessage response =
|
||||
await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new UserFriendlyException($"当前模型不可用:{aiModelDescribe.ModelId},状态码:{response.StatusCode},原因:{response.ReasonPhrase}");
|
||||
}
|
||||
// 确认响应成功
|
||||
response.EnsureSuccessStatusCode();
|
||||
// response.EnsureSuccessStatusCode();
|
||||
|
||||
// 读取响应内容
|
||||
var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken);
|
||||
|
||||
@@ -43,4 +43,6 @@ public class MessageAggregateRoot : FullAuditedAggregateRoot<Guid>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
[SugarColumn(IsOwnsOne = true)] public TokenUsageValueObject TokenUsage { get; set; }
|
||||
|
||||
public override bool IsDeleted { get; set; }
|
||||
}
|
||||
@@ -148,7 +148,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
[Authorize(AuthenticationSchemes = TokenTypeConst.Refresh)]
|
||||
public async Task<object> PostRefreshAsync([FromQuery] string refresh_token)
|
||||
{
|
||||
var userId = CurrentUser.Id.Value;
|
||||
var userId = CurrentUser.GetId();
|
||||
var accessToken = await _accountManager.GetTokenByUserIdAsync(userId);
|
||||
var refreshToken = _accountManager.CreateRefreshToken(userId);
|
||||
return new { Token = accessToken, RefreshToken = refreshToken };
|
||||
|
||||
@@ -12,8 +12,8 @@ VITE_WEB_BASE_API = '/dev-api'
|
||||
# VITE_WEB_BASE_API='/prod-api'
|
||||
|
||||
# 本地接口
|
||||
# VITE_API_URL = http://localhost:19001/api/app
|
||||
VITE_API_URL=http://ccnetcore.com:19001/api/app
|
||||
VITE_API_URL = http://localhost:19001/api/app
|
||||
# VITE_API_URL=http://ccnetcore.com:19001/api/app
|
||||
|
||||
# SSO单点登录url
|
||||
VITE_SSO_SEVER_URL='http://localhost:18001'
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"@vueuse/integrations": "^13.3.0",
|
||||
"element-plus": "^2.9.11",
|
||||
"fingerprintjs": "^0.5.3",
|
||||
"hook-fetch": "^1.1.3",
|
||||
"hook-fetch": "^2.0.0-beta.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^3.0.3",
|
||||
"pinia-plugin-persistedstate": "^4.3.0",
|
||||
|
||||
10
Yi.Ai.Vue3/pnpm-lock.yaml
generated
10
Yi.Ai.Vue3/pnpm-lock.yaml
generated
@@ -39,8 +39,8 @@ importers:
|
||||
specifier: ^0.5.3
|
||||
version: 0.5.3
|
||||
hook-fetch:
|
||||
specifier: ^1.1.3
|
||||
version: 1.1.3(react@19.1.0)(typescript-api-pro@0.0.7)(vue@3.5.16(typescript@5.8.3))
|
||||
specifier: ^2.0.0-beta.1
|
||||
version: 2.0.0-beta.1(react@19.1.0)(typescript-api-pro@0.0.7)(vue@3.5.16(typescript@5.8.3))
|
||||
nprogress:
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.0
|
||||
@@ -2811,8 +2811,8 @@ packages:
|
||||
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
|
||||
hasBin: true
|
||||
|
||||
hook-fetch@1.1.3:
|
||||
resolution: {integrity: sha512-FkWKUjZWr83gyew0YbRyEc72dlIGCYvNXiRfi4AXlb/hvIiFPQfcvlP3IFaIYKERUeKXmuBS9fuNuK8JPQiOCg==}
|
||||
hook-fetch@2.0.0-beta.1:
|
||||
resolution: {integrity: sha512-c1pLT1madA4oL1K0+2PNjrdMtXper1CSLJHcsstzohoKKnqYrUF6TKM45Wrwdam7ZGX74j/5XPjfgPuC7VPs7A==}
|
||||
peerDependencies:
|
||||
react: ^19.1.0
|
||||
typescript-api-pro: ^0.0.6
|
||||
@@ -8066,7 +8066,7 @@ snapshots:
|
||||
|
||||
he@1.2.0: {}
|
||||
|
||||
hook-fetch@1.1.3(react@19.1.0)(typescript-api-pro@0.0.7)(vue@3.5.16(typescript@5.8.3)):
|
||||
hook-fetch@2.0.0-beta.1(react@19.1.0)(typescript-api-pro@0.0.7)(vue@3.5.16(typescript@5.8.3)):
|
||||
dependencies:
|
||||
qs: 6.14.0
|
||||
radash: 12.1.0
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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[]) {
|
||||
|
||||
@@ -91,7 +91,7 @@ export interface ChatSessionVo {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime?: Date;
|
||||
creationTime?: Date;
|
||||
/**
|
||||
* 自定义的消息前缀图标字段
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ function handleClick(item: GetSessionListVO) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
height: 500px;
|
||||
height: 200px;
|
||||
overflow: hidden auto;
|
||||
.popover-content-box-items {
|
||||
:deep() {
|
||||
|
||||
@@ -200,7 +200,7 @@ export const useSessionStore = defineStore('session', () => {
|
||||
const currentDate = new Date();
|
||||
|
||||
return sessions.map((session) => {
|
||||
const createDate = new Date(session.createTime!);
|
||||
const createDate = new Date(session.creationTime!);
|
||||
const diffDays = Math.floor(
|
||||
(currentDate.getTime() - createDate.getTime()) / (1000 * 60 * 60 * 24),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user