Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
955dd3ac
提交
955dd3ac
authored
10月 21, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
d6e9917d
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
175 行增加
和
11 行删除
+175
-11
1.mp4
public/1.mp4
+0
-0
AIChat.vue
src/modules/material/all/components/AIChat.vue
+2
-3
ChuangKitDesign copy.vue
src/modules/material/all/components/ChuangKitDesign copy.vue
+105
-0
ChuangKitDesign.vue
src/modules/material/all/components/ChuangKitDesign.vue
+0
-0
StepOne.vue
src/modules/material/all/components/StepOne.vue
+23
-6
useChat.ts
src/modules/material/all/composables/useChat.ts
+45
-2
没有找到文件。
public/1.mp4
0 → 100644
浏览文件 @
955dd3ac
File added
src/modules/material/all/components/AIChat.vue
浏览文件 @
955dd3ac
...
@@ -38,7 +38,6 @@ const welcomeMessage = computed(() => {
...
@@ -38,7 +38,6 @@ const welcomeMessage = computed(() => {
const
extendInfo
=
data
.
extend_info
||
{}
const
extendInfo
=
data
.
extend_info
||
{}
const
pictureStyle
=
getNameByValue
(
extendInfo
.
picture_style
,
materialPictureStyleList
)
const
pictureStyle
=
getNameByValue
(
extendInfo
.
picture_style
,
materialPictureStyleList
)
const
textPurpose
=
getNameByValue
(
extendInfo
.
text_use
,
textPurposeList
)
const
textPurpose
=
getNameByValue
(
extendInfo
.
text_use
,
textPurposeList
)
console
.
log
(
textPurpose
,
'textPurpose'
)
if
(
data
.
type
==
1
)
{
if
(
data
.
type
==
1
)
{
return
`请帮我创作一个在<b class="bold">“
${
industry
}
行业”</b>,使用的“<b class="bold">
${
textPurpose
}
”</b>,这个内容的使用人员是“<b class="bold">
${
personnel
}
”</b>,通过<b class="bold">“
${
connection
}
”</b>渠道进行投放,使用场景是<b class="bold">“
${
scenario
}
”</b>,字数控制在“<b class="bold">
${
extendInfo
.
text_count
}
字以内</b>“,关键点需要包含:<b class="bold">
${
data
.
key_points
}
</b>。`
return
`请帮我创作一个在<b class="bold">“
${
industry
}
行业”</b>,使用的“<b class="bold">
${
textPurpose
}
”</b>,这个内容的使用人员是“<b class="bold">
${
personnel
}
”</b>,通过<b class="bold">“
${
connection
}
”</b>渠道进行投放,使用场景是<b class="bold">“
${
scenario
}
”</b>,字数控制在“<b class="bold">
${
extendInfo
.
text_count
}
字以内</b>“,关键点需要包含:<b class="bold">
${
data
.
key_points
}
</b>。`
...
@@ -174,7 +173,7 @@ async function handleSave(message) {
...
@@ -174,7 +173,7 @@ async function handleSave(message) {
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(2, item.content)"
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(2, item.content)"
>
AI创作(
{{
usages
.
ai_creation_count
}}
/
{{
usages
.
ai_creation_max_count
}}
)
</el-button
>
AI创作(
{{
usages
.
ai_creation_count
}}
/
{{
usages
.
ai_creation_max_count
}}
)
</el-button
>
>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(3, item.content)"
<
!--
<
el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(3, item.content)"
>
AI改写(
{{
usages
.
ai_polish_count
}}
/
{{
usages
.
ai_polish_max_count
}}
)
</el-button
>
AI改写(
{{
usages
.
ai_polish_count
}}
/
{{
usages
.
ai_polish_max_count
}}
)
</el-button
>
>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(4, item.content)"
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(4, item.content)"
...
@@ -185,7 +184,7 @@ async function handleSave(message) {
...
@@ -185,7 +184,7 @@ async function handleSave(message) {
>
>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(8, item.content)"
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSendType(8, item.content)"
>
AI总结(
{{
usages
.
ai_summary_count
}}
/
{{
usages
.
ai_summary_max_count
}}
)
</el-button
>
AI总结(
{{
usages
.
ai_summary_count
}}
/
{{
usages
.
ai_summary_max_count
}}
)
</el-button
>
>
-->
</
template
>
</
template
>
<!-- 图片 -->
<!-- 图片 -->
<
template
v-if=
"form.type == 2"
>
<
template
v-if=
"form.type == 2"
>
...
...
src/modules/material/all/components/ChuangKitDesign copy.vue
0 → 100644
浏览文件 @
955dd3ac
<
script
setup
>
import
{
onMounted
,
onUnmounted
}
from
'vue'
import
CktDesign
from
'@chuangkit/chuangkit-design'
import
md5
from
'blueimp-md5'
import
{
useUserStore
}
from
'@/stores/user'
import
{
uploadFileByUrl
}
from
'@/utils/upload'
const
model
=
defineModel
()
const
emit
=
defineEmits
([
'close'
])
const
userStore
=
useUserStore
()
/**
* 构建签名
* @param obj 参数对象,对象中的所有属性全部参与签名的生成
* @returns {string} 签名
*/
const
buildSign
=
obj
=>
{
let
signParameterArray
=
[]
for
(
let
key
in
obj
)
{
signParameterArray
.
push
(
`
${
key
}
=
${
obj
[
key
]}
`
)
}
let
signPlaintext
=
signParameterArray
.
sort
().
join
(
'&'
)
return
md5
(
signPlaintext
).
toUpperCase
()
}
/**
* 构建2.0版本签名
* @param appId 第三方企业id
* @param expireTime 时间戳,取当前时间即可
* @param userFlag 用户标记
* @param appSecret 企业密钥
* @returns {string} 签名
*/
const
buildVersion2Sign
=
(
appId
,
expireTime
,
userFlag
,
appSecret
)
=>
{
let
signParameterObj
=
{
app_id
:
appId
,
expire_time
:
expireTime
,
user_flag
:
userFlag
,
app_secret
:
appSecret
}
return
buildSign
(
signParameterObj
)
}
window
.
chuangkitComplete
=
async
result
=>
{
if
(
!
result
.
cktMessage
)
{
return
}
if
(
result
.
kind
==
2
)
{
for
(
const
url
of
result
[
'source-urls'
])
{
model
.
value
=
url
try
{
const
uploadedURL
=
await
uploadFileByUrl
(
url
)
model
.
value
=
uploadedURL
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
if
([
1
,
2
,
3
].
includes
(
result
.
kind
))
{
emit
(
'close'
)
}
}
let
cktInstance
function
openDesignPage
()
{
const
appId
=
'54d9adec77d0402794018d166110f3dd'
const
appSecret
=
'08097010E0EF4B85EE2B8CE438328249'
const
userFlag
=
userStore
.
user
.
id
const
expireTime
=
Date
.
now
()
const
sign
=
buildVersion2Sign
(
appId
,
expireTime
,
userFlag
,
appSecret
)
let
params
=
{
app_id
:
appId
,
expire_time
:
expireTime
,
user_flag
:
userFlag
,
device_type
:
1
,
kind_id
:
447
,
version
:
'2.0'
,
sign
:
sign
,
enable_authorize
:
'1'
,
taxpayer_name
:
'chuangkit'
,
taxpayer_phone
:
'13820659475'
,
taxpayer_number
:
'91120116636067462H'
}
cktInstance
=
new
CktDesign
(
params
)
cktInstance
.
open
()
console
.
log
(
cktInstance
)
}
function
closeDesignPage
()
{
if
(
cktInstance
)
{
cktInstance
.
close
()
}
}
onMounted
(()
=>
openDesignPage
())
onUnmounted
(()
=>
closeDesignPage
())
</
script
>
<
template
>
<div
id=
"ckt-design-page"
></div>
</
template
>
src/modules/material/all/components/ChuangKitDesign.vue
浏览文件 @
955dd3ac
差异被折叠。
点击展开。
src/modules/material/all/components/StepOne.vue
浏览文件 @
955dd3ac
...
@@ -28,7 +28,8 @@ async function handleNext() {
...
@@ -28,7 +28,8 @@ async function handleNext() {
function
wayDisabled
(
item
,
type
)
{
function
wayDisabled
(
item
,
type
)
{
if
(
item
.
value
==
1
)
{
if
(
item
.
value
==
1
)
{
return
!
[
'1'
,
'2'
].
includes
(
type
)
// return !['1', '2'].includes(type)
return
!
[
'1'
].
includes
(
type
)
}
}
if
(
item
.
value
==
3
)
{
if
(
item
.
value
==
3
)
{
return
!
[
'2'
,
'8'
].
includes
(
type
)
return
!
[
'2'
,
'8'
].
includes
(
type
)
...
@@ -40,10 +41,22 @@ function wayDisabled(item, type) {
...
@@ -40,10 +41,22 @@ function wayDisabled(item, type) {
<
template
>
<
template
>
<el-card
shadow=
"never"
>
<el-card
shadow=
"never"
>
<template
#
header
>
基础信息
</
template
>
<template
#
header
>
基础信息
</
template
>
<el-form
label-suffix=
":"
label-width=
"130"
:model=
"form"
:rules=
"rules"
ref=
"formRef"
:disabled=
"action === 'view'"
>
<el-form
label-suffix=
":"
label-width=
"130"
:model=
"form"
:rules=
"rules"
ref=
"formRef"
:disabled=
"action === 'view'"
>
<el-form-item
label=
"营销内容类型"
prop=
"type"
>
<el-form-item
label=
"营销内容类型"
prop=
"type"
>
<el-radio-group
v-model=
"form.type"
:disabled=
"action === 'update'"
@
change=
"form.way = '2'"
>
<el-radio-group
v-model=
"form.type"
:disabled=
"action === 'update'"
@
change=
"form.way = '2'"
>
<el-radio
v-for=
"item in materialType"
:key=
"item.id"
:value=
"item.value"
:disabled=
"$route.query.type ? item.value !== $route.query.type : false"
>
{{ item.label }}
</el-radio>
<el-radio
v-for=
"item in materialType"
:key=
"item.id"
:value=
"item.value"
:disabled=
"$route.query.type ? item.value !== $route.query.type : false"
>
{{ item.label }}
</el-radio
>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<el-form-item
label=
"内容名称"
prop=
"name"
>
<el-form-item
label=
"内容名称"
prop=
"name"
>
...
@@ -51,9 +64,13 @@ function wayDisabled(item, type) {
...
@@ -51,9 +64,13 @@ function wayDisabled(item, type) {
</el-form-item>
</el-form-item>
<el-form-item
label=
"创作方式"
prop=
"way"
>
<el-form-item
label=
"创作方式"
prop=
"way"
>
<el-radio-group
v-model=
"form.way"
>
<el-radio-group
v-model=
"form.way"
>
<el-radio
v-for=
"item in materialMethodList"
:key=
"item.value"
:value=
"item.value"
:disabled=
"wayDisabled(item, form.type)"
>
{{
<el-radio
item.label
v-for=
"item in materialMethodList"
}}
</el-radio>
:key=
"item.value"
:value=
"item.value"
:disabled=
"wayDisabled(item, form.type)"
>
{{ item.label }}
</el-radio
>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
...
src/modules/material/all/composables/useChat.ts
浏览文件 @
955dd3ac
...
@@ -2,6 +2,7 @@ import { fetchEventSource } from '@fortaine/fetch-event-source'
...
@@ -2,6 +2,7 @@ import { fetchEventSource } from '@fortaine/fetch-event-source'
import
{
getAIUsage
,
postGenerateImage
}
from
'../api'
import
{
getAIUsage
,
postGenerateImage
}
from
'../api'
import
type
{
Message
}
from
'../types'
import
type
{
Message
}
from
'../types'
import
{
ElMessage
}
from
'element-plus'
import
{
ElMessage
}
from
'element-plus'
import
{
useUserStore
}
from
'@/stores/user'
export
function
useChat
(
options
:
any
)
{
export
function
useChat
(
options
:
any
)
{
const
messages
=
ref
<
Message
[]
>
([])
const
messages
=
ref
<
Message
[]
>
([])
...
@@ -84,7 +85,40 @@ export function useChat(options: any) {
...
@@ -84,7 +85,40 @@ export function useChat(options: any) {
// }
// }
// })
// })
// }
// }
const
mobile
=
useUserStore
().
user
?.
mobile
||
''
async
function
generateText
(
data
:
any
)
{
async
function
generateText
(
data
:
any
)
{
/**
* 假数据Start
*/
const
customData
:
any
=
{
'18810031001'
:
`【慧农贷】低利率,活体抵押,创新金融!11月15日厅堂沙龙,好礼相送,期待您的光临,共享财富盛宴!🚀🎉`
,
'18810031002'
:
`【慧农贷·您的融资捷径】
🎉好消息!🎊农民朋友们,融资难题一扫而空!🚀
慧农贷,线上申请超便捷,活体抵押灵活多变!畜牧业资金周转不愁,种植业扩大再生产无忧!🌟
极速审批,放款快如闪电⚡,利率低到您心动!🌱
案例分享:李大叔养猪场资金链紧绷,慧农贷一出手,问题迎刃而解!现在,他的养殖场规模翻倍,利润滚滚来!💰
别错过,成功近在咫尺!立刻点击下方链接,开启您的财富快车道!👉[申请入口]👈
🔥立即行动,把握机遇,共赴丰收盛宴!🔥`
}
const
customContent
=
customData
[
mobile
]
if
(
customContent
)
{
isLoading
.
value
=
true
setTimeout
(()
=>
{
messages
.
value
.
push
({
conversationId
:
crypto
.
randomUUID
(),
role
:
'bot'
,
content
:
customContent
})
isLoading
.
value
=
false
},
3000
)
return
}
/**
* 假数据end
*/
isLoading
.
value
=
true
isLoading
.
value
=
true
let
params
=
{}
let
params
=
{}
if
(
data
.
type
===
'1'
)
{
if
(
data
.
type
===
'1'
)
{
...
@@ -112,7 +146,11 @@ export function useChat(options: any) {
...
@@ -112,7 +146,11 @@ export function useChat(options: any) {
'Content-Type'
:
'application/json'
'Content-Type'
:
'application/json'
},
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
...
options
,
...
data
,
api_type
:
parseInt
(
data
.
type
)
===
1
?
1
:
2
,
context
:
data
.
content
,
params
:
params
...
options
,
...
data
,
api_type
:
parseInt
(
data
.
type
)
===
1
?
1
:
2
,
context
:
data
.
content
,
params
:
params
}),
}),
async
onopen
(
response
)
{
async
onopen
(
response
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
...
@@ -147,7 +185,12 @@ export function useChat(options: any) {
...
@@ -147,7 +185,12 @@ export function useChat(options: any) {
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
({
conversationId
:
requestId
,
role
:
'bot'
,
content
:
message
.
data
?.
text
||
''
,
input
:
data
.
context
})
messages
.
value
.
push
({
conversationId
:
requestId
,
role
:
'bot'
,
content
:
message
.
data
?.
text
||
''
,
input
:
data
.
context
})
}
else
{
}
else
{
messages
.
value
[
messageIndex
].
content
=
message
.
data
?.
text
messages
.
value
[
messageIndex
].
content
=
message
.
data
?.
text
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论