From 482ce62370d19b205060a490c757e5336c6e97fb Mon Sep 17 00:00:00 2001 From: cherishsince Date: Thu, 16 May 2024 18:29:42 +0800 Subject: [PATCH 001/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91Ai?= =?UTF-8?q?=20=E5=AF=B9=E8=AF=9D=E8=A7=A3=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Conversation.vue | 393 ++++++++++++++++++++++++ src/views/ai/chat/index.vue | 470 ++++++++--------------------- 2 files changed, 522 insertions(+), 341 deletions(-) create mode 100644 src/views/ai/chat/Conversation.vue diff --git a/src/views/ai/chat/Conversation.vue b/src/views/ai/chat/Conversation.vue new file mode 100644 index 00000000..ebbfbc9d --- /dev/null +++ b/src/views/ai/chat/Conversation.vue @@ -0,0 +1,393 @@ + + + + + + diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 0da53f1e..735e5c90 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -1,81 +1,19 @@ + diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index a2dd8c05..3ba1046c 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -34,7 +34,7 @@
- +
@@ -82,12 +82,10 @@ + diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 704a693e..2d61132a 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -31,12 +31,15 @@ - +
- + +
+ +
- +
+ 上下文 +
() // 对话进行中 abort 控制 const inputTimeout = ref() // 处理输入中回车的定时器 const prompt = ref() // prompt const userInfo = ref() // 用户信息 +const enableContext = ref(true) // 是否开启上下文 const fullText = ref(''); const displayedText = ref(''); @@ -327,6 +330,7 @@ const doSendStream = async (userMessage: ChatMessageVO) => { userMessage.conversationId, // TODO 芋艿:这里可能要在优化; userMessage.content, conversationInAbortController.value, + enableContext.value, async (message) => { const data = JSON.parse(message.data) // TODO 芋艿:类型处理; // 如果内容为空,就不处理。 From e7403ba2a450d50100eecc086cf98264f9614711 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 22 May 2024 17:07:54 +0800 Subject: [PATCH 084/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91AI?= =?UTF-8?q?=20chat=20=E5=A2=9E=E5=8A=A0=20new=20chat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/MessageNewChat.vue | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/views/ai/chat/MessageNewChat.vue diff --git a/src/views/ai/chat/MessageNewChat.vue b/src/views/ai/chat/MessageNewChat.vue new file mode 100644 index 00000000..aac5f905 --- /dev/null +++ b/src/views/ai/chat/MessageNewChat.vue @@ -0,0 +1,50 @@ + + + + + From 89deddb9e06aa79af9e9fe4cde87644f57eb0346 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 22 May 2024 17:08:13 +0800 Subject: [PATCH 085/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91AI=20=E5=88=A0=E9=99=A4=E5=AF=B9=E8=AF=9D=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Conversation.vue | 17 ++++++++++------- src/views/ai/chat/index.vue | 18 +++++++++++++++--- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/views/ai/chat/Conversation.vue b/src/views/ai/chat/Conversation.vue index 46988a63..f735252c 100644 --- a/src/views/ai/chat/Conversation.vue +++ b/src/views/ai/chat/Conversation.vue @@ -174,15 +174,15 @@ const getChatConversationList = async () => { conversationList.value = res // 3、默认选中 if (!activeId?.value) { - await handleConversationClick(res[0].id) + // await handleConversationClick(res[0].id) } else { // tip: 删除的刚好是选中的,那么需要重新挑选一个来进行选中 - const filterConversationList = conversationList.value.filter(item => { - return item.id === activeId.value - }) - if (filterConversationList.length <= 0) { - await handleConversationClick(res[0].id) - } + // const filterConversationList = conversationList.value.filter(item => { + // return item.id === activeId.value + // }) + // if (filterConversationList.length <= 0) { + // await handleConversationClick(res[0].id) + // } } // 4、没有 任何对话情况 if (conversationList.value.length === 0) { @@ -367,6 +367,9 @@ watch(activeId, async (newValue, oldValue) => { activeConversationId.value = newValue as string }) +// 定义 public 方法 +defineExpose({createConversation}) + onMounted(async () => { // 默认选中 if (props.activeId != null) { diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 999e1736..0aaa164c 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -2,6 +2,7 @@
- {{ activeConversation?.title }} + {{ activeConversation?.title ? activeConversation?.title : '对话' }}
-
+
@@ -32,11 +33,12 @@
+ + -
@@ -93,6 +95,7 @@ import Conversation from './Conversation.vue' import Message from './Message.vue' import ChatEmpty from './ChatEmpty.vue' import MessageLoading from './MessageLoading.vue' +import MessageNewChat from './MessageNewChat.vue' import {ChatMessageApi, ChatMessageVO} from '@/api/ai/chat/message' import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation' import { getUserProfile, ProfileVO } from '@/api/system/user/profile' @@ -126,6 +129,7 @@ const listLoadingTime = ref() // time定时器,如果加载速度很快 // 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方) const messageRef = ref() +const conversationRef = ref() const isComposing = ref(false) // 判断用户是否在输入 // 默认 role 头像 @@ -490,6 +494,14 @@ const getConversation = async (id: string | null) => { } } +/** + * 对话 - 新建 + */ +const handlerNewChat = async () => { + // 创建对话 + await conversationRef.value.createConversation() +} + // ============ message =========== /** From f1beb488ce06bcce4895a301ef473870255e42ad Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 22 May 2024 17:17:43 +0800 Subject: [PATCH 086/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91AI=20chat=20=E6=A0=87=E9=A2=98=E5=90=8E=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AF=B9=E8=AF=9D=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 0aaa164c..a1366272 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -13,6 +13,7 @@
{{ activeConversation?.title ? activeConversation?.title : '对话' }} + ({{list.length}})
From 03c6a6ce59361cfcf6850eedc37c5845487077c1 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 24 May 2024 10:32:08 +0800 Subject: [PATCH 087/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91Chat=20message=20=E5=A2=9E=E5=8A=A0=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E5=92=8C=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Message.vue | 24 ++++++++++++++++++++++-- src/views/ai/chat/index.vue | 18 +++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/views/ai/chat/Message.vue b/src/views/ai/chat/Message.vue index 1a33b4bd..20277562 100644 --- a/src/views/ai/chat/Message.vue +++ b/src/views/ai/chat/Message.vue @@ -43,6 +43,12 @@ + + + + + +
@@ -59,7 +65,7 @@ import MarkdownView from "@/components/MarkdownView/index.vue"; import {ChatMessageApi, ChatMessageVO} from "@/api/ai/chat/message"; import {useClipboard} from "@vueuse/core"; import {PropType} from "vue"; -import {ArrowDownBold} from "@element-plus/icons-vue"; +import {ArrowDownBold, Edit, RefreshRight} from "@element-plus/icons-vue"; const {copy} = useClipboard() // 初始化 copy 到粘贴板 // 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方) @@ -125,6 +131,20 @@ const onDelete = async (id) => { emits('onDeleteSuccess') } +/** + * 刷新 + */ +const onRefresh = async (message: ChatMessageVO) => { + emits('onRefresh', message) +} + +/** + * 编辑 + */ +const onEdit = async (message: ChatMessageVO) => { + emits('onEdit', message) +} + /** * 回到底部 */ @@ -151,7 +171,7 @@ watch(list, async (newValue, oldValue) => { defineExpose({scrollToBottom, handlerGoTop}) // 定义 emits -const emits = defineEmits(['onDeleteSuccess']) +const emits = defineEmits(['onDeleteSuccess', 'onRefresh', 'onEdit']) // onMounted onMounted(async () => { diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index a1366272..ac97e1ec 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -39,7 +39,9 @@ + @on-delete-success="handlerMessageDelete" + @on-edit="handlerMessageEdit" + @on-refresh="handlerMessageRefresh"/>
@@ -513,6 +515,20 @@ const handlerMessageDelete = async () => { await getMessageList() } +/** + * 编辑 message + */ +const handlerMessageEdit = async (message: ChatMessageVO) => { + prompt.value = message.content +} + +/** + * 编辑 message + */ +const handlerMessageRefresh = async (message: ChatMessageVO) => { + await doSend(message.content) +} + /** * 回到顶部 */ From bebf1e7ae3b5372de72cc82aded87c183e107f86 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 24 May 2024 10:35:11 +0800 Subject: [PATCH 088/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91Chat=20=E8=81=8A=E5=A4=A9=EF=BC=8C=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=B8=85=E7=A9=BA=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Conversation.vue | 9 ++++++++- src/views/ai/chat/index.vue | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/views/ai/chat/Conversation.vue b/src/views/ai/chat/Conversation.vue index f735252c..946735f7 100644 --- a/src/views/ai/chat/Conversation.vue +++ b/src/views/ai/chat/Conversation.vue @@ -122,7 +122,12 @@ const props = defineProps({ }) // 定义钩子 -const emits = defineEmits(['onConversationClick', 'onConversationClear', 'onConversationDelete']) +const emits = defineEmits([ + 'onConversationCreate', + 'onConversationClick', + 'onConversationClear', + 'onConversationDelete' +]) /** * 对话 - 搜索 @@ -256,6 +261,8 @@ const createConversation = async () => { await getChatConversationList() // 3、选中对话 await handleConversationClick(conversationId) + // 4、回调 + emits('onConversationCreate') } /** diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index ac97e1ec..d9a44df1 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -3,6 +3,7 @@ { await getConversation(activeConversationId.value) } +/** + * 对话 - 创建 + */ +const handleConversationCreate = async () => { + // 创建新的对话,清空输入框 + prompt.value = '' +} + /** * 对话 - 点击 */ From 8fb54dbb7c2d797ae754cd97e6ceafdddbd1e8e5 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 24 May 2024 10:39:12 +0800 Subject: [PATCH 089/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91Chat=20=E5=AF=B9=E8=AF=9D=E9=BB=98=E8=AE=A4=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E7=AC=AC=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Conversation.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/ai/chat/Conversation.vue b/src/views/ai/chat/Conversation.vue index 946735f7..4b2d60ef 100644 --- a/src/views/ai/chat/Conversation.vue +++ b/src/views/ai/chat/Conversation.vue @@ -378,12 +378,17 @@ watch(activeId, async (newValue, oldValue) => { defineExpose({createConversation}) onMounted(async () => { + // 获取 对话列表 + await getChatConversationList() // 默认选中 if (props.activeId != null) { activeConversationId.value = props.activeId + } else { + // 首次默认选中第一个 + if (conversationList.value.length) { + activeConversationId.value = conversationList.value[0].id + } } - // 获取 对话列表 - await getChatConversationList() }) From 8764c6c4712bd51c0df22e0bbb32acb1fd98bfa0 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 24 May 2024 15:39:05 +0800 Subject: [PATCH 090/196] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91AI?= =?UTF-8?q?=EF=BC=9A=E6=96=B0=E5=BB=BA=E5=AF=B9=E8=AF=9D=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/chat/conversation/index.ts | 2 +- src/views/ai/chat/Message.vue | 59 ++++++++++++++++++--------- src/views/ai/chat/index.vue | 26 +++++++++--- 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/api/ai/chat/conversation/index.ts b/src/api/ai/chat/conversation/index.ts index b363ea7b..0834643d 100644 --- a/src/api/ai/chat/conversation/index.ts +++ b/src/api/ai/chat/conversation/index.ts @@ -12,8 +12,8 @@ export interface ChatConversationVO { temperature: number // 温度参数 maxTokens: number // 单条回复的最大 Token 数量 maxContexts: number // 上下文的最大 Message 数量 - updateTime: number // 更新时间 // 额外字段 + systemMessage?: string // 角色设定 modelName?: string // 模型名字 roleAvatar?: string // 角色头像 modelMaxTokens?: string // 模型的单条回复的最大 Token 数量 diff --git a/src/views/ai/chat/Message.vue b/src/views/ai/chat/Message.vue index 20277562..445182e5 100644 --- a/src/views/ai/chat/Message.vue +++ b/src/views/ai/chat/Message.vue @@ -1,8 +1,7 @@ From 4c259cd60fb20c696b98da464e4cc4e12bcc5c4b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 25 May 2024 08:59:56 +0800 Subject: [PATCH 096/196] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91AI?= =?UTF-8?q?=EF=BC=9A=E5=AF=B9=E8=AF=9D=E7=AE=A1=E7=90=86=20100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/chat/conversation/index.ts | 5 + src/api/ai/chat/message/index.ts | 17 +- .../ai/chat/manager/ChatConversationList.vue | 163 ++++++++++++++++ src/views/ai/chat/manager/ChatMessageList.vue | 175 ++++++++++++++++++ src/views/ai/chat/manager/index.vue | 173 +---------------- 5 files changed, 365 insertions(+), 168 deletions(-) create mode 100644 src/views/ai/chat/manager/ChatConversationList.vue create mode 100644 src/views/ai/chat/manager/ChatMessageList.vue diff --git a/src/api/ai/chat/conversation/index.ts b/src/api/ai/chat/conversation/index.ts index 07643255..08ad26a1 100644 --- a/src/api/ai/chat/conversation/index.ts +++ b/src/api/ai/chat/conversation/index.ts @@ -55,5 +55,10 @@ export const ChatConversationApi = { // 获得对话分页 getChatConversationPage: async (params: any) => { return await request.get({ url: `/ai/chat/conversation/page`, params }) + }, + + // 管理员删除消息 + deleteChatConversationByAdmin: async (id: number) => { + return await request.delete({ url: `/ai/chat/conversation/delete-by-admin?id=${id}` }) } } diff --git a/src/api/ai/chat/message/index.ts b/src/api/ai/chat/message/index.ts index 7b46f9c2..f9e807a1 100644 --- a/src/api/ai/chat/message/index.ts +++ b/src/api/ai/chat/message/index.ts @@ -55,7 +55,7 @@ export const ChatMessageApi = { body: JSON.stringify({ conversationId, content, - useContext: enableContext, + useContext: enableContext }), onmessage: onMessage, onerror: onError, @@ -71,7 +71,18 @@ export const ChatMessageApi = { // 删除消息 - 对话所有消息 deleteByConversationId: async (conversationId: string) => { - return await request.delete({ url: `/ai/chat/message/delete-by-conversation-id?conversationId=${conversationId}` }) - } + return await request.delete({ + url: `/ai/chat/message/delete-by-conversation-id?conversationId=${conversationId}` + }) + }, + // 获得消息分页 + getChatMessagePage: async (params: any) => { + return await request.get({ url: '/ai/chat/message/page', params }) + }, + + // 管理员删除消息 + deleteChatMessageByAdmin: async (id: number) => { + return await request.delete({ url: `/ai/chat/message/delete-by-admin?id=${id}` }) + } } diff --git a/src/views/ai/chat/manager/ChatConversationList.vue b/src/views/ai/chat/manager/ChatConversationList.vue new file mode 100644 index 00000000..23933f01 --- /dev/null +++ b/src/views/ai/chat/manager/ChatConversationList.vue @@ -0,0 +1,163 @@ + + + diff --git a/src/views/ai/chat/manager/ChatMessageList.vue b/src/views/ai/chat/manager/ChatMessageList.vue new file mode 100644 index 00000000..0d841840 --- /dev/null +++ b/src/views/ai/chat/manager/ChatMessageList.vue @@ -0,0 +1,175 @@ + + + diff --git a/src/views/ai/chat/manager/index.vue b/src/views/ai/chat/manager/index.vue index b36fa413..720ac1ea 100644 --- a/src/views/ai/chat/manager/index.vue +++ b/src/views/ai/chat/manager/index.vue @@ -1,174 +1,17 @@ From 46eb89695d9b502c6de6bca917515099ca3ff9c6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 25 May 2024 10:54:04 +0800 Subject: [PATCH 097/196] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84?= =?UTF-8?q?=E5=AE=A1=E3=80=91AI=EF=BC=9Areview=20=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/ChatEmpty.vue | 5 -- src/views/ai/chat/Conversation.vue | 41 +++++----- src/views/ai/chat/Message.vue | 4 +- src/views/ai/chat/components/Header.vue | 2 - src/views/ai/chat/index.vue | 41 +++++++--- src/views/ai/chat/role/RoleList.vue | 2 +- src/views/ai/chat/role/index.vue | 101 ++++++++++++------------ 7 files changed, 105 insertions(+), 91 deletions(-) diff --git a/src/views/ai/chat/ChatEmpty.vue b/src/views/ai/chat/ChatEmpty.vue index 68a53be9..4268b3d7 100644 --- a/src/views/ai/chat/ChatEmpty.vue +++ b/src/views/ai/chat/ChatEmpty.vue @@ -1,4 +1,3 @@ - diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 83231b57..5386563a 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -10,27 +10,27 @@ /> -
{{ activeConversation?.title ? activeConversation?.title : '对话' }} ({{list.length}})
- - + + +
- +
@@ -87,7 +87,7 @@ - + From cdf0a1137d95771d361db871e44fd11ab1c84080 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 25 May 2024 11:49:23 +0800 Subject: [PATCH 098/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91AI?= =?UTF-8?q?=EF=BC=9A=E5=AF=B9=E8=AF=9D=E7=9A=84=20user=E3=80=81role=20?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E4=BB=8E=E5=89=8D=E7=AB=AF=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Conversation.vue | 3 +- src/views/ai/chat/Message.vue | 27 +++--- src/views/ai/chat/index.vue | 131 ++++++++++++++--------------- 3 files changed, 75 insertions(+), 86 deletions(-) diff --git a/src/views/ai/chat/Conversation.vue b/src/views/ai/chat/Conversation.vue index c8290175..2afeb9ac 100644 --- a/src/views/ai/chat/Conversation.vue +++ b/src/views/ai/chat/Conversation.vue @@ -43,7 +43,7 @@ :class="conversation.id === activeConversationId ? 'conversation active' : 'conversation'" >
- + {{ conversation.title }}
@@ -99,6 +99,7 @@ import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversatio import {ref} from "vue"; import Role from "@/views/ai/chat/role/index.vue"; import {Bottom, Top} from "@element-plus/icons-vue"; +import roleAvatarDefaultImg from '@/assets/ai/gpt.svg' const message = useMessage() // 消息弹窗 diff --git a/src/views/ai/chat/Message.vue b/src/views/ai/chat/Message.vue index bf03becc..942961ed 100644 --- a/src/views/ai/chat/Message.vue +++ b/src/views/ai/chat/Message.vue @@ -1,10 +1,10 @@ From 60de1b973779e955b5cd4ab1a09905d780e79548 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sat, 25 May 2024 21:06:58 +0800 Subject: [PATCH 105/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91Dal?= =?UTF-8?q?l3=20=E5=A2=9E=E5=8A=A0=E5=9B=BE=E7=89=87=E7=94=9F=E6=88=90=20(?= =?UTF-8?q?function=20=E5=BE=85=E5=AE=9E=E7=8E=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/dall3/index.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/views/ai/image/dall3/index.vue b/src/views/ai/image/dall3/index.vue index 95cc5a31..d9ba09f8 100644 --- a/src/views/ai/image/dall3/index.vue +++ b/src/views/ai/image/dall3/index.vue @@ -65,7 +65,10 @@
- +
+ + 生成内容 +
From f156ba18772acdd14f818d5ad1d661cd5abe0014 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sat, 25 May 2024 21:12:36 +0800 Subject: [PATCH 106/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91AI?= =?UTF-8?q?=20Image=20=E5=A2=9E=E5=8A=A0model=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/index.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/views/ai/image/index.vue b/src/views/ai/image/index.vue index 874f9b61..2d594b82 100644 --- a/src/views/ai/image/index.vue +++ b/src/views/ai/image/index.vue @@ -3,10 +3,11 @@
- +
@@ -20,10 +21,11 @@ From 12e87cc0f26fa00354c2778aa89fee83806c3d66 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sat, 25 May 2024 21:18:43 +0800 Subject: [PATCH 107/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91Ai?= =?UTF-8?q?=20Image=20midjourney=20=E5=A2=9E=E5=8A=A0=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=8D=E3=80=81=E6=A8=A1=E5=9E=8B=E3=80=81=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/midjourney/index.vue | 277 +++++++++++++++++++++++- 1 file changed, 275 insertions(+), 2 deletions(-) diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue index 93704d65..bbd523f6 100644 --- a/src/views/ai/image/midjourney/index.vue +++ b/src/views/ai/image/midjourney/index.vue @@ -1,10 +1,283 @@ - + From 86f3ae23016cced342f1385e2ad50cc7f85fcb69 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sat, 25 May 2024 21:20:43 +0800 Subject: [PATCH 108/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91AI?= =?UTF-8?q?=20image=20dall3=20=E8=B0=83=E6=95=B4=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/dall3/index.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/ai/image/dall3/index.vue b/src/views/ai/image/dall3/index.vue index d9ba09f8..587cfbf8 100644 --- a/src/views/ai/image/dall3/index.vue +++ b/src/views/ai/image/dall3/index.vue @@ -46,6 +46,7 @@ fit="contain" @click="handlerModelClick(model)" /> +
{{model.name}}
@@ -198,13 +199,20 @@ const handlerGenerateImage = async () => { margin-top: 15px; .modal-item { - width: 90px; - height: 50px; + width: 110px; //outline: 1px solid blue; overflow: hidden; display: flex; + flex-direction: column; + align-items: center; border: 3px solid transparent; cursor: pointer; + + .model-font { + font-size: 14px; + color: #3e3e3e; + font-weight: bold; + } } .selectModel { From ffa691c4ee9c622fa0cbd43dfc8c6739db323ed1 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 20:08:43 +0800 Subject: [PATCH 109/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/dall3/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ai/image/dall3/index.vue b/src/views/ai/image/dall3/index.vue index 587cfbf8..f141ca1c 100644 --- a/src/views/ai/image/dall3/index.vue +++ b/src/views/ai/image/dall3/index.vue @@ -99,7 +99,7 @@ const models = ref([ }, { key: 'ziran', - name: '清晰', + name: '自然', image: 'https://h5.cxyhub.com/images/model_2.png', }, ]) // 模型 From bfa396b127036558fb05c585f4b486525ea1e720 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 20:22:36 +0800 Subject: [PATCH 110/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=20midjourney=20=E6=A8=A1=E5=9E=8B=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/midjourney/index.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue index bbd523f6..114a1467 100644 --- a/src/views/ai/image/midjourney/index.vue +++ b/src/views/ai/image/midjourney/index.vue @@ -95,12 +95,12 @@ const models = ref([ { key: 'qinxi', name: 'MJ', - image: 'https://h5.cxyhub.com/images/mj.jpeg', + image: 'https://bigpt8.com/pc/_nuxt/mj.34a61377.png', }, { key: 'ziran', name: 'NIJI', - image: 'https://h5.cxyhub.com/images/niji.jpeg', + image: 'https://bigpt8.com/pc/_nuxt/nj.ca79b143.png', }, ]) // 模型 @@ -210,7 +210,7 @@ const handlerGenerateImage = async () => { display: flex; flex-direction: column; align-items: center; - width: 110px; + width: 150px; //outline: 1px solid blue; overflow: hidden; border: 3px solid transparent; From 131e071b2d4cb048c981480dcb0b340b25024645 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 20:47:29 +0800 Subject: [PATCH 111/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91Ai?= =?UTF-8?q?=20Image=20task=20=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTask.vue | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/views/ai/image/ImageTask.vue diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue new file mode 100644 index 00000000..f4c4b9b2 --- /dev/null +++ b/src/views/ai/image/ImageTask.vue @@ -0,0 +1,68 @@ + + + + + From 9c8d10b70c58735fcf5f82e08f8a2cadc956cd17 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 20:59:42 +0800 Subject: [PATCH 112/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91AI?= =?UTF-8?q?=20image=20=E5=A2=9E=E5=8A=A0=E5=9B=BE=E7=89=87=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=8C=E6=8A=BD=E5=B1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageDetailDrawer.vue | 42 ++++++++++++++++++++++++ src/views/ai/image/ImageTask.vue | 29 ++++++++++++++-- 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 src/views/ai/image/ImageDetailDrawer.vue diff --git a/src/views/ai/image/ImageDetailDrawer.vue b/src/views/ai/image/ImageDetailDrawer.vue new file mode 100644 index 00000000..a4e234e8 --- /dev/null +++ b/src/views/ai/image/ImageDetailDrawer.vue @@ -0,0 +1,42 @@ + + + + diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index f4c4b9b2..58046f84 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -11,19 +11,42 @@
- +
- + + From c06dd8e273564e6f4c4cd9e582decf15b275271e Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 21:51:42 +0800 Subject: [PATCH 118/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91Ima?= =?UTF-8?q?ge=20Task=20=E4=BD=BF=E7=94=A8=20card=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTask.vue | 66 +++++++++++--------------------- 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index 58046f84..a612a85d 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -2,22 +2,7 @@ From cb7c5b745808c82f6df89adf2456f70279d9cd89 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 21:53:26 +0800 Subject: [PATCH 119/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91Ima?= =?UTF-8?q?ge=20=E6=8A=BD=E5=B1=89=EF=BC=8C=E4=BD=BF=E7=94=A8=20Card=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageDetailDrawer.vue | 66 +++++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/views/ai/image/ImageDetailDrawer.vue b/src/views/ai/image/ImageDetailDrawer.vue index a4e234e8..7114beda 100644 --- a/src/views/ai/image/ImageDetailDrawer.vue +++ b/src/views/ai/image/ImageDetailDrawer.vue @@ -4,13 +4,35 @@ title="图片详细" @close="handlerDrawerClose" > - Hi, there! +
+
+
图片
+
+ + + +
+
+
+ +
+
+
+
提示词
+
+ {{imageDetail.prompt}} +
+
From 959ee908108357c253ef701a65361d1070aa6c6c Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 26 May 2024 21:56:10 +0800 Subject: [PATCH 120/196] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Image=20Task=20Card=20=E6=8C=89=E9=94=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTask.vue | 11 ++++++++++- src/views/ai/image/ImageTaskCard.vue | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index a612a85d..50a2a7ad 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -2,7 +2,7 @@ @@ -24,11 +21,33 @@ import Dall3 from './dall3/index.vue' import Midjourney from './midjourney/index.vue' import ImageTask from './ImageTask.vue' +// ref +const imageTaskRef = ref() // image task ref + // 定义属性 const selectModel = ref('DALL3绘画') const modelOptions = ['DALL3绘画', 'MJ绘画'] +/** + * 绘画 - start + */ +const handlerDrawStart = async (type) => { + // todo +} + +/** + * 绘画 - complete + */ +const handlerDrawComplete = async (type) => { + // todo + await imageTaskRef.value.getImageList() +} + +// +onMounted( async () => { +}) + From ad10328b735a913a82157c978970d4d815248d06 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 28 May 2024 10:04:44 +0800 Subject: [PATCH 134/196] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91AI?= =?UTF-8?q?=20Image=20=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTaskCard.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/ai/image/ImageTaskCard.vue b/src/views/ai/image/ImageTaskCard.vue index e8a73db9..959209e6 100644 --- a/src/views/ai/image/ImageTaskCard.vue +++ b/src/views/ai/image/ImageTaskCard.vue @@ -1,9 +1,11 @@ + From 36dc3c0b5c03fca829463d947671a52d90f390c5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 26 Jun 2024 12:38:21 +0800 Subject: [PATCH 183/196] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E3=80=91AI=EF=BC=9AMJ=20=E4=BA=8C=E6=AC=A1=20Action?= =?UTF-8?q?=20=E7=9A=84=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/image/index.ts | 78 ++++++++++-------------- src/views/ai/image/ImageDetailDrawer.vue | 6 +- src/views/ai/image/ImageTask.vue | 16 ++--- src/views/ai/image/ImageTaskCard.vue | 6 +- src/views/ai/image/midjourney/index.vue | 4 -- 5 files changed, 47 insertions(+), 63 deletions(-) diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts index 4fd35abe..205d0803 100644 --- a/src/api/ai/image/index.ts +++ b/src/api/ai/image/index.ts @@ -1,51 +1,28 @@ import request from '@/config/axios' // AI API 密钥 VO -// TODO @fan:要不前端不弄太多 VO,就用这个 ImageDetailVO?! -export interface ImageDetailVO { +export interface ImageRespVO { id: number // 编号 - prompt: string // 提示词 - status: number // 状态 - errorMessage: string // 错误信息 - type: string // 模型下分不同的类型(清晰、真实...) - taskId: number // dr 任务id - picUrl: string // 任务地址 - originalPicUrl: string // 绘制图片地址 platform: string // 平台 model: string // 模型 - style: string // 图像生成的风格 - size: string // 图片尺寸 + prompt: string // 提示词 + width: number // 图片宽度 + height: number // 图片高度 + status: number // 状态 + publicStatus: string // 公开状态 + picUrl: string // 任务地址 + errorMessage: string // 错误信息 + options: object // 配置 Map + taskId: number // 任务编号 buttons: ImageMjButtonsVO[] // mj 操作按钮 createTime: string // 创建时间 - updateTime: string // 更新事件 } -export interface ImageMjButtonsVO { - customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 - emoji: string // 图标 emoji - label: string // Make Variations 文本 - style: number // 样式: 2(Primary)、3(Green) -} - -export interface ImageMjActionVO { - id: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 - customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 -} - - export interface ImagePageReqVO { pageNo: number // 分页编号 pageSize: number // 分页大小 } -export interface ImageDallReqVO { - prompt: string // 提示词 - model: string // 模型 - style: string // 图像生成的风格 - width: string // 图片宽度 - height: string // 图片高度 -} - export interface ImageDrawReqVO { platform: string // 平台 prompt: string // 提示词 @@ -65,34 +42,45 @@ export interface ImageMidjourneyImagineReqVO { version: string // 版本 } -// TODO 芋艿:review 下整体注释、方法名 +export interface ImageMjActionVO { + id: number // 图片编号 + customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 +} + +export interface ImageMjButtonsVO { + customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 + emoji: string // 图标 emoji + label: string // Make Variations 文本 + style: number // 样式: 2(Primary)、3(Green) +} + // AI API 密钥 API export const ImageApi = { - // 获取 image 列表 - getImageList: async (params: ImagePageReqVO) => { + // 获取我的图片列表 + getImagePageMy: async (params: ImagePageReqVO) => { return await request.get({ url: `/ai/image/my-page`, params }) }, - // 获取 image 详细信息 - getImageDetail: async (id: number) => { + // 获取我的图片 + getImageMy: async (id: number) => { return await request.get({ url: `/ai/image/get-my?id=${id}`}) }, // 生成图片 drawImage: async (data: ImageDrawReqVO)=> { return await request.post({ url: `/ai/image/draw`, data }) }, - // 删除 - deleteImage: async (id: number)=> { + // 删除我的图片 + deleteImageMy: async (id: number)=> { return await request.delete({ url: `/ai/image/delete-my?id=${id}`}) }, - // ------------ midjourney + // ================ midjourney 专属 ================ - // midjourney - imagine + // 【Midjourney】生成图片 midjourneyImagine: async (data: ImageMidjourneyImagineReqVO)=> { return await request.post({ url: `/ai/image/midjourney/imagine`, data }) }, - // midjourney - action - midjourneyAction: async (params: ImageMjActionVO)=> { - return await request.get({ url: `/ai/image/midjourney/action`, params }) + // 【Midjourney】Action 操作(二次生成图片) + midjourneyAction: async (data: ImageMjActionVO)=> { + return await request.post({ url: `/ai/image/midjourney/action`, data }) }, } diff --git a/src/views/ai/image/ImageDetailDrawer.vue b/src/views/ai/image/ImageDetailDrawer.vue index e26a719a..7c74ef35 100644 --- a/src/views/ai/image/ImageDetailDrawer.vue +++ b/src/views/ai/image/ImageDetailDrawer.vue @@ -60,11 +60,11 @@ diff --git a/src/views/ai/image/manager/index.vue b/src/views/ai/image/manager/index.vue new file mode 100644 index 00000000..ef505036 --- /dev/null +++ b/src/views/ai/image/manager/index.vue @@ -0,0 +1,247 @@ + + + From 9516e7184ffa4d4deb67f409155c38d5eff74f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=A9=B7=28luot1=29?= <1315228474@qq.com> Date: Thu, 27 Jun 2024 17:50:48 +0800 Subject: [PATCH 185/196] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9EAI=20music?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2=E4=BB=A5=E5=8F=8A=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BA=86APPview=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2min-height=E4=B8=BAheight=EF=BC=8C=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BA=86=E7=99=BB=E5=BD=95=E6=97=B6dict=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=EF=BC=8C=E5=9C=A8contentWrap=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=96=B0=E5=A2=9E=E4=BA=86bodystyle=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentWrap/src/ContentWrap.vue | 9 +- src/layout/components/AppView.vue | 12 +-- src/router/modules/remaining.ts | 20 ++++ src/store/modules/dict.ts | 8 +- .../music/components/list/audioBar/index.vue | 9 ++ src/views/ai/music/components/list/index.vue | 94 +++++++++++++++++++ .../music/components/list/songCard/index.vue | 29 ++++++ .../music/components/list/songInfo/index.vue | 33 +++++++ src/views/ai/music/components/mode/desc.vue | 55 +++++++++++ src/views/ai/music/components/mode/index.vue | 44 +++++++++ src/views/ai/music/components/mode/lyric.vue | 83 ++++++++++++++++ src/views/ai/music/components/title/index.vue | 25 +++++ src/views/ai/music/index.vue | 21 +++++ 13 files changed, 428 insertions(+), 14 deletions(-) create mode 100644 src/views/ai/music/components/list/audioBar/index.vue create mode 100644 src/views/ai/music/components/list/index.vue create mode 100644 src/views/ai/music/components/list/songCard/index.vue create mode 100644 src/views/ai/music/components/list/songInfo/index.vue create mode 100644 src/views/ai/music/components/mode/desc.vue create mode 100644 src/views/ai/music/components/mode/index.vue create mode 100644 src/views/ai/music/components/mode/lyric.vue create mode 100644 src/views/ai/music/components/title/index.vue create mode 100644 src/views/ai/music/index.vue diff --git a/src/components/ContentWrap/src/ContentWrap.vue b/src/components/ContentWrap/src/ContentWrap.vue index 454e95c9..c75e4b71 100644 --- a/src/components/ContentWrap/src/ContentWrap.vue +++ b/src/components/ContentWrap/src/ContentWrap.vue @@ -10,12 +10,13 @@ const prefixCls = getPrefixCls('content-wrap') defineProps({ title: propTypes.string.def(''), - message: propTypes.string.def('') + message: propTypes.string.def(''), + bodyStyle: propTypes.object.def({ padding: '20px' }) }) diff --git a/src/layout/components/AppView.vue b/src/layout/components/AppView.vue index 44341873..88d5f0cc 100644 --- a/src/layout/components/AppView.vue +++ b/src/layout/components/AppView.vue @@ -38,24 +38,24 @@ provide('reload', reload) :class="[ 'p-[var(--app-content-padding)] w-[calc(100%-var(--app-content-padding)-var(--app-content-padding))] bg-[var(--app-content-bg-color)] dark:bg-[var(--el-bg-color)]', { - '!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]': + '!h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]': (fixedHeader && (layout === 'classic' || layout === 'topLeft' || layout === 'top') && footer) || (!tagsView && layout === 'top' && footer), - '!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height)-var(--tags-view-height))]': + '!h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height)-var(--tags-view-height))]': tagsView && layout === 'top' && footer, - '!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--top-tool-height)-var(--app-footer-height))]': + '!h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--top-tool-height)-var(--app-footer-height))]': !fixedHeader && layout === 'classic' && footer, - '!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]': + '!h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]': !fixedHeader && layout === 'topLeft' && footer, - '!min-h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding))]': + '!h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding))]': fixedHeader && layout === 'cutMenu' && footer, - '!min-h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding)-var(--tags-view-height))]': + '!h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding)-var(--tags-view-height))]': !fixedHeader && layout === 'cutMenu' && footer } ]" diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index bc62a3c4..ff2c5d92 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -70,6 +70,26 @@ const remainingRouter: AppRouteRecordRaw[] = [ } ] }, + { + path: '/ai/music', + component: Layout, + redirect: '/index', + name: 'AIMusic', + meta: {}, + children: [ + { + path: 'index', + component: () => import('@/views/ai//music/index.vue'), + name: 'AIMusicIndex', + meta: { + title: 'AI 音乐', + icon: 'ep:home-filled', + noCache: false, + affix: true + } + } + ] + }, { path: '/user', component: Layout, diff --git a/src/store/modules/dict.ts b/src/store/modules/dict.ts index e239fb00..1a45335c 100644 --- a/src/store/modules/dict.ts +++ b/src/store/modules/dict.ts @@ -4,7 +4,7 @@ import { store } from '../index' import { DictDataVO } from '@/api/system/dict/types' import { CACHE_KEY, useCache } from '@/hooks/web/useCache' const { wsCache } = useCache('sessionStorage') -import { getSimpleDictDataList } from '@/api/system/dict/dict.data' +// import { getSimpleDictDataList } from '@/api/system/dict/dict.data' export interface DictValueType { value: any @@ -45,7 +45,8 @@ export const useDictStore = defineStore('dict', { this.dictMap = dictMap this.isSetDict = true } else { - const res = await getSimpleDictDataList() + const res = [] + // const res = await getSimpleDictDataList() // 设置数据 const dictDataMap = new Map() res.forEach((dictData: DictDataVO) => { @@ -75,7 +76,8 @@ export const useDictStore = defineStore('dict', { }, async resetDict() { wsCache.delete(CACHE_KEY.DICT_CACHE) - const res = await getSimpleDictDataList() + const res = [] + // const res = await getSimpleDictDataList() // 设置数据 const dictDataMap = new Map() res.forEach((dictData: DictDataVO) => { diff --git a/src/views/ai/music/components/list/audioBar/index.vue b/src/views/ai/music/components/list/audioBar/index.vue new file mode 100644 index 00000000..2b25e40f --- /dev/null +++ b/src/views/ai/music/components/list/audioBar/index.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/views/ai/music/components/list/index.vue b/src/views/ai/music/components/list/index.vue new file mode 100644 index 00000000..bc21034d --- /dev/null +++ b/src/views/ai/music/components/list/index.vue @@ -0,0 +1,94 @@ + + + + + + diff --git a/src/views/ai/music/components/list/songCard/index.vue b/src/views/ai/music/components/list/songCard/index.vue new file mode 100644 index 00000000..dc1ffa8b --- /dev/null +++ b/src/views/ai/music/components/list/songCard/index.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/views/ai/music/components/list/songInfo/index.vue b/src/views/ai/music/components/list/songInfo/index.vue new file mode 100644 index 00000000..4832bfcb --- /dev/null +++ b/src/views/ai/music/components/list/songInfo/index.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/views/ai/music/components/mode/desc.vue b/src/views/ai/music/components/mode/desc.vue new file mode 100644 index 00000000..4488461e --- /dev/null +++ b/src/views/ai/music/components/mode/desc.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/views/ai/music/components/mode/index.vue b/src/views/ai/music/components/mode/index.vue new file mode 100644 index 00000000..bb6cf116 --- /dev/null +++ b/src/views/ai/music/components/mode/index.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/views/ai/music/components/mode/lyric.vue b/src/views/ai/music/components/mode/lyric.vue new file mode 100644 index 00000000..f774003a --- /dev/null +++ b/src/views/ai/music/components/mode/lyric.vue @@ -0,0 +1,83 @@ + + + diff --git a/src/views/ai/music/components/title/index.vue b/src/views/ai/music/components/title/index.vue new file mode 100644 index 00000000..a0658027 --- /dev/null +++ b/src/views/ai/music/components/title/index.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/views/ai/music/index.vue b/src/views/ai/music/index.vue new file mode 100644 index 00000000..b48abb6b --- /dev/null +++ b/src/views/ai/music/index.vue @@ -0,0 +1,21 @@ + + + From 14c9e33b60ebaeb921ac0cadac440549e7ce2e35 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Thu, 27 Jun 2024 18:11:22 +0800 Subject: [PATCH 186/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91get=20=E8=BD=AE=E8=AE=AD=EF=BC=8C=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTask.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index d458db00..ac2e51ff 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -34,6 +34,7 @@ import {ElLoading, LoadingOptionsResolved} from "element-plus"; const message = useMessage() // 消息弹窗 const imageList = ref([]) // image 列表 +const watchImageList = ref([]) // 监听的 image list,一般是生成中,需要轮训 const imageListInterval = ref() // image 列表定时器,刷新列表 const isShowImageDetail = ref(false) // 是否显示 task 详情 const showImageDetailId = ref(0) // 是否显示 task 详情 @@ -83,7 +84,6 @@ const getImageList = async (apply:boolean = false) => { const handlerImageBtnClick = async (type, imageDetail: ImageDetailVO) => { // 获取 image detail id showImageDetailId.value = imageDetail.id - console.log('type', imageDetail.id) // 处理不用 btn if (type === 'more') { await handlerDrawerOpen() From 75d0be9742f01ff6d759386f2a9d9ff436d63f7f Mon Sep 17 00:00:00 2001 From: xiaohong <1315228474@qq.com> Date: Thu, 27 Jun 2024 22:31:49 +0800 Subject: [PATCH 187/196] =?UTF-8?q?feat:=20=E5=B0=86=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=94=B9=E6=88=90=E5=8D=95=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/music/components/list/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/ai/music/components/list/index.vue b/src/views/ai/music/components/list/index.vue index bc21034d..6dce9b8c 100644 --- a/src/views/ai/music/components/list/index.vue +++ b/src/views/ai/music/components/list/index.vue @@ -5,7 +5,7 @@ - + @@ -15,7 +15,7 @@ - + From 8d33476472ddd6667c72ba59f5e7f3f4319fe11c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 27 Jun 2024 23:08:50 +0800 Subject: [PATCH 188/196] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E3=80=91AI=EF=BC=9A=E9=9F=B3=E4=B9=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86=2050%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/image/index.ts | 4 +- src/api/ai/music/index.ts | 40 +++++ src/views/ai/image/ImageDetailDrawer.vue | 34 ++-- src/views/ai/image/ImageTask.vue | 46 ++--- src/views/ai/image/ImageTaskCard.vue | 48 +++-- src/views/ai/image/manager/index.vue | 6 +- src/views/ai/music/manager/index.vue | 215 +++++++++++++++++++++++ 7 files changed, 329 insertions(+), 64 deletions(-) create mode 100644 src/api/ai/music/index.ts create mode 100644 src/views/ai/music/manager/index.vue diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts index cb5a5afd..b895986d 100644 --- a/src/api/ai/image/index.ts +++ b/src/api/ai/image/index.ts @@ -1,7 +1,7 @@ import request from '@/config/axios' -// AI API 密钥 VO -export interface ImageRespVO { +// AI 绘图 VO +export interface ImageVO { id: number // 编号 platform: string // 平台 model: string // 模型 diff --git a/src/api/ai/music/index.ts b/src/api/ai/music/index.ts new file mode 100644 index 00000000..9415d3a2 --- /dev/null +++ b/src/api/ai/music/index.ts @@ -0,0 +1,40 @@ +import request from '@/config/axios' + +// AI 音乐 VO +export interface MusicVO { + id: number // 编号 + userId: number // 用户编号 + title: string // 音乐名称 + lyric: string // 歌词 + imageUrl: string // 图片地址 + audioUrl: string // 音频地址 + videoUrl: string // 视频地址 + status: number // 音乐状态 + gptDescriptionPrompt: string // 描述词 + prompt: string // 提示词 + platform: string // 模型平台 + model: string // 模型 + generateMode: number // 生成模式 + tags: string // 音乐风格标签 + publicStatus: boolean // 是否发布 + taskId: string // 任务id + errorMessage: string // 错误信息 +} + +// AI 音乐 API +export const MusicApi = { + // 查询音乐分页 + getMusicPage: async (params: any) => { + return await request.get({ url: `/ai/music/page`, params }) + }, + + // 修改音乐 + updateMusic: async (data: MusicVO) => { + return await request.put({ url: `/ai/music/update`, data }) + }, + + // 删除音乐 + deleteMusic: async (id: number) => { + return await request.delete({ url: `/ai/music/delete?id=` + id }) + } +} diff --git a/src/views/ai/image/ImageDetailDrawer.vue b/src/views/ai/image/ImageDetailDrawer.vue index 7c74ef35..fca087da 100644 --- a/src/views/ai/image/ImageDetailDrawer.vue +++ b/src/views/ai/image/ImageDetailDrawer.vue @@ -7,11 +7,11 @@ >
- - - - - + + + + +
@@ -21,30 +21,30 @@
时间
-
提交时间:{{imageDetail.createTime}}
+
提交时间:{{ imageDetail.createTime }}
-
生成时间:{{imageDetail.updateTime}}
+
生成时间:{{ imageDetail.updateTime }}
模型
- {{imageDetail.model}}({{imageDetail.height}}x{{imageDetail.width}}) + {{ imageDetail.model }}({{ imageDetail.height }}x{{ imageDetail.width }})
提示词
- {{imageDetail.prompt}} + {{ imageDetail.prompt }}
图片地址
- {{imageDetail.picUrl}} + {{ imageDetail.picUrl }}
@@ -53,18 +53,18 @@
- {{imageDetail?.options?.style}} + {{ imageDetail?.options?.style }}
diff --git a/src/views/ai/image/manager/index.vue b/src/views/ai/image/manager/index.vue index ef505036..d7ac6c81 100644 --- a/src/views/ai/image/manager/index.vue +++ b/src/views/ai/image/manager/index.vue @@ -163,7 +163,7 @@ From e3c46cab5305f3e8badaa84428100579797d21ff Mon Sep 17 00:00:00 2001 From: xiaohong <1315228474@qq.com> Date: Fri, 28 Jun 2024 09:26:58 +0800 Subject: [PATCH 189/196] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4ai=20music=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/modules/remaining.ts | 2 +- src/views/ai/music/{ => components}/index.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/views/ai/music/{ => components}/index.vue (82%) diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index ff2c5d92..6da3b0a4 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -79,7 +79,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ children: [ { path: 'index', - component: () => import('@/views/ai//music/index.vue'), + component: () => import('@/views/ai/music/components/index.vue'), name: 'AIMusicIndex', meta: { title: 'AI 音乐', diff --git a/src/views/ai/music/index.vue b/src/views/ai/music/components/index.vue similarity index 82% rename from src/views/ai/music/index.vue rename to src/views/ai/music/components/index.vue index b48abb6b..21272522 100644 --- a/src/views/ai/music/index.vue +++ b/src/views/ai/music/components/index.vue @@ -8,8 +8,8 @@ From 6f9cb4f8f205ea9567d7865bf16ea73b4135a23e Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 28 Jun 2024 16:41:12 +0800 Subject: [PATCH 191/196] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo?= =?UTF-8?q?=E3=80=91=E5=A6=82=E6=9E=9C=E6=9C=89=E7=94=9F=E6=88=90=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=EF=BC=8C=E8=BD=AE=E8=AF=A2=E6=94=B9?= =?UTF-8?q?=E6=88=90=20get=20=E6=8E=A5=E5=8F=A3=E5=8E=BB=E8=BD=AE=E8=AF=A2?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=9F=BA=E4=BA=8E=20page=20=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/image/index.ts | 4 ++++ src/views/ai/image/ImageTask.vue | 35 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts index cb5a5afd..75103182 100644 --- a/src/api/ai/image/index.ts +++ b/src/api/ai/image/index.ts @@ -64,6 +64,10 @@ export const ImageApi = { getImageMy: async (id: number) => { return await request.get({ url: `/ai/image/get-my?id=${id}` }) }, + // 获取我的图片 + getImageMyIds: async (params) => { + return await request.get({ url: `/ai/image/get-my-ids`, params}) + }, // 生成图片 drawImage: async (data: ImageDrawReqVO) => { return await request.post({ url: `/ai/image/draw`, data }) diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index 38bf7483..992120bd 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -26,7 +26,7 @@ />