|
|
@@ -127,7 +127,7 @@
|
|
|
v-if="message.jsonData?.gType !== 'chat' && message.jsonData?.gType !== 'generate_interactive_web' && message.jsonData?.gType !== 'trigger_tool_recommend' && message.jsonData?.gType !== 'trigger_batch_tool' && !message.chatloading && message.aiContent"
|
|
|
@click="generate(message)">{{ message.gLoading ? lang.ssLoading : lang.ssConfirm }}</button>
|
|
|
<button type="button" class="coco-interactive-web-card"
|
|
|
- v-if="message.jsonData?.gType === 'generate_interactive_web' && !message.chatloading" :class="{ 'loading-state': create_app_loading }" @click="!create_app_loading && handle_add_aiWeb()">
|
|
|
+ v-if="message.jsonData?.gType === 'generate_interactive_web' && !message.chatloading" :class="{ 'loading-state': create_app_loading }" @click="!create_app_loading && handle_add_aiWeb(message)">
|
|
|
<div class="submenu-icon loading-icon" v-show="create_app_loading">
|
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="spin">
|
|
|
<circle cx="12" cy="12" r="10" stroke-dasharray="32" stroke-dashoffset="12"></circle>
|
|
|
@@ -204,7 +204,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <AiWeb :visible="showAiWebModal" :web-id="webId" @close="showAiWebModal = false" @add="addAiWeb" :is-loading="isLoading" />
|
|
|
+ <AiWeb :visible="showAiWebModal" :web-id="webId" @close="showAiWebModal = false" :tx="webTx" @add="addAiWeb" :is-loading="isLoading" />
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -471,11 +471,11 @@ const sendAction = async (action: string) => {
|
|
|
gType: gType.value,
|
|
|
isGenerate: false
|
|
|
}
|
|
|
- messages.value.at(-1).aiContent = lang.ssInteractiveWebWorkspaceDesc
|
|
|
- messages.value.at(-1).loading = false
|
|
|
- messages.value.at(-1).chatloading = false
|
|
|
- chatLoading.value = false
|
|
|
- return
|
|
|
+ // messages.value.at(-1).aiContent = lang.ssInteractiveWebWorkspaceDesc
|
|
|
+ // messages.value.at(-1).loading = false
|
|
|
+ // messages.value.at(-1).chatloading = false
|
|
|
+ // chatLoading.value = false
|
|
|
+ // return
|
|
|
}
|
|
|
else if (gType.value === 'trigger_batch_tool') {
|
|
|
messages.value.at(-1).jsonData = {
|
|
|
@@ -509,12 +509,6 @@ const sendAction = async (action: string) => {
|
|
|
gType: 'generate_interactive_web',
|
|
|
isGenerate: false
|
|
|
}
|
|
|
- messages.value.at(-1).aiContent = lang.ssInteractiveWebWorkspaceDesc
|
|
|
- messages.value.at(-1).loading = false
|
|
|
- chatLoading.value = false
|
|
|
- messages.value.at(-1).chatloading = false
|
|
|
-
|
|
|
- return
|
|
|
}
|
|
|
|
|
|
if (content.includes(lang.ssAiChatQuickAction5)) {
|
|
|
@@ -695,6 +689,32 @@ const sendAction = async (action: string) => {
|
|
|
return
|
|
|
|
|
|
}
|
|
|
+ else if (gType.value === 'generate_interactive_web') {
|
|
|
+ agentid = agentid5.value
|
|
|
+
|
|
|
+
|
|
|
+ chat_stream(prompt, agentid, props.userid || '', lang.lang, async (event) => {
|
|
|
+ if (event.type === 'message') {
|
|
|
+ // messages.value.at(-1).jsonData.aiContent = md.render(event.data)
|
|
|
+ // messages.value.at(-1).loading = false
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (event.type === 'messageEnd') {
|
|
|
+ messages.value.at(-1).aiContent = lang.ssInteractiveWebWorkspaceDesc
|
|
|
+ messages.value.at(-1).jsonData.aiContent = event.data
|
|
|
+ messages.value.at(-1).loading = false
|
|
|
+ chatLoading.value = false
|
|
|
+ messages.value.at(-1).chatloading = false
|
|
|
+ }
|
|
|
+ }, session_name.value, messages.value.at(-1).sourceFiles?.map(file => file.id).filter(Boolean)).then(controller => {
|
|
|
+ streamController.value = controller
|
|
|
+ }).catch(err => {
|
|
|
+ chatLoading.value = false
|
|
|
+ console.log('err', err)
|
|
|
+ stopMessage()
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
chat_stream(prompt, agentid, props.userid || '', lang.lang, (event) => {
|
|
|
if (event.type === 'message') {
|
|
|
@@ -924,6 +944,7 @@ const agentid1 = ref('cbb29b41-2a4a-4453-bf8d-357929ced4bd')// 判断意图
|
|
|
const agentid2 = ref('f86aa63c-b7b7-4d03-9b37-b59f116d36f3')// 生成内容
|
|
|
const agentid3 = ref('caaa43ab-41a5-466a-94bc-74e0c9265068')// 互动工具推荐
|
|
|
const agentid4 = ref('b41bc650-9861-468c-a624-b52269dfff22')// 批量生成工具
|
|
|
+const agentid5 = ref('939d28ef-3a1b-442b-871f-3894eb67ac9c')// 互动网页
|
|
|
|
|
|
const isQuickActions = ref<string[]>([])
|
|
|
const toggleQuickActions = (section: string) => {
|
|
|
@@ -945,11 +966,22 @@ const create_app_loading = ref(false)
|
|
|
const webId = ref('')
|
|
|
const showAiWebModal = ref(false)
|
|
|
const isEdit = ref(false)
|
|
|
+const webTx = ref('')
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
import _ from 'lodash'
|
|
|
const { currentSlide } = storeToRefs(slidesStore)
|
|
|
|
|
|
-const handle_add_aiWeb = _.throttle(async () => {
|
|
|
+const handle_add_aiWeb = _.throttle(async (message: any) => {
|
|
|
+ console.log(message)
|
|
|
+ const aiContent = message?.jsonData?.aiContent || ''
|
|
|
+ let tx = ''
|
|
|
+ if (aiContent) {
|
|
|
+ tx = '&aiContent=' + aiContent
|
|
|
+ webTx.value = tx
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ webTx.value = tx
|
|
|
+ }
|
|
|
create_app_loading.value = true
|
|
|
try {
|
|
|
const elements = currentSlide.value?.elements || []
|
|
|
@@ -1026,6 +1058,7 @@ onMounted(() => {
|
|
|
getAgentModel(agentid2.value)
|
|
|
getAgentModel(agentid3.value)
|
|
|
getAgentModel(agentid4.value)
|
|
|
+ getAgentModel(agentid5.value)
|
|
|
})
|
|
|
</script>
|
|
|
|