|
|
@@ -31,6 +31,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 大模型状态提示:非阻断,不打断上传;用户点「智能清洗」时才用弹框引导 -->
|
|
|
+ <div v-if="llmBannerVisible" class="llm-banner">
|
|
|
+ <ExclamationCircleOutlined class="llm-banner__icon" />
|
|
|
+ <div class="llm-banner__body">
|
|
|
+ <span class="llm-banner__title">大模型未就绪</span>
|
|
|
+ <span class="llm-banner__desc">{{ llmCheckMessage }}</span>
|
|
|
+ <span class="llm-banner__desc">未配置大模型将无法使用 AI 大模型进行数据清洗。</span>
|
|
|
+ </div>
|
|
|
+ <div class="llm-banner__actions">
|
|
|
+ <Button size="small" type="primary" @click="handleConfigureLlm">配置模型</Button>
|
|
|
+ <Button size="small" type="text" @click="dismissLlmBanner">关闭</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="upload-layout">
|
|
|
<aside class="left-panel">
|
|
|
<div class="upload-picker">
|
|
|
@@ -179,14 +193,34 @@
|
|
|
</section>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 大模型检查引导:进入页面校验一次配置与连通性,仅提示、不阻断 -->
|
|
|
+ <BasicModal
|
|
|
+ @register="registerLlmGuideModal"
|
|
|
+ title="大模型未就绪"
|
|
|
+ :width="560"
|
|
|
+ :centered="true"
|
|
|
+ okText="配置模型"
|
|
|
+ cancelText="关闭提示"
|
|
|
+ @ok="handleConfigureLlm"
|
|
|
+ >
|
|
|
+ <div class="llm-check">
|
|
|
+ <p class="llm-check__message">{{ llmCheckMessage }}</p>
|
|
|
+ <p class="llm-check__hint">未配置大模型,将无法使用 AI 大模型进行数据清洗。</p>
|
|
|
+ <p class="llm-check__hint">可先完成配置,保存时会自动检测连通性;也可以关闭提示后继续使用其他功能。</p>
|
|
|
+ </div>
|
|
|
+ </BasicModal>
|
|
|
+
|
|
|
+ <LlmSettingModal @register="registerLlmSettingModal" @success="handleLlmConfigured" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="ViewsDataUpload">
|
|
|
import { computed, h, onMounted, ref } from 'vue';
|
|
|
import { onBeforeRouteLeave } from 'vue-router';
|
|
|
- import { CloseOutlined, LeftOutlined } from '@ant-design/icons-vue';
|
|
|
+ import { CloseOutlined, ExclamationCircleOutlined, LeftOutlined } from '@ant-design/icons-vue';
|
|
|
import { Button, Modal, Table, Tooltip, type TableColumnsType } from 'ant-design-vue';
|
|
|
+ import { BasicModal, useModal } from '@/core/components/Modal';
|
|
|
import { useDesign } from '@/core/hooks/web/useDesign';
|
|
|
import { useGo, useQuery } from '@/core/hooks/web/usePage';
|
|
|
import { PageEnum } from '@/core/enums/pageEnum';
|
|
|
@@ -196,6 +230,8 @@
|
|
|
import { clearUploadBatch, deletedFileList, preFileUpload, smartClean } from '@/case/api/govern/governApi';
|
|
|
import { FileStatusEnum } from '@/case/types/enum';
|
|
|
import { isDesktopDialogAvailable, pickDirectories } from '@/core/utils/desktop/pathPicker';
|
|
|
+ import { getLlmConfig, testLlmConfig } from '@/core/layouts/default/setting/api';
|
|
|
+ import LlmSettingModal from '@/core/layouts/default/setting/components/LlmSettingModal.vue';
|
|
|
import CaseFlowTopBar from './components/CaseFlowTopBar.vue';
|
|
|
import { resetImportProgressSession } from './importProgressSession';
|
|
|
import type { FileInfo } from '@/types/api';
|
|
|
@@ -210,6 +246,19 @@
|
|
|
const RECLEAN_CONTEXT_STORAGE_KEY = 'case_clean_reclean_context';
|
|
|
const CASE_DATA_REFRESH_EVENT = 'case-data:refresh';
|
|
|
|
|
|
+ /** 大模型配置弹框(项目 BasicModal,直接引入避免异步加载前注册不到) */
|
|
|
+ const [registerLlmSettingModal, { openModal: openLlmSettingModal }] = useModal();
|
|
|
+ /** 大模型检查引导弹框(项目 BasicModal):仅在点「智能清洗」且模型未就绪时使用 */
|
|
|
+ const [registerLlmGuideModal, { openModal: openLlmGuideModal, closeModal: closeLlmGuideModal }] = useModal();
|
|
|
+ const llmCheckMessage = ref('');
|
|
|
+ /** 大模型是否可用;入口检查结果只驱动页面提示条,不弹窗打断 */
|
|
|
+ const llmReady = ref(false);
|
|
|
+ const llmBannerVisible = ref(false);
|
|
|
+ /** 用户手动关闭提示条后,本次停留不再自动弹出(点智能清洗仍会校验) */
|
|
|
+ const llmBannerDismissed = ref(false);
|
|
|
+ /** 复用同一次检查,避免入口与「智能清洗」各发一次模型请求 */
|
|
|
+ let llmCheckPromise: Promise<boolean> | null = null;
|
|
|
+
|
|
|
type UploadMode = 'single' | 'folder';
|
|
|
|
|
|
/** 进入上传页即生成批次 id,本页所有文件统一使用该批次(Long 型,上限约 1.7e18,安全) */
|
|
|
@@ -619,8 +668,72 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查大模型:是否已配置、能否正常连接。
|
|
|
+ *
|
|
|
+ * <p>入口检查只更新页面内的提示条,不弹窗、不阻断上传;
|
|
|
+ * 只有用户点「智能清洗」(真正依赖模型的操作)时才用弹框引导。
|
|
|
+ */
|
|
|
+ const showLlmBanner = (message: string) => {
|
|
|
+ llmCheckMessage.value = message;
|
|
|
+ if (!llmBannerDismissed.value) {
|
|
|
+ llmBannerVisible.value = true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const dismissLlmBanner = () => {
|
|
|
+ llmBannerDismissed.value = true;
|
|
|
+ llmBannerVisible.value = false;
|
|
|
+ };
|
|
|
+
|
|
|
+ const runLlmCheck = async (): Promise<boolean> => {
|
|
|
+ try {
|
|
|
+ const config = await getLlmConfig();
|
|
|
+ if (!config?.baseUrl?.trim() || !config?.model?.trim()) {
|
|
|
+ llmReady.value = false;
|
|
|
+ showLlmBanner('尚未配置大模型服务。');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const result = await testLlmConfig();
|
|
|
+ if (!result?.connected) {
|
|
|
+ llmReady.value = false;
|
|
|
+ showLlmBanner(result?.message || '大模型连接失败,请检查服务地址、模型名称与网络配置。');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ llmReady.value = true;
|
|
|
+ llmBannerVisible.value = false;
|
|
|
+ return true;
|
|
|
+ } catch (error: any) {
|
|
|
+ llmReady.value = false;
|
|
|
+ showLlmBanner(error?.message || '大模型状态检查失败,请检查网络或服务是否可用。');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ /** 复用同一次检查:入口与「智能清洗」不会各发一次模型请求 */
|
|
|
+ const ensureLlmReady = (): Promise<boolean> => {
|
|
|
+ if (!llmCheckPromise) {
|
|
|
+ llmCheckPromise = runLlmCheck();
|
|
|
+ }
|
|
|
+ return llmCheckPromise;
|
|
|
+ };
|
|
|
+
|
|
|
+ /** 大模型保存且连接通过:解除限制并收起提示条 */
|
|
|
+ const handleLlmConfigured = () => {
|
|
|
+ llmReady.value = true;
|
|
|
+ llmBannerVisible.value = false;
|
|
|
+ llmCheckPromise = Promise.resolve(true);
|
|
|
+ };
|
|
|
+
|
|
|
+ /** 打开大模型设置弹框(提示条与引导弹框共用),保存时由设置弹框自行检测连通性 */
|
|
|
+ const handleConfigureLlm = () => {
|
|
|
+ closeLlmGuideModal();
|
|
|
+ openLlmSettingModal(true);
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
restoreParsedResults();
|
|
|
+ void ensureLlmReady();
|
|
|
});
|
|
|
|
|
|
const isOwnBatchStorage = () => {
|
|
|
@@ -937,6 +1050,14 @@
|
|
|
if (!hasCleanableSheet.value || smartCleaning.value) return;
|
|
|
smartCleaning.value = true;
|
|
|
try {
|
|
|
+ // 智能清洗依赖大模型:入口提示条不打断上传,真正点清洗时才校验并弹框引导
|
|
|
+ if (!llmReady.value) {
|
|
|
+ const ready = await ensureLlmReady();
|
|
|
+ if (!ready) {
|
|
|
+ openLlmGuideModal(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
const fileInfos = allFileInfos.value as unknown as FileInfo[];
|
|
|
persistFileInfos(allFileInfos.value);
|
|
|
const res = await smartClean({ fileInfos, reClean: 0 });
|
|
|
@@ -1736,4 +1857,71 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .llm-check {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 8px;
|
|
|
+
|
|
|
+ &__message {
|
|
|
+ margin: 0;
|
|
|
+ color: #374151;
|
|
|
+ font-size: 13px;
|
|
|
+ line-height: 1.7;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__hint {
|
|
|
+ margin: 0;
|
|
|
+ color: #6b7280;
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 1.7;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 大模型状态提示条:页面内非阻断提示,避免上传途中突然弹窗 */
|
|
|
+ .llm-banner {
|
|
|
+ display: flex;
|
|
|
+ flex: 0 0 auto;
|
|
|
+ align-items: center;
|
|
|
+ gap: 10px;
|
|
|
+ padding: 8px 12px;
|
|
|
+ color: #92400e;
|
|
|
+ background: #fffbeb;
|
|
|
+ border: 1px solid #fde68a;
|
|
|
+ border-radius: 10px;
|
|
|
+
|
|
|
+ &__icon {
|
|
|
+ flex: 0 0 auto;
|
|
|
+ font-size: 15px;
|
|
|
+ color: #d97706;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__body {
|
|
|
+ display: flex;
|
|
|
+ flex: 1 1 auto;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: baseline;
|
|
|
+ gap: 2px 10px;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__title {
|
|
|
+ flex: 0 0 auto;
|
|
|
+ font-size: 13px;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__desc {
|
|
|
+ color: #b45309;
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 1.6;
|
|
|
+ }
|
|
|
+
|
|
|
+ &__actions {
|
|
|
+ display: flex;
|
|
|
+ flex: 0 0 auto;
|
|
|
+ align-items: center;
|
|
|
+ gap: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|