提交 ba9db2ca authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 e722581d
...@@ -5,7 +5,7 @@ import { uploadFileByUrl } from '@/utils/upload' ...@@ -5,7 +5,7 @@ import { uploadFileByUrl } from '@/utils/upload'
const ChuangKitDesign = defineAsyncComponent(() => import('@/components/ChuangKitDesign.vue')) const ChuangKitDesign = defineAsyncComponent(() => import('@/components/ChuangKitDesign.vue'))
const route = useRoute() // const route = useRoute()
const userStore = useUserStore() const userStore = useUserStore()
...@@ -46,10 +46,10 @@ function onClose() { ...@@ -46,10 +46,10 @@ function onClose() {
<template> <template>
<div class="image-design"> <div class="image-design">
<router-link :to="{ path: 'design', query: route.query }" target="_blank"> <!-- <router-link :to="{ path: 'design', query: route.query }" target="_blank">
<el-button type="primary">打开编辑器</el-button> <el-button type="primary">打开编辑器</el-button>
<!-- <el-button type="primary" @click="designVisible = true">打开编辑器</el-button> --> </router-link> -->
</router-link> <el-button type="primary" @click="designVisible = true">打开编辑器</el-button>
<ul> <ul>
<li <li
v-for="item in data.list" v-for="item in data.list"
......
...@@ -20,7 +20,7 @@ export function useChat(options: any) { ...@@ -20,7 +20,7 @@ export function useChat(options: any) {
ai_creation_max_count: 5, ai_creation_max_count: 5,
ai_polish_max_count: 5, ai_polish_max_count: 5,
ai_expand_max_count: 5, ai_expand_max_count: 5,
ai_refresh_max_count: 5 ai_refresh_max_count: 5,
}) })
async function fetchUsages() { async function fetchUsages() {
...@@ -91,7 +91,6 @@ export function useChat(options: any) { ...@@ -91,7 +91,6 @@ export function useChat(options: any) {
* 假数据Start * 假数据Start
*/ */
const customData: any = { const customData: any = {
'13811534871': `【慧农贷】低利率,活体抵押,创新金融!11月15日厅堂沙龙,好礼相送,期待您的光临,共享财富盛宴!🚀🎉`,
'18810031001': `【慧农贷】低利率,活体抵押,创新金融!11月15日厅堂沙龙,好礼相送,期待您的光临,共享财富盛宴!🚀🎉`, '18810031001': `【慧农贷】低利率,活体抵押,创新金融!11月15日厅堂沙龙,好礼相送,期待您的光临,共享财富盛宴!🚀🎉`,
'18810031002': `【慧农贷·您的融资捷径】 '18810031002': `【慧农贷·您的融资捷径】
...@@ -105,7 +104,7 @@ export function useChat(options: any) { ...@@ -105,7 +104,7 @@ export function useChat(options: any) {
别错过,成功近在咫尺!立刻点击下方链接,开启您的财富快车道!👉[申请入口]👈 别错过,成功近在咫尺!立刻点击下方链接,开启您的财富快车道!👉[申请入口]👈
🔥立即行动,把握机遇,共赴丰收盛宴!🔥` 🔥立即行动,把握机遇,共赴丰收盛宴!🔥`,
} }
const customContent = customData[mobile] const customContent = customData[mobile]
if (customContent) { if (customContent) {
...@@ -124,7 +123,7 @@ export function useChat(options: any) { ...@@ -124,7 +123,7 @@ export function useChat(options: any) {
let params = {} let params = {}
if (data.type === '1') { if (data.type === '1') {
params = { params = {
chat_history: messages.value chat_history: messages.value,
} }
} else { } else {
const docAction: any = { const docAction: any = {
...@@ -133,25 +132,25 @@ export function useChat(options: any) { ...@@ -133,25 +132,25 @@ export function useChat(options: any) {
4: 'expand', 4: 'expand',
5: 'rewrite', 5: 'rewrite',
7: 'abbreviate', 7: 'abbreviate',
8: 'summary' 8: 'summary',
} }
params = { params = {
content: data.content, content: data.content,
doc_action: docAction[data.type], doc_action: docAction[data.type],
full_text: !!(data.type === 2) full_text: !!(data.type === 2),
} }
} }
await fetchEventSource('/api/lab/v1/experiment/marketing-ai/sky-agent3-chat', { await fetchEventSource('/api/lab/v1/experiment/marketing-ai/sky-agent3-chat', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
...options, ...options,
...data, ...data,
api_type: parseInt(data.type) === 1 ? 1 : 2, api_type: parseInt(data.type) === 1 ? 1 : 2,
context: data.content, context: data.content,
params: params params: params,
}), }),
async onopen(response) { async onopen(response) {
if (response.ok) { if (response.ok) {
...@@ -169,7 +168,7 @@ export function useChat(options: any) { ...@@ -169,7 +168,7 @@ export function useChat(options: any) {
return return
} }
const conversationId = message.conversation_id const conversationId = message.conversation_id
const messageIndex = messages.value.findIndex(session => session.conversationId === conversationId) const messageIndex = messages.value.findIndex((session) => session.conversationId === conversationId)
const content = message?.arguments?.reduce((a: any, b: any) => { const content = message?.arguments?.reduce((a: any, b: any) => {
a = b?.messages[0]?.text || '' a = b?.messages[0]?.text || ''
return a return a
...@@ -184,13 +183,13 @@ export function useChat(options: any) { ...@@ -184,13 +183,13 @@ export function useChat(options: any) {
} else { } else {
// 按钮功能返回内容 // 按钮功能返回内容
const requestId = message.request_id const requestId = message.request_id
const messageIndex = messages.value.findIndex(session => session.conversationId === requestId) const messageIndex = messages.value.findIndex((session) => session.conversationId === requestId)
if (messageIndex === -1) { if (messageIndex === -1) {
messages.value.push({ messages.value.push({
conversationId: requestId, conversationId: requestId,
role: 'bot', role: 'bot',
content: message.data?.text || '', content: message.data?.text || '',
input: data.context input: data.context,
}) })
} else { } else {
messages.value[messageIndex].content = message.data?.text messages.value[messageIndex].content = message.data?.text
...@@ -206,7 +205,7 @@ export function useChat(options: any) { ...@@ -206,7 +205,7 @@ export function useChat(options: any) {
console.log(err) console.log(err)
isLoading.value = false isLoading.value = false
throw err throw err
} },
}) })
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论