已开启
feat: Form data not cleared #468
yang_rongju创建于 6月17日
feat: Form data not cleared #468
已开启
共 4 个文件变更+32-7
| @@ -216,7 +216,7 @@ export const useHistorySessionStore = defineStore( | |||
| 216 | /** | 216 | /** |
| 217 | * 创建一个新的会话 | 217 | * 创建一个新的会话 |
| 218 | */ | 218 | */ |
| 219 | - const generateSession = async (isDebug): Promise<void> => { | 219 | + const generateSession = async (isDebug?): Promise<void> => { |
| 220 | const appId = user_selected_app.value ?? ''; | 220 | const appId = user_selected_app.value ?? ''; |
| 221 | const [_, res] = await api.createSession({appId, debug: isDebug}); | 221 | const [_, res] = await api.createSession({appId, debug: isDebug}); |
| 222 | if (!_ && res) { | 222 | if (!_ && res) { |
| @@ -71,13 +71,18 @@ async function onConfirm(formEl: FormInstance | undefined) { | |||
| 71 | emits('update:visible', false); | 71 | emits('update:visible', false); |
| 72 | }); | 72 | }); |
| 73 | } | 73 | } |
| 74 | + | ||
| 75 | +function handleClose() { | ||
| 76 | + formRef.value?.resetFields(); | ||
| 77 | + emits('update:visible', false); | ||
| 78 | +} | ||
| 74 | </script> | 79 | </script> |
| 75 | <template> | 80 | <template> |
| 76 | <div class="add-model-dialog"> | 81 | <div class="add-model-dialog"> |
| 77 | <el-dialog | 82 | <el-dialog |
| 78 | :model-value="visible" | 83 | :model-value="visible" |
| 79 | :title="title" | 84 | :title="title" |
| 80 | - @close="emits('update:visible', false)" | 85 | + @close="handleClose" |
| 81 | destroy-on-close | 86 | destroy-on-close |
| 82 | > | 87 | > |
| 83 | <el-form | 88 | <el-form |
| @@ -108,7 +108,6 @@ watch( | |||
| 108 | bottom: 24px; | 108 | bottom: 24px; |
| 109 | left: 24px; | 109 | left: 24px; |
| 110 | z-index: 999; | 110 | z-index: 999; |
| 111 | - display: flex; | ||
| 112 | padding: 12px 16px; | 111 | padding: 12px 16px; |
| 113 | border-radius: 8px; | 112 | border-radius: 8px; |
| 114 | box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.1); | 113 | box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.1); |
| @@ -59,9 +59,8 @@ const emits = defineEmits<{ | |||
| 59 | const route = useRoute(); | 59 | const route = useRoute(); |
| 60 | const { language } = storeToRefs(useLangStore()); | 60 | const { language } = storeToRefs(useLangStore()); |
| 61 | const { theme } = storeToRefs(useChangeThemeStore()); | 61 | const { theme } = storeToRefs(useChangeThemeStore()); |
| 62 | -const { currentSelectedSession, historySession } = storeToRefs( | 62 | + const { currentSelectedSession, historySession, user_selected_app } = |
| 63 | - useHistorySessionStore(), | 63 | + storeToRefs(useHistorySessionStore()); |
| 64 | -); | ||
| 65 | 64 | ||
| 66 | const { generateSession, getHistorySession } = useHistorySessionStore(); | 65 | const { generateSession, getHistorySession } = useHistorySessionStore(); |
| 67 | 66 | ||
| @@ -166,6 +165,25 @@ const openShowFileSource = (fileList: Array<any>) => { | |||
| 166 | curFileList.value = fileList; | 165 | curFileList.value = fileList; |
| 167 | }; | 166 | }; |
| 168 | 167 | ||
| 168 | +/** | ||
| 169 | +* 举报功能 | ||
| 170 | +*/ | ||
| 171 | +const handleReport = async ( | ||
| 172 | + qaRecordId: string, | ||
| 173 | + reason_type: string, | ||
| 174 | + reason: string, | ||
| 175 | +) => { | ||
| 176 | + const params = { | ||
| 177 | + record_id: qaRecordId, | ||
| 178 | + reason_type, | ||
| 179 | + reason, | ||
| 180 | + }; | ||
| 181 | + const [, res] = await api.report(params); | ||
| 182 | + if (res) { | ||
| 183 | + ElMessage.success(t('feedback.feedbackSuccesful')); | ||
| 184 | + } | ||
| 185 | +}; | ||
| 186 | + | ||
| 169 | /** | 187 | /** |
| 170 | * 发送消息 | 188 | * 发送消息 |
| 171 | */ | 189 | */ |
| @@ -330,7 +348,10 @@ watch( | |||
| 330 | :flowdata="getItem(item, 'flowdata')" | 348 | :flowdata="getItem(item, 'flowdata')" |
| 331 | :created-at="item.createdAt" | 349 | :created-at="item.createdAt" |
| 332 | :current-selected="item.currentInd" | 350 | :current-selected="item.currentInd" |
| 333 | - :need-regernerate="item.cid === conversationList.slice(-1)[0].cid" | 351 | + :need-regernerate=" |
| 352 | + conversationList.length > 0 && | ||
| 353 | + item.cid === conversationList[conversationList.length - 1].cid | ||
| 354 | + " | ||
| 334 | :user-selected-app="user_selected_app" | 355 | :user-selected-app="user_selected_app" |
| 335 | :search_suggestions="getItem(item, 'search_suggestions')" | 356 | :search_suggestions="getItem(item, 'search_suggestions')" |
| 336 | :paramsList="getItem(item, 'paramsList')" | 357 | :paramsList="getItem(item, 'paramsList')" |