|
@@ -1,4 +1,4 @@
|
|
|
-<template>
|
|
|
|
|
|
|
+<template>
|
|
|
<div class="ai-chat-container">
|
|
<div class="ai-chat-container">
|
|
|
<div class="message-quick-box">
|
|
<div class="message-quick-box">
|
|
|
<div class="message-quick-box-item" :class="{ 'active': isQuickActions.includes('quick') }">
|
|
<div class="message-quick-box-item" :class="{ 'active': isQuickActions.includes('quick') }">
|
|
@@ -72,7 +72,7 @@
|
|
|
</svg>
|
|
</svg>
|
|
|
</span>
|
|
</span>
|
|
|
</button>
|
|
</button>
|
|
|
- <!-- <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'course'" @click="sendQuickAction(lang.ssBatchInteractiveWeb)">
|
|
|
|
|
|
|
+ <button type="button" class="coco-quick-action" v-if="cocoQuickTab === 'course'" @click="sendQuickAction(lang.ssBatchInteractiveWeb)">
|
|
|
<span class="coco-quick-action-copy">
|
|
<span class="coco-quick-action-copy">
|
|
|
<span class="coco-quick-action-title">{{ lang.ssAiChatQuickBatchGenToolsTitle }}</span>
|
|
<span class="coco-quick-action-title">{{ lang.ssAiChatQuickBatchGenToolsTitle }}</span>
|
|
|
<span class="coco-quick-action-desc">{{ lang.ssAiChatQuickBatchGenToolsDesc }}</span>
|
|
<span class="coco-quick-action-desc">{{ lang.ssAiChatQuickBatchGenToolsDesc }}</span>
|
|
@@ -83,7 +83,7 @@
|
|
|
<path d="M13 5l7 7-7 7"></path>
|
|
<path d="M13 5l7 7-7 7"></path>
|
|
|
</svg>
|
|
</svg>
|
|
|
</span>
|
|
</span>
|
|
|
- </button> -->
|
|
|
|
|
|
|
+ </button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -635,7 +635,7 @@ const sendAction = async (action: string) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (gType.value === 'trigger_batch_tool') {
|
|
if (gType.value === 'trigger_batch_tool') {
|
|
|
- chat_stream(prompt, agentid, props.userid || '', lang.lang, (event) => {
|
|
|
|
|
|
|
+ chat_stream(prompt, agentid, props.userid || '', lang.lang, async (event) => {
|
|
|
if (event.type === 'message') {
|
|
if (event.type === 'message') {
|
|
|
messages.value.at(-1).jsonData.aiContent = md.render(event.data)
|
|
messages.value.at(-1).jsonData.aiContent = md.render(event.data)
|
|
|
messages.value.at(-1).loading = false
|
|
messages.value.at(-1).loading = false
|
|
@@ -643,13 +643,9 @@ const sendAction = async (action: string) => {
|
|
|
}
|
|
}
|
|
|
else if (event.type === 'messageEnd') {
|
|
else if (event.type === 'messageEnd') {
|
|
|
messages.value.at(-1).jsonData.aiContent = md.render(event.data)
|
|
messages.value.at(-1).jsonData.aiContent = md.render(event.data)
|
|
|
- messages.value.at(-1).chatloading = false
|
|
|
|
|
console.log('event.data', event.data)
|
|
console.log('event.data', event.data)
|
|
|
- messages.value.push({
|
|
|
|
|
- role: 'ai',
|
|
|
|
|
- aiContent: lang.ssBatchInteractiveWebDesc2,
|
|
|
|
|
- })
|
|
|
|
|
- chatLoading.value = false
|
|
|
|
|
|
|
+ generate(messages.value.at(-1))
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}, session_name.value, messages.value.at(-1).sourceFiles?.map(file => file.id).filter(Boolean)).then(controller => {
|
|
}, session_name.value, messages.value.at(-1).sourceFiles?.map(file => file.id).filter(Boolean)).then(controller => {
|
|
|
streamController.value = controller
|
|
streamController.value = controller
|
|
@@ -791,6 +787,37 @@ const generate = (message: ChatMessage) => {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (message.jsonData?.gType === 'trigger_batch_tool') {
|
|
|
|
|
+ console.log(message.jsonData?.gType)
|
|
|
|
|
+ const prompt = [
|
|
|
|
|
+ {
|
|
|
|
|
+ role: 'user',
|
|
|
|
|
+ content: `这是用户输入的内容:“${message.jsonData.aiContent}”,根据用户输入的内容,取出里面candidates的值。输出一个json格式的回复`, // ,"imageList":[],"evaluationCriteria":"评价标准" 输出语言为${lang.lang === 'en' ? '英文' : lang.lang === 'hk' ? '繁体中文' : '简体中文'}
|
|
|
|
|
+ },
|
|
|
|
|
+ ]
|
|
|
|
|
+ chat_no_stream2(prompt, { type: 'json_object' }).then((res: any) => {
|
|
|
|
|
+ console.log('批量生成工具', JSON.parse(res))
|
|
|
|
|
+ gType.value = 'chat'
|
|
|
|
|
+ messages.value.at(-1).chatloading = false
|
|
|
|
|
+ messages.value.push({
|
|
|
|
|
+ role: 'ai',
|
|
|
|
|
+ aiContent: lang.ssBatchInteractiveWebDesc2,
|
|
|
|
|
+ jsonData: {
|
|
|
|
|
+ gType: 'trigger_batch_tool'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ chatLoading.value = false
|
|
|
|
|
+ const array = JSON.parse(res).candidates
|
|
|
|
|
+ for (let i = 0; i < array.length; i++) {
|
|
|
|
|
+ const item = array[i]
|
|
|
|
|
+ const pageIndex = item.page_index - 1
|
|
|
|
|
+ if (pageIndex >= 0 && pageIndex < slidesStore.slides.length) {
|
|
|
|
|
+ const slide = slidesStore.slides[pageIndex]
|
|
|
|
|
+ slidesStore.updateSlide({ toolsArray: item.tools }, slide.id)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const setPageId = async (tool: any, json: any) => {
|
|
const setPageId = async (tool: any, json: any) => {
|