diff --git a/.image/common/ai-feature.png b/.image/common/ai-feature.png new file mode 100644 index 00000000..b4a55f54 Binary files /dev/null and b/.image/common/ai-feature.png differ diff --git a/.image/common/ai-preview.gif b/.image/common/ai-preview.gif new file mode 100644 index 00000000..5f13ac4f Binary files /dev/null and b/.image/common/ai-preview.gif differ diff --git a/README.md b/README.md index f69861f0..ce6f2b45 100644 --- a/README.md +++ b/README.md @@ -191,26 +191,24 @@ ps:核心功能已经实现,正在对接微信小程序中... ### 商城系统 +演示地址: + ![功能图](/.image/common/mall-feature.png) ![功能图](/.image/common/mall-preview.png) -_前端基于 crmeb uniapp 经过授权重构,优化代码实现,接入芋道快速开发平台_ - -演示地址: - ### ERP 系统 -![功能图](/.image/common/erp-feature.png) - 演示地址: +![功能图](/.image/common/erp-feature.png) + ### CRM 系统 -![功能图](/.image/common/crm-feature.png) - 演示地址: +![功能图](/.image/common/crm-feature.png) + ## 🐷 演示图 ### 系统功能 diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts index 43ddc7ec..5f8f13ca 100644 --- a/src/api/ai/image/index.ts +++ b/src/api/ai/image/index.ts @@ -56,6 +56,10 @@ export const ImageApi = { getImagePageMy: async (params: PageParam) => { return await request.get({ url: `/ai/image/my-page`, params }) }, + // 获取公开的绘图记录 + getImagePagePublic: async (params: PageParam) => { + return await request.get({ url: `/ai/image/public-page`, params }) + }, // 获取【我的】绘图记录 getImageMy: async (id: number) => { return await request.get({ url: `/ai/image/get-my?id=${id}` }) diff --git a/src/api/ai/write/index.ts b/src/api/ai/write/index.ts new file mode 100644 index 00000000..013f998f --- /dev/null +++ b/src/api/ai/write/index.ts @@ -0,0 +1,85 @@ +import { fetchEventSource } from '@microsoft/fetch-event-source' + +import { getAccessToken } from '@/utils/auth' +import { config } from '@/config/axios/config' +import { AiWriteTypeEnum } from '@/views/ai/utils/constants' +import request from '@/config/axios' + +export interface WriteVO { + type: AiWriteTypeEnum.WRITING | AiWriteTypeEnum.REPLY // 1:撰写 2:回复 + prompt: string // 写作内容提示 1。撰写 2回复 + originalContent: string // 原文 + length: number // 长度 + format: number // 格式 + tone: number // 语气 + language: number // 语言 + userId?: number // 用户编号 + platform?: string // 平台 + model?: string // 模型 + generatedContent?: string // 生成的内容 + errorMessage?: string // 错误信息 + createTime?: Date // 创建时间 +} + +export interface AiWritePageReqVO extends PageParam { + userId?: number // 用户编号 + type?: AiWriteTypeEnum // 写作类型 + platform?: string // 平台 + createTime?: [string, string] // 创建时间 +} + +export interface AiWriteRespVo { + id: number + userId: number + type: number + platform: string + model: string + prompt: string + generatedContent: string + originalContent: string + length: number + format: number + tone: number + language: number + errorMessage: string + createTime: string +} + +export const WriteApi = { + writeStream: ({ + data, + onClose, + onMessage, + onError, + ctrl + }: { + data: WriteVO + onMessage?: (res: any) => void + onError?: (...args: any[]) => void + onClose?: (...args: any[]) => void + ctrl: AbortController + }) => { + const token = getAccessToken() + return fetchEventSource(`${config.base_url}/ai/write/generate-stream`, { + method: 'post', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + }, + openWhenHidden: true, + body: JSON.stringify(data), + onmessage: onMessage, + onerror: onError, + onclose: onClose, + signal: ctrl.signal + }) + }, + // 获取写作列表 + getWritePage: (params: AiWritePageReqVO) => { + return request.get>({ url: `/ai/write/page`, params }) + }, + // 删除写作 + deleteWrite(id: number) { + return request.delete({ url: `/ai/write/delete`, params: { id } }) + } +} diff --git a/src/api/ai/writer/index.ts b/src/api/ai/writer/index.ts deleted file mode 100644 index 9402d9a2..00000000 --- a/src/api/ai/writer/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { fetchEventSource } from '@microsoft/fetch-event-source' - -import { getAccessToken } from '@/utils/auth' -import { config } from '@/config/axios/config' - -export interface WriteVO { - type: 1 | 2 // 1:撰写 2:回复 - prompt: string // 写作内容提示 1。撰写 2回复 - originalContent: string // 原文 - length: number // 长度 - format: number // 格式 - tone: number // 语气 - language: number // 语言 -} - -export const writeStream = ({ - data, - onClose, - onMessage, - onError, - ctrl -}: { - data: WriteVO - onMessage?: (res: any) => void - onError?: (...args: any[]) => void - onClose?: (...args: any[]) => void - ctrl: AbortController -}) => { - const token = getAccessToken() - return fetchEventSource(`${config.base_url}/ai/write/generate-stream`, { - method: 'post', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${token}` - }, - openWhenHidden: true, - body: JSON.stringify(data), - onmessage: onMessage, - onerror: onError, - onclose: onClose, - signal: ctrl.signal - }) -} diff --git a/src/components/MarkdownView/index.vue b/src/components/MarkdownView/index.vue index bf9ddd60..55166ff4 100644 --- a/src/components/MarkdownView/index.vue +++ b/src/components/MarkdownView/index.vue @@ -1,28 +1,36 @@ - - - diff --git a/src/views/ai/image/index/components/other/index.vue b/src/views/ai/image/index/components/other/index.vue new file mode 100644 index 00000000..a688be18 --- /dev/null +++ b/src/views/ai/image/index/components/other/index.vue @@ -0,0 +1,216 @@ + + + + diff --git a/src/views/ai/image/index/index.vue b/src/views/ai/image/index/index.vue index a2207be8..1217e793 100644 --- a/src/views/ai/image/index/index.vue +++ b/src/views/ai/image/index/index.vue @@ -18,6 +18,11 @@ ref="stableDiffusionRef" @on-draw-complete="handleDrawComplete" /> +
@@ -33,11 +38,13 @@ import { ImageVO } from '@/api/ai/image' import Dall3 from './components/dall3/index.vue' import Midjourney from './components/midjourney/index.vue' import StableDiffusion from './components/stableDiffusion/index.vue' +import Other from './components/other/index.vue' const imageListRef = ref() // image 列表 ref const dall3Ref = ref() // dall3(openai) ref const midjourneyRef = ref() // midjourney ref const stableDiffusionRef = ref() // stable diffusion ref +const otherRef = ref() // stable diffusion ref // 定义属性 const selectPlatform = ref(AiPlatformEnum.MIDJOURNEY) @@ -53,6 +60,10 @@ const platformOptions = [ { label: 'Stable Diffusion', value: AiPlatformEnum.STABLE_DIFFUSION + }, + { + label: '其它', + value: 'other' } ] @@ -77,6 +88,7 @@ const handleRegeneration = async (image: ImageVO) => { } else if (image.platform === AiPlatformEnum.STABLE_DIFFUSION) { stableDiffusionRef.value.settingValues(image) } + // TODO @fan:貌似 other 重新设置不行? } diff --git a/src/views/ai/image/square/index.vue b/src/views/ai/image/square/index.vue new file mode 100644 index 00000000..4b89985c --- /dev/null +++ b/src/views/ai/image/square/index.vue @@ -0,0 +1,62 @@ + + + diff --git a/src/views/ai/music/components/index.vue b/src/views/ai/music/components/index.vue index 21272522..e1395b56 100644 --- a/src/views/ai/music/components/index.vue +++ b/src/views/ai/music/components/index.vue @@ -1,5 +1,5 @@