11<template >
22 <div ref =" aiChatRef" class =" ai-chat" :class =" type" >
3- <UserForm
4- v-model:api_form_data = " api_form_data "
5- v-model:form_data = " form_data "
6- :application = " applicationDetails "
7- :type = " type "
8- ref = " userFormRef "
9- ></ UserForm >
10- < el-scrollbar ref = " scrollDiv " @scroll = " handleScrollTop " >
11- < div ref = " dialogScrollbar " class = " ai-chat__content p-24 " >
12- < PrologueContent
13- :type = " type "
14- :application = " applicationDetails "
15- :available = " available "
16- :send-message = " sendMessage "
17- ></ PrologueContent >
18-
19- < template v-for = " ( item , index ) in chatList " : key = " index " >
20- <!-- 问题 -- >
21- <QuestionContent
3+ <div
4+ v-show = " (isUserInput && firsUserInput) || showUserInput "
5+ :class = " firsUserInput ? 'firstUserInput' : 'popperUserInput' "
6+ >
7+ < UserForm
8+ v-model:api_form_data = " api_form_data "
9+ v-model:form_data = " form_data "
10+ :application = " applicationDetails "
11+ :type = " type "
12+ :first = " firsUserInput "
13+ @confirm = " UserFormConfirm "
14+ @cancel = " () => (showUserInput = false) "
15+ ref = " userFormRef "
16+ ></ UserForm >
17+ </ div >
18+ < template v-if = " ! firsUserInput " >
19+ < el-scrollbar ref = " scrollDiv " @scroll = " handleScrollTop " >
20+ < div ref = " dialogScrollbar " class = " ai-chat__content p-24 " >
21+ <PrologueContent
2222 :type =" type"
2323 :application =" applicationDetails"
24- :chat-record =" item"
25- ></QuestionContent >
26- <!-- 回答 -->
27- <AnswerContent
28- :application =" applicationDetails"
29- :loading =" loading"
30- v-model:chat-record =" chatList[index]"
31- :type =" type"
24+ :available =" available"
3225 :send-message =" sendMessage"
33- :chat-management =" ChatManagement"
34- ></AnswerContent >
26+ ></PrologueContent >
27+
28+ <template v-for =" (item , index ) in chatList " :key =" index " >
29+ <!-- 问题 -->
30+ <QuestionContent
31+ :type =" type"
32+ :application =" applicationDetails"
33+ :chat-record =" item"
34+ ></QuestionContent >
35+ <!-- 回答 -->
36+ <AnswerContent
37+ :application =" applicationDetails"
38+ :loading =" loading"
39+ v-model:chat-record =" chatList[index]"
40+ :type =" type"
41+ :send-message =" sendMessage"
42+ :chat-management =" ChatManagement"
43+ ></AnswerContent >
44+ </template >
45+ </div >
46+ </el-scrollbar >
47+
48+ <ChatInputOperate
49+ :app-id =" appId"
50+ :application-details =" applicationDetails"
51+ :is-mobile =" isMobile"
52+ :type =" type"
53+ :send-message =" sendMessage"
54+ :open-chat-id =" openChatId"
55+ :chat-management =" ChatManagement"
56+ v-model:chat-id =" chartOpenId"
57+ v-model:loading =" loading"
58+ v-if =" type !== 'log'"
59+ >
60+ <template #operateBefore >
61+ <div class =" flex-between" >
62+ <slot name =" operateBefore" >
63+ <span ></span >
64+ </slot >
65+ <el-button class =" user-input-button mb-8" type =" primary" text @click =" toggleUserInput" >
66+ <AppIcon iconName =" app-user-input" ></AppIcon >
67+ </el-button >
68+ </div >
3569 </template >
36- </div >
37- </el-scrollbar >
70+ </ChatInputOperate >
3871
39- <ChatInputOperate
40- :app-id =" appId"
41- :application-details =" applicationDetails"
42- :is-mobile =" isMobile"
43- :type =" type"
44- :send-message =" sendMessage"
45- :open-chat-id =" openChatId"
46- :chat-management =" ChatManagement"
47- v-model:chat-id =" chartOpenId"
48- v-model:loading =" loading"
49- v-if =" type !== 'log'"
50- >
51- <template #operateBefore > <slot name =" operateBefore" /> </template >
52- </ChatInputOperate >
53- <Control ></Control >
72+ <Control ></Control >
73+ </template >
5474 </div >
5575</template >
5676<script setup lang="ts">
@@ -62,7 +82,7 @@ import { ChatManagement, type chatType } from '@/api/type/application'
6282import { randomId } from ' @/utils/utils'
6383import useStore from ' @/stores'
6484import { isWorkFlow } from ' @/utils/application'
65- import { debounce } from ' lodash'
85+ import { debounce , first } from ' lodash'
6686import AnswerContent from ' @/components/ai-chat/component/answer-content/index.vue'
6787import QuestionContent from ' @/components/ai-chat/component/question-content/index.vue'
6888import ChatInputOperate from ' @/components/ai-chat/component/chat-input-operate/index.vue'
@@ -106,13 +126,25 @@ const chatList = ref<any[]>([])
106126const form_data = ref <any >({})
107127const api_form_data = ref <any >({})
108128const userFormRef = ref <InstanceType <typeof UserForm >>()
129+ // 用户输入
130+ const firsUserInput = ref (true )
131+ const showUserInput = ref (false )
132+
133+ const isUserInput = computed (
134+ () =>
135+ props .applicationDetails .work_flow ?.nodes ?.filter ((v : any ) => v .id === ' base-node' )[0 ]
136+ .properties .user_input_field_list .length > 0
137+ )
138+
109139watch (
110140 () => props .chatId ,
111141 (val ) => {
112142 if (val && val !== ' new' ) {
113143 chartOpenId .value = val
144+ firsUserInput .value = false
114145 } else {
115146 chartOpenId .value = ' '
147+ firsUserInput .value = true
116148 }
117149 },
118150 { deep: true }
@@ -136,6 +168,15 @@ watch(
136168 }
137169)
138170
171+ const toggleUserInput = () => {
172+ showUserInput .value = ! showUserInput .value
173+ }
174+
175+ function UserFormConfirm() {
176+ firsUserInput .value = false
177+ showUserInput .value = false
178+ }
179+
139180function sendMessage(val : string , other_params_data ? : any , chat ? : chatType ) {
140181 if (! userFormRef .value ?.checkInputParam ()) {
141182 return
@@ -467,4 +508,18 @@ defineExpose({
467508 </script >
468509<style lang="scss" scoped>
469510@import ' ./index.scss' ;
511+ .firstUserInput {
512+ height : 100% ;
513+ display : flex ;
514+ justify-content : center ;
515+ align-items : center ;
516+ }
517+ .popperUserInput {
518+ position : absolute ;
519+ z-index : 999 ;
520+ right : 50px ;
521+ bottom : 80px ;
522+ width : calc (100% - 50px );
523+ max-width : 400px ;
524+ }
470525 </style >
0 commit comments