feat: 去除所有接口中的 vo

This commit is contained in:
xingyu4j
2025-06-25 18:48:16 +08:00
parent 2855eb4e08
commit c59ebbecfd
51 changed files with 232 additions and 236 deletions

View File

@@ -44,7 +44,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
const searchName = ref<string>(''); // 对话搜索
const activeConversationId = ref<null | number>(null); // 选中的对话,默认为 null
const hoverConversationId = ref<null | number>(null); // 悬浮上去的对话
const conversationList = ref([] as AiChatConversationApi.ChatConversationVO[]); // 对话列表
const conversationList = ref([] as AiChatConversationApi.ChatConversation[]); // 对话列表
const conversationMap = ref<any>({}); // 对话分组 (置顶、今天、三天前、一星期前、一个月前)
const loading = ref<boolean>(false); // 加载中
const loadingTime = ref<any>();
@@ -118,7 +118,7 @@ async function getChatConversationList() {
/** 按照 creteTime 创建时间,进行分组 */
async function getConversationGroupByCreateTime(
list: AiChatConversationApi.ChatConversationVO[],
list: AiChatConversationApi.ChatConversation[],
) {
// 排序、指定、时间分组(今天、一天前、三天前、七天前、30天前)
// noinspection NonAsciiCharacters
@@ -164,7 +164,7 @@ async function getConversationGroupByCreateTime(
async function createConversation() {
// 1. 新建对话
const conversationId = await createChatConversationMy(
{} as unknown as AiChatConversationApi.ChatConversationVO,
{} as unknown as AiChatConversationApi.ChatConversation,
);
// 2. 获取对话内容
await getChatConversationList();
@@ -176,7 +176,7 @@ async function createConversation() {
/** 修改对话的标题 */
async function updateConversationTitle(
conversation: AiChatConversationApi.ChatConversationVO,
conversation: AiChatConversationApi.ChatConversation,
) {
// 1. 二次确认
prompt({
@@ -188,7 +188,7 @@ async function updateConversationTitle(
await updateChatConversationMy({
id: conversation.id,
title: scope.value,
} as AiChatConversationApi.ChatConversationVO);
} as AiChatConversationApi.ChatConversation);
message.success('重命名成功');
// 3. 刷新列表
await getChatConversationList();
@@ -230,7 +230,7 @@ async function updateConversationTitle(
/** 删除聊天对话 */
async function deleteChatConversation(
conversation: AiChatConversationApi.ChatConversationVO,
conversation: AiChatConversationApi.ChatConversation,
) {
try {
// 删除的二次确认
@@ -261,7 +261,7 @@ async function handleClearConversation() {
/** 对话置顶 */
async function handleTop(
conversation: AiChatConversationApi.ChatConversationVO,
conversation: AiChatConversationApi.ChatConversation,
) {
// 更新对话置顶
conversation.pinned = !conversation.pinned;

View File

@@ -17,7 +17,7 @@ import { $t } from '#/locales';
import { useFormSchema } from '../../data';
const emit = defineEmits(['success']);
const formData = ref<AiChatConversationApi.ChatConversationVO>();
const formData = ref<AiChatConversationApi.ChatConversation>();
const [Form, formApi] = useVbenForm({
commonConfig: {
@@ -41,7 +41,7 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
// 提交表单
const data =
(await formApi.getValues()) as AiChatConversationApi.ChatConversationVO;
(await formApi.getValues()) as AiChatConversationApi.ChatConversation;
try {
await updateChatConversationMy(data);
@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
return;
}
// 加载数据
const data = modalApi.getData<AiChatConversationApi.ChatConversationVO>();
const data = modalApi.getData<AiChatConversationApi.ChatConversation>();
if (!data || !data.id) {
return;
}

View File

@@ -21,11 +21,11 @@ import MessageKnowledge from './MessageKnowledge.vue';
// 定义 props
const props = defineProps({
conversation: {
type: Object as PropType<AiChatConversationApi.ChatConversationVO>,
type: Object as PropType<AiChatConversationApi.ChatConversation>,
required: true,
},
list: {
type: Array as PropType<AiChatMessageApi.ChatMessageVO[]>,
type: Array as PropType<AiChatMessageApi.ChatMessage[]>,
required: true,
},
});
@@ -95,12 +95,12 @@ async function onDelete(id: number) {
}
/** 刷新 */
async function onRefresh(message: AiChatMessageApi.ChatMessageVO) {
async function onRefresh(message: AiChatMessageApi.ChatMessage) {
emits('onRefresh', message);
}
/** 编辑 */
async function onEdit(message: AiChatMessageApi.ChatMessageVO) {
async function onEdit(message: AiChatMessageApi.ChatMessage) {
emits('onEdit', message);
}

View File

@@ -18,7 +18,7 @@ const props = defineProps({
required: true,
},
roleList: {
type: Array as PropType<AiModelChatRoleApi.ChatRoleVO[]>,
type: Array as PropType<AiModelChatRoleApi.ChatRole[]>,
required: true,
},
showMore: {

View File

@@ -36,12 +36,12 @@ const myRoleParams = reactive({
pageNo: 1,
pageSize: 50,
});
const myRoleList = ref<AiModelChatRoleApi.ChatRoleVO[]>([]); // my 分页大小
const myRoleList = ref<AiModelChatRoleApi.ChatRole[]>([]); // my 分页大小
const publicRoleParams = reactive({
pageNo: 1,
pageSize: 50,
});
const publicRoleList = ref<AiModelChatRoleApi.ChatRoleVO[]>([]); // public 分页大小
const publicRoleList = ref<AiModelChatRoleApi.ChatRole[]>([]); // public 分页大小
const activeCategory = ref<string>('全部'); // 选择中的分类
const categoryList = ref<string[]>([]); // 角色分类类别
@@ -55,7 +55,7 @@ async function handleTabsClick(tab: any) {
/** 获取 my role 我的角色 */
async function getMyRole(append?: boolean) {
const params: AiModelChatRoleApi.ChatRolePageReqVO = {
const params: AiModelChatRoleApi.ChatRolePageReq = {
...myRoleParams,
name: search.value,
publicStatus: false,
@@ -70,7 +70,7 @@ async function getMyRole(append?: boolean) {
/** 获取 public role 公共角色 */
async function getPublicRole(append?: boolean) {
const params: AiModelChatRoleApi.ChatRolePageReqVO = {
const params: AiModelChatRoleApi.ChatRolePageReq = {
...publicRoleParams,
category: activeCategory.value === '全部' ? '' : activeCategory.value,
name: search.value,
@@ -148,9 +148,9 @@ async function handlerCardPage(type: string) {
/** 选择 card 角色:新建聊天对话 */
async function handlerCardUse(role: any) {
// 1. 创建对话
const data: AiChatConversationApi.ChatConversationVO = {
const data: AiChatConversationApi.ChatConversation = {
roleId: role.id,
} as unknown as AiChatConversationApi.ChatConversationVO;
} as unknown as AiChatConversationApi.ChatConversation;
const conversationId = await createChatConversationMy(data);
// 2. 跳转页面

View File

@@ -34,14 +34,14 @@ const [FormModal, formModalApi] = useVbenModal({
// 聊天对话
const conversationListRef = ref();
const activeConversationId = ref<null | number>(null); // 选中的对话编号
const activeConversation = ref<AiChatConversationApi.ChatConversationVO | null>(
const activeConversation = ref<AiChatConversationApi.ChatConversation | null>(
null,
); // 选中的 Conversation
const conversationInProgress = ref(false); // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true避免切换对话、删除对话等操作
// 消息列表
const messageRef = ref();
const activeMessageList = ref<AiChatMessageApi.ChatMessageVO[]>([]); // 选中对话的消息列表
const activeMessageList = ref<AiChatMessageApi.ChatMessage[]>([]); // 选中对话的消息列表
const activeMessageListLoading = ref<boolean>(false); // activeMessageList 是否正在加载中
const activeMessageListLoadingTimer = ref<any>(); // activeMessageListLoading Timer 定时器。如果加载速度很快,就不进入加载中
// 消息滚动
@@ -65,7 +65,7 @@ async function getConversation(id: null | number) {
if (!id) {
return;
}
const conversation: AiChatConversationApi.ChatConversationVO =
const conversation: AiChatConversationApi.ChatConversation =
await getChatConversationMy(id);
if (!conversation) {
return;
@@ -81,7 +81,7 @@ async function getConversation(id: null | number) {
* @return 是否切换成功
*/
async function handleConversationClick(
conversation: AiChatConversationApi.ChatConversationVO,
conversation: AiChatConversationApi.ChatConversation,
) {
// 对话进行中,不允许切换
if (conversationInProgress.value) {
@@ -103,7 +103,7 @@ async function handleConversationClick(
/** 删除某个对话*/
async function handlerConversationDelete(
delConversation: AiChatConversationApi.ChatConversationVO,
delConversation: AiChatConversationApi.ChatConversation,
) {
// 删除的对话如果是当前选中的,那么就重置
if (activeConversationId.value === delConversation.id) {
@@ -303,12 +303,12 @@ async function doSendMessage(content: string) {
await doSendMessageStream({
conversationId: activeConversationId.value,
content,
} as AiChatMessageApi.ChatMessageVO);
} as AiChatMessageApi.ChatMessage);
}
/** 真正执行【发送】消息操作 */
async function doSendMessageStream(
userMessage: AiChatMessageApi.ChatMessageVO,
userMessage: AiChatMessageApi.ChatMessage,
) {
// 创建 AbortController 实例,以便中止请求
conversationInAbortController.value = new AbortController();
@@ -326,14 +326,14 @@ async function doSendMessageStream(
type: 'user',
content: userMessage.content,
createTime: new Date(),
} as AiChatMessageApi.ChatMessageVO,
} as AiChatMessageApi.ChatMessage,
{
id: -2,
conversationId: activeConversationId.value,
type: 'assistant',
content: '思考中...',
createTime: new Date(),
} as AiChatMessageApi.ChatMessageVO,
} as AiChatMessageApi.ChatMessage,
);
// 1.2 滚动到最下面
await nextTick();
@@ -398,12 +398,12 @@ async function stopStream() {
}
/** 编辑 message设置为 prompt可以再次编辑 */
function handleMessageEdit(message: AiChatMessageApi.ChatMessageVO) {
function handleMessageEdit(message: AiChatMessageApi.ChatMessage) {
prompt.value = message.content;
}
/** 刷新 message基于指定消息再次发起对话 */
function handleMessageRefresh(message: AiChatMessageApi.ChatMessageVO) {
function handleMessageRefresh(message: AiChatMessageApi.ChatMessage) {
doSendMessage(message.content);
}

View File

@@ -29,7 +29,7 @@ function onRefresh() {
}
/** 删除 */
async function handleDelete(row: AiChatConversationApi.ChatConversationVO) {
async function handleDelete(row: AiChatConversationApi.ChatConversation) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.id]),
key: 'action_key_msg',
@@ -72,7 +72,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
refresh: { code: 'query' },
search: true,
},
} as VxeTableGridOptions<AiChatConversationApi.ChatConversationVO>,
} as VxeTableGridOptions<AiChatConversationApi.ChatConversation>,
separator: false,
});
onMounted(async () => {

View File

@@ -26,7 +26,7 @@ function onRefresh() {
}
/** 删除 */
async function handleDelete(row: AiChatConversationApi.ChatConversationVO) {
async function handleDelete(row: AiChatConversationApi.ChatConversation) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.id]),
key: 'action_key_msg',
@@ -69,7 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
refresh: { code: 'query' },
search: true,
},
} as VxeTableGridOptions<AiChatConversationApi.ChatConversationVO>,
} as VxeTableGridOptions<AiChatConversationApi.ChatConversation>,
separator: false,
});
onMounted(async () => {