From 985aa40f5a3d15d4f196297697430d877b473e04 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 06 一月 2025 13:53:48 +0800 Subject: [PATCH] 时间输入 --- src/components/chat/chatComponents/multiChat/index.ts | 2 ++ src/components/chat/chatComponents/multiChat/TimeRange.vue | 40 ++++++++++++++++++++++++++++++++++++++++ src/components/chat/model/types.ts | 1 + src/components/chat/assistant/index.vue | 13 ++++++++++--- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/components/chat/assistant/index.vue b/src/components/chat/assistant/index.vue index 3bc4318..f410783 100644 --- a/src/components/chat/assistant/index.vue +++ b/src/components/chat/assistant/index.vue @@ -91,13 +91,12 @@ v-for="(multiChatItem, multiChatIndex) in subItem.subStep" > <component - :order="`${stepIndex + 1}-${multiChatIndex + 1}`" :item="multiChatItem" :is="multiChatTypeMapCom[multiChatItem.type]" + @change="multiChatChange" :disabled="!(stepIndex + 1 === msg?.stepGroup?.[index].value.length && isTalking && isLast)" /> - </div> </div> </template> @@ -110,7 +109,6 @@ 涓轰簡瑙e喅杩欎釜闂锛岀瓑鍒� msg.historyId 瀛樺湪鏃讹紝鍐嶆覆鏌� recordSetTable --> <component - v-if="msg.content?.values?.[index] && msg.historyId" :reportIndex="index" :conclusion="msg.content.values[index].conclusion" @@ -235,6 +233,7 @@ import { multiChatTypeMapCom } from '/@/components/chat/chatComponents/multiChat'; import { isSharePage } from '/@/stores/chatRoom'; import { ErrorCode } from '/@/utils/request'; +import { question_stream_reply } from '/@/api/ai/chat'; const props = defineProps({ /** @description 褰撳墠娑堟伅 */ @@ -293,6 +292,14 @@ emit('shareMsg', item); }; //#endregion + +const multiChatChange = async (replyId: string, val: any) => { + const res = await question_stream_reply({ + start_time: val.start_time, + end_time: val.end_time, + reply_id: replyId, + }); +}; </script> <style scoped lang="scss"> pre { diff --git a/src/components/chat/chatComponents/multiChat/TimeRange.vue b/src/components/chat/chatComponents/multiChat/TimeRange.vue new file mode 100644 index 0000000..d346fd7 --- /dev/null +++ b/src/components/chat/chatComponents/multiChat/TimeRange.vue @@ -0,0 +1,40 @@ +<template> + <div class="flex flex-col gap-1"> + <span class="text-gray-600 font-normal">{{ `${order} ${item?.data?.title}` }}</span> + <TimeRange :disabled="disabled" @change="timeRangeChange" ></TimeRange> + </div> +</template> +<script lang="ts" setup> +import { definePropType } from 'element-plus/es/utils'; +import type { PropType } from 'vue'; +import TimeRange from '../summaryCom/components/recordSet/components/TimeRange.vue'; + +const props = defineProps({ + order: { + type: String, + default: '', + }, + item: { + type: Object as PropType<any>, + }, + disabled: { + type: Boolean, + default: false, + }, +}); +const emit = defineEmits(['change']); +// const timeRangeValue = defineModel({ +// type: definePropType<[string, string]>(Array), +// }); +const timeRangeChange = (val: [string, string]) => { + if (props.disabled) return; + emit( + 'change', + props.item?.data?.reply_id, + { + start_time: val[0], + end_time: val[1], + } + ); +}; +</script> diff --git a/src/components/chat/chatComponents/multiChat/index.ts b/src/components/chat/chatComponents/multiChat/index.ts index 9cbc0e1..4d5e102 100644 --- a/src/components/chat/chatComponents/multiChat/index.ts +++ b/src/components/chat/chatComponents/multiChat/index.ts @@ -1,8 +1,10 @@ import { MultiChatType } from '../../model/types'; import Select from './Select.vue'; import InputSelect from './InputSelect.vue'; +import TimeRange from './TimeRange.vue'; export const multiChatTypeMapCom = { [MultiChatType.Select]: Select, [MultiChatType.InputSelect]: InputSelect, + [MultiChatType.TimeRange]: TimeRange, }; \ No newline at end of file diff --git a/src/components/chat/model/types.ts b/src/components/chat/model/types.ts index a1e8e34..6c7afb4 100644 --- a/src/components/chat/model/types.ts +++ b/src/components/chat/model/types.ts @@ -87,6 +87,7 @@ InputSelect = 'input-select', Summary = 'summary', Result = 'result', + TimeRange = 'time_range', } type SubStep = { data: any; -- Gitblit v1.9.3