fix(ai): 修复会话列表排序并收敛 createTime 类型
- 三端会话 VO createTime 改为必填字段 - 修复 conversationList.toSorted(...) 未写回导致排序不生效 - 排序和分组时间计算直接使用 Number(createTime) - IM 群聊消息 index > 0 改为 Number(index) > 0 对齐 Vue3 管理后台 e58fe91a2migration
parent
c2707a499a
commit
1ead6888e9
|
|
@ -14,7 +14,7 @@ export namespace AiChatConversationApi {
|
|||
temperature: number; // 温度参数
|
||||
maxTokens: number; // 单条回复的最大 Token 数量
|
||||
maxContexts: number; // 上下文的最大 Message 数量
|
||||
createTime?: Date; // 创建时间
|
||||
createTime: Date; // 创建时间
|
||||
systemMessage?: string; // 角色设定
|
||||
modelName?: string; // 模型名字
|
||||
roleAvatar?: string; // 角色头像
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ async function getChatConversationList() {
|
|||
// 1.1 获取 对话数据
|
||||
conversationList.value = await getChatConversationMyList();
|
||||
// 1.2 排序
|
||||
conversationList.value.toSorted((a, b) => {
|
||||
conversationList.value = conversationList.value.toSorted((a, b) => {
|
||||
return Number(b.createTime) - Number(a.createTime);
|
||||
});
|
||||
// 1.3 没有任何对话情况
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import type { InjectionKey, Ref } from 'vue';
|
||||
|
||||
export interface MusicSong {
|
||||
audioUrl?: string;
|
||||
date?: string;
|
||||
desc?: string;
|
||||
id?: number;
|
||||
imageUrl?: string;
|
||||
lyric?: string;
|
||||
singer?: string;
|
||||
title?: string;
|
||||
videoUrl?: string;
|
||||
}
|
||||
|
||||
export const currentSongKey: InjectionKey<Ref<MusicSong>> =
|
||||
Symbol('currentSong');
|
||||
|
|
@ -78,7 +78,7 @@ const [Grid] = useVbenVxeGrid({
|
|||
<template #atUsers="{ row }">
|
||||
<template v-if="row.atUserIds?.length">
|
||||
<span v-for="(userId, index) in row.atUserIds" :key="userId">
|
||||
<span v-if="index > 0">、</span>
|
||||
<span v-if="Number(index) > 0">、</span>
|
||||
<template v-if="userId === IM_AT_ALL_USER_ID">@{{ IM_AT_ALL_NICKNAME }}</template>
|
||||
<template v-else>@{{ row.atUserNicknames?.[index] || userId }}</template>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ defineExpose({ open });
|
|||
<DescriptionsItem label="@用户" :span="2">
|
||||
<template v-if="detail.atUserIds?.length">
|
||||
<span v-for="(userId, index) in detail.atUserIds" :key="userId">
|
||||
<span v-if="index > 0">、</span>
|
||||
<span v-if="Number(index) > 0">、</span>
|
||||
<template v-if="userId === IM_AT_ALL_USER_ID">
|
||||
@{{ IM_AT_ALL_NICKNAME }}
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export namespace AiChatConversationApi {
|
|||
temperature: number; // 温度参数
|
||||
maxTokens: number; // 单条回复的最大 Token 数量
|
||||
maxContexts: number; // 上下文的最大 Message 数量
|
||||
createTime?: Date; // 创建时间
|
||||
createTime: Date; // 创建时间
|
||||
systemMessage?: string; // 角色设定
|
||||
modelName?: string; // 模型名字
|
||||
roleAvatar?: string; // 角色头像
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ async function getChatConversationList() {
|
|||
// 1.1 获取 对话数据
|
||||
conversationList.value = await getChatConversationMyList();
|
||||
// 1.2 排序
|
||||
conversationList.value.toSorted((a, b) => {
|
||||
conversationList.value = conversationList.value.toSorted((a, b) => {
|
||||
return Number(b.createTime) - Number(a.createTime);
|
||||
});
|
||||
// 1.3 没有任何对话情况
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import type { InjectionKey, Ref } from 'vue';
|
||||
|
||||
export interface MusicSong {
|
||||
audioUrl?: string;
|
||||
date?: string;
|
||||
desc?: string;
|
||||
id?: number;
|
||||
imageUrl?: string;
|
||||
lyric?: string;
|
||||
singer?: string;
|
||||
title?: string;
|
||||
videoUrl?: string;
|
||||
}
|
||||
|
||||
export const currentSongKey: InjectionKey<Ref<MusicSong>> =
|
||||
Symbol('currentSong');
|
||||
|
|
@ -78,7 +78,7 @@ const [Grid] = useVbenVxeGrid({
|
|||
<template #atUsers="{ row }">
|
||||
<template v-if="row.atUserIds?.length">
|
||||
<span v-for="(userId, index) in row.atUserIds" :key="userId">
|
||||
<span v-if="index > 0">、</span>
|
||||
<span v-if="Number(index) > 0">、</span>
|
||||
<template v-if="userId === IM_AT_ALL_USER_ID">@{{ IM_AT_ALL_NICKNAME }}</template>
|
||||
<template v-else>@{{ row.atUserNicknames?.[index] || userId }}</template>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ defineExpose({ open });
|
|||
<DescriptionsItem label="@用户" :span="2">
|
||||
<template v-if="detail.atUserIds?.length">
|
||||
<span v-for="(userId, index) in detail.atUserIds" :key="userId">
|
||||
<span v-if="index > 0">、</span>
|
||||
<span v-if="Number(index) > 0">、</span>
|
||||
<template v-if="userId === IM_AT_ALL_USER_ID">
|
||||
@{{ IM_AT_ALL_NICKNAME }}
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export namespace AiChatConversationApi {
|
|||
temperature: number; // 温度参数
|
||||
maxTokens: number; // 单条回复的最大 Token 数量
|
||||
maxContexts: number; // 上下文的最大 Message 数量
|
||||
createTime?: Date; // 创建时间
|
||||
createTime: Date; // 创建时间
|
||||
systemMessage?: string; // 角色设定
|
||||
modelName?: string; // 模型名字
|
||||
roleAvatar?: string; // 角色头像
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ async function getChatConversationList() {
|
|||
// 1.1 获取 对话数据
|
||||
conversationList.value = await getChatConversationMyList();
|
||||
// 1.2 排序
|
||||
conversationList.value.toSorted((a, b) => {
|
||||
conversationList.value = conversationList.value.toSorted((a, b) => {
|
||||
return Number(b.createTime) - Number(a.createTime);
|
||||
});
|
||||
// 1.3 没有任何对话情况
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import type { InjectionKey, Ref } from 'vue';
|
||||
|
||||
export interface MusicSong {
|
||||
audioUrl?: string;
|
||||
date?: string;
|
||||
desc?: string;
|
||||
id?: number;
|
||||
imageUrl?: string;
|
||||
lyric?: string;
|
||||
singer?: string;
|
||||
title?: string;
|
||||
videoUrl?: string;
|
||||
}
|
||||
|
||||
export const currentSongKey: InjectionKey<Ref<MusicSong>> =
|
||||
Symbol('currentSong');
|
||||
|
|
@ -78,7 +78,7 @@ const [Grid] = useVbenVxeGrid({
|
|||
<template #atUsers="{ row }">
|
||||
<template v-if="row.atUserIds?.length">
|
||||
<span v-for="(userId, index) in row.atUserIds" :key="userId">
|
||||
<span v-if="index > 0">、</span>
|
||||
<span v-if="Number(index) > 0">、</span>
|
||||
<template v-if="userId === IM_AT_ALL_USER_ID">@{{ IM_AT_ALL_NICKNAME }}</template>
|
||||
<template v-else>@{{ row.atUserNicknames?.[index] || userId }}</template>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ defineExpose({ open });
|
|||
<ElDescriptionsItem label="@用户" :span="2">
|
||||
<template v-if="detail.atUserIds?.length">
|
||||
<span v-for="(userId, index) in detail.atUserIds" :key="userId">
|
||||
<span v-if="index > 0">、</span>
|
||||
<span v-if="Number(index) > 0">、</span>
|
||||
<template v-if="userId === IM_AT_ALL_USER_ID">
|
||||
@{{ IM_AT_ALL_NICKNAME }}
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue