|
|
@@ -76,6 +76,7 @@
|
|
|
:user_input_form="conversation_params.user_input_form"
|
|
|
:chat_history="chat_history"
|
|
|
@initModel="initModel"
|
|
|
+ @toAutoSubmit="autoSubmit"
|
|
|
ref="dialog_input_top"
|
|
|
/>
|
|
|
</template>
|
|
|
@@ -1094,6 +1095,15 @@ const initModel = (val) => {
|
|
|
};
|
|
|
|
|
|
const target_action_config = ref({});
|
|
|
+
|
|
|
+/**
|
|
|
+ * 智能体中心对话,如果是workflow类型,点击动态表单中的开始对话,直接继续对话,省略主动发送操作
|
|
|
+ * */
|
|
|
+const autoSubmit = () => {
|
|
|
+ // handleInputSubmit()
|
|
|
+ // console.log('自动执行');
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* 初始化sse相关方法
|
|
|
* */
|
|
|
@@ -1109,6 +1119,7 @@ const { startStream, stopStream } = useFetchEventSource();
|
|
|
*/
|
|
|
|
|
|
const handleInputSubmit = async (options) => {
|
|
|
+ console.log(options, 1111);
|
|
|
show_welcome.value = false;
|
|
|
if (!chat_display_list.value.length) {
|
|
|
pushInitAnswer();
|
|
|
@@ -1261,18 +1272,37 @@ const handleInputSubmit = async (options) => {
|
|
|
const chat_id = chat_round_id.value;
|
|
|
const menu_id = current_menu_id.value;
|
|
|
for (const key in files_obj) {
|
|
|
- const upload_files = files_obj[key].map((item) => item.file);
|
|
|
+ let upload_files;
|
|
|
+ if (Array.isArray(files_obj[key])) {
|
|
|
+ upload_files = files_obj[key].map((item) => item.file);
|
|
|
+ } else {
|
|
|
+ upload_files = [files_obj[key]].map((item) => item.file);
|
|
|
+ }
|
|
|
+
|
|
|
const uploadResult = await uploadFileByAgentInfo(agent_id, chat_id, upload_files, menu_id);
|
|
|
if (uploadResult && uploadResult.length) {
|
|
|
- files_obj[key] = files_obj[key].map((file) => {
|
|
|
- const uploadedFile = uploadResult.find((uploaded) => uploaded.name === file.name);
|
|
|
- // 如果找到了匹配的文件,则回填 id
|
|
|
- if (uploadedFile) {
|
|
|
- file.upload_file_id = uploadedFile.id;
|
|
|
- file.url = '';
|
|
|
- }
|
|
|
- return file;
|
|
|
- });
|
|
|
+ if (Array.isArray(files_obj[key])) {
|
|
|
+ files_obj[key] = files_obj[key].map((file) => {
|
|
|
+ const uploadedFile = uploadResult.find((uploaded) => uploaded.name === file.name);
|
|
|
+ // 如果找到了匹配的文件,则回填 id
|
|
|
+ if (uploadedFile) {
|
|
|
+ file.upload_file_id = uploadedFile.id;
|
|
|
+ file.url = '';
|
|
|
+ }
|
|
|
+ return file;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ files_obj[key] = [files_obj[key]].map((file) => {
|
|
|
+ const uploadedFile = uploadResult.find((uploaded) => uploaded.name === file.name);
|
|
|
+ // 如果找到了匹配的文件,则回填 id
|
|
|
+ if (uploadedFile) {
|
|
|
+ file.upload_file_id = uploadedFile.id;
|
|
|
+ file.url = '';
|
|
|
+ }
|
|
|
+ return file;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 判断如果对应的文件是单文件上传,则显示为对象
|
|
|
if (files_obj[key].some((item) => item.limit_1)) {
|
|
|
files_obj[key] = files_obj[key][0];
|