From e655b4d6efd4602768024c3f1e4e6357ee79e117 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 10 Jul 2024 23:01:13 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=91AI=EF=BC=9A=E5=86=99=E4=BD=9C=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/writer/index.ts | 20 ++ src/utils/dict.ts | 7 +- src/views/ai/image/index/index.vue | 1 - src/views/ai/music/manager/index.vue | 14 +- src/views/ai/utils/constants.ts | 1 - src/views/ai/write/manager/index.vue | 238 ++++++++++++++++++ src/views/ai/writer/index/components/Left.vue | 8 +- 7 files changed, 278 insertions(+), 11 deletions(-) create mode 100644 src/views/ai/write/manager/index.vue diff --git a/src/api/ai/writer/index.ts b/src/api/ai/writer/index.ts index db876161..7494b259 100644 --- a/src/api/ai/writer/index.ts +++ b/src/api/ai/writer/index.ts @@ -1,4 +1,5 @@ import { fetchEventSource } from '@microsoft/fetch-event-source' +import request from '@/config/axios' import { getAccessToken } from '@/utils/auth' import { config } from '@/config/axios/config' @@ -12,6 +13,12 @@ export interface WriteVO { format: number // 格式 tone: number // 语气 language: number // 语言 + userId?: number // 用户编号 + platform?: string // 平台 + model?: string // 模型 + generatedContent?: string // 生成的内容 + errorMessage: string // 错误信息 + createTime?: Date // 创建时间 } // TODO @hhero:搞成 WriteApi,类似 ConversationApi 一样。这样更有类的概念,后续引入某个 Api,然后调用它的方法就可以了。 @@ -43,3 +50,16 @@ export const writeStream = ({ signal: ctrl.signal }) } + +// AI 写作 API +export const WriteApi = { + // 查询AI 写作分页 + getWritePage: async (params: any) => { + return await request.get({ url: `/ai/write/page`, params }) + }, + + // 删除AI 写作 + deleteWrite: async (id: number) => { + return await request.delete({ url: `/ai/write/delete?id=` + id }) + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 556c8d01..100c1d1d 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -222,5 +222,10 @@ export enum DICT_TYPE { AI_PLATFORM = 'ai_platform', // AI 平台 AI_IMAGE_STATUS = 'ai_image_status', // AI 图片状态 AI_MUSIC_STATUS = 'ai_music_status', // AI 音乐状态 - AI_GENERATE_MODE = 'ai_generate_mode' // AI 生成模式 + AI_GENERATE_MODE = 'ai_generate_mode', // AI 生成模式 + AI_WRITE_TYPE = 'ai_write_type', // AI 写作类型 + AI_WRITE_LENGTH = 'ai_write_length', // AI 写作长度 + AI_WRITE_FORMAT = 'ai_write_format', // AI 写作格式 + AI_WRITE_TONE = 'ai_write_tone', // AI 写作语气 + AI_WRITE_LANGUAGE = 'ai_write_language' // AI 写作语言 } diff --git a/src/views/ai/image/index/index.vue b/src/views/ai/image/index/index.vue index 16732707..c249f8f1 100644 --- a/src/views/ai/image/index/index.vue +++ b/src/views/ai/image/index/index.vue @@ -23,7 +23,6 @@ ref="otherRef" @on-draw-complete="handleDrawComplete" /> -
diff --git a/src/views/ai/music/manager/index.vue b/src/views/ai/music/manager/index.vue index 342f8dd8..462a88d2 100644 --- a/src/views/ai/music/manager/index.vue +++ b/src/views/ai/music/manager/index.vue @@ -9,13 +9,19 @@ label-width="68px" > - + > + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + 新增 + + + 导出 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/ai/writer/index/components/Left.vue b/src/views/ai/writer/index/components/Left.vue index 7f63d68e..2261afc0 100644 --- a/src/views/ai/writer/index/components/Left.vue +++ b/src/views/ai/writer/index/components/Left.vue @@ -81,13 +81,13 @@ - + - + - + - +
重置