diff --git a/AGENTS.md b/AGENTS.md index 1cf7661c..33d840c1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,7 +30,7 @@ deploy/ # 部署 TUI(原 ecom-deploy),流程见 deploy/MANU - 只允许 pnpm;先 `pnpm install`(postinstall 会跑 `stub` 构建) - 开发 `pnpm dev:antd`,构建 `pnpm build:antd`;类型检查 `pnpm -F @vben/web-antd typecheck` -- lefthook 钩子会对暂存文件自动 prettier/eslint/stylelint `--fix`,commitlint 强制 conventional commit,不要绕过 +- lefthook 钩子会对暂存文件跑 `pnpm lint`(oxfmt/oxlint 等)与 `check:type`,commitlint 强制 conventional commit,不要绕过 - 代码内 `#/` 别名 = `src/` - **web-antd 视图里不要用 `` 整块包住可滚动列表**(ant-spin-container 破坏滚动链);滚动依赖 `flex-1 min-h-0 overflow-y-auto`,加载态拆细(详见 `.cursor/rules/antd-spin-scrollable-layout.mdc`) - 智能助手页:`views/agent/chat`;开发代理 `/api/agent` → `localhost:8200`(见 `vite.config.mts`) diff --git a/apps/web/.npmrc b/apps/web/.npmrc index 21147aff..7549542d 100644 --- a/apps/web/.npmrc +++ b/apps/web/.npmrc @@ -1,13 +1 @@ -registry = "https://registry.npmmirror.com" -public-hoist-pattern[]=lefthook -public-hoist-pattern[]=eslint -public-hoist-pattern[]=prettier -public-hoist-pattern[]=prettier-plugin-tailwindcss -public-hoist-pattern[]=stylelint -public-hoist-pattern[]=*postcss* -public-hoist-pattern[]=@commitlint/* -public-hoist-pattern[]=czg - -strict-peer-dependencies=false -auto-install-peers=true -dedupe-peer-dependents=true +registry=https://registry.npmmirror.com diff --git a/apps/web/apps/web-antd/index.html b/apps/web/apps/web-antd/index.html index eb6864b8..7cf6a6b6 100644 --- a/apps/web/apps/web-antd/index.html +++ b/apps/web/apps/web-antd/index.html @@ -12,7 +12,7 @@ content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" /> - <%= VITE_APP_TITLE %> + %VITE_APP_TITLE% diff --git a/apps/web/apps/web-antd/package.json b/apps/web/apps/web-antd/package.json index 2ffd4f25..b2643b71 100644 --- a/apps/web/apps/web-antd/package.json +++ b/apps/web/apps/web-antd/package.json @@ -1,6 +1,6 @@ { "name": "@vben/web-antd", - "version": "5.5.9", + "version": "5.7.0", "homepage": "https://vben.pro", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "repository": { @@ -26,6 +26,7 @@ "#/*": "./src/*" }, "dependencies": { + "@ant-design/icons-vue": "^7.0.1", "@tdesign-vue-next/chat": "^0.7.0", "@vben/access": "workspace:*", "@vben/common-ui": "workspace:*", diff --git a/apps/web/apps/web-antd/postcss.config.mjs b/apps/web/apps/web-antd/postcss.config.mjs deleted file mode 100644 index 3d807045..00000000 --- a/apps/web/apps/web-antd/postcss.config.mjs +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@vben/tailwind-config/postcss'; diff --git a/apps/web/apps/web-antd/src/api/agent/apis.ts b/apps/web/apps/web-antd/src/api/agent/apis.ts index c7a26dcd..40691ea7 100644 --- a/apps/web/apps/web-antd/src/api/agent/apis.ts +++ b/apps/web/apps/web-antd/src/api/agent/apis.ts @@ -303,18 +303,22 @@ export function streamAgentChat(options: { const parsed = JSON.parse(data) as { toolCallId?: string; name?: string; - args?: Record; + args?: unknown; label?: string; }; if (parsed.name) { let toolArgs: Record = {}; const rawArgs = parsed.args; - if (rawArgs && typeof rawArgs === 'object') { + if (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs)) { toolArgs = rawArgs as Record; } else if (typeof rawArgs === 'string' && rawArgs.trim()) { try { const parsedArgs = JSON.parse(rawArgs) as unknown; - if (parsedArgs && typeof parsedArgs === 'object') { + if ( + parsedArgs && + typeof parsedArgs === 'object' && + !Array.isArray(parsedArgs) + ) { toolArgs = parsedArgs as Record; } } catch { diff --git a/apps/web/apps/web-antd/src/components/SwitchAccountModal.vue b/apps/web/apps/web-antd/src/components/SwitchAccountModal.vue index 3a03edb6..9b4ca680 100644 --- a/apps/web/apps/web-antd/src/components/SwitchAccountModal.vue +++ b/apps/web/apps/web-antd/src/components/SwitchAccountModal.vue @@ -18,7 +18,6 @@ import { getCompanyPageApi } from '#/api/company'; import { getUserPageApi } from '#/api/sys/user'; // 响应式数据 -const formRef = ref(); const formData = ref({ companyId: undefined as number | undefined, userId: undefined as number | undefined, @@ -375,7 +374,9 @@ defineExpose({
手机号码: {{ selectedUser.phone || '-' }}
-
角色: {{ selectedUser.role }}
+
+ 角色: {{ selectedUser.isSuper === 1 ? '超管' : '普通' }} +
状态: {{ selectedUser.status === 1 ? '正常' : '禁用' }}
diff --git a/apps/web/apps/web-antd/src/layouts/basic.vue b/apps/web/apps/web-antd/src/layouts/basic.vue index 2150dafc..8a9bf33e 100644 --- a/apps/web/apps/web-antd/src/layouts/basic.vue +++ b/apps/web/apps/web-antd/src/layouts/basic.vue @@ -27,6 +27,7 @@ const { hasPermission } = usePermission(); const notifications = ref([ { + id: 1, avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB', date: '3小时前', isRead: true, @@ -34,6 +35,7 @@ const notifications = ref([ title: '收到了 14 份新周报', }, { + id: 2, avatar: 'https://avatar.vercel.sh/1', date: '刚刚', isRead: false, @@ -41,6 +43,7 @@ const notifications = ref([ title: '朱偏右 回复了你', }, { + id: 3, avatar: 'https://avatar.vercel.sh/1', date: '2024-01-01', isRead: false, @@ -48,6 +51,7 @@ const notifications = ref([ title: '曲丽丽 评论了你', }, { + id: 4, avatar: 'https://avatar.vercel.sh/satori', date: '1天前', isRead: false, diff --git a/apps/web/apps/web-antd/src/preferences.ts b/apps/web/apps/web-antd/src/preferences.ts index 8eca923b..d3548737 100644 --- a/apps/web/apps/web-antd/src/preferences.ts +++ b/apps/web/apps/web-antd/src/preferences.ts @@ -27,9 +27,7 @@ export const overridesPreferences = defineOverridesPreferences({ navigation: { accordion: false, // 关闭手风琴模式,允许多个菜单同时展开 }, - theme: { - mode: 'light', - }, + // 不要在此写死 theme.mode:用户切换深/浅色需持久化到缓存 transition: { enable: false, loading: false, diff --git a/apps/web/apps/web-antd/src/router/guard.ts b/apps/web/apps/web-antd/src/router/guard.ts index bde896dd..ae765580 100644 --- a/apps/web/apps/web-antd/src/router/guard.ts +++ b/apps/web/apps/web-antd/src/router/guard.ts @@ -132,13 +132,22 @@ function setupAccessGuard(router: Router) { userInfo.homePath || preferences.app.defaultHomePath; } + // 动态 addRoute 后必须发起一次新导航。 + // 若期间有路由增删导致当前导航被取消,return true 只会继续已取消的导航, + // 表现即停在登录页 +「加载菜单中」(生产构建更易复现,开发环境不一定)。 + // 不要展开 resolve() 的 matched,避免沿用生成路由前的 404 匹配记录。 const resolved = router.resolve(redirectPath); - // 已在目标页则放行;不要展开 resolve(),以免带上过期的 matched(当时可能命中 404) - if (resolved.name && resolved.name === to.name) { - return true; + if (resolved.name) { + return { + name: resolved.name, + params: resolved.params, + query: resolved.query, + hash: resolved.hash, + replace: true, + }; } return { - path: resolved.path, + path: resolved.path || redirectPath, query: resolved.query, hash: resolved.hash, replace: true, diff --git a/apps/web/apps/web-antd/src/views/_core/authentication/login.vue b/apps/web/apps/web-antd/src/views/_core/authentication/login.vue index 1b192c5e..9b10e13a 100644 --- a/apps/web/apps/web-antd/src/views/_core/authentication/login.vue +++ b/apps/web/apps/web-antd/src/views/_core/authentication/login.vue @@ -49,6 +49,9 @@ const formSchema = computed((): VbenFormSchema[] => { :loading="authStore.loginLoading" :show-forget-password="false" :show-register="false" + :show-code-login="false" + :show-qrcode-login="false" + :show-third-party-login="false" @submit="authStore.authLogin" /> diff --git a/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderFormModal.vue b/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderFormModal.vue index 8cc0ab40..7d63f3ae 100644 --- a/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderFormModal.vue +++ b/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderFormModal.vue @@ -67,7 +67,7 @@ async function handleSubmit() { return; } saving.value = true; - modalApi.setState({ confirming: true }); + modalApi.setState({ confirmLoading: true }); try { if (isEdit.value && editing.value) { await updateAgentLlmProviderApi(editing.value.id, { @@ -90,7 +90,7 @@ async function handleSubmit() { message.error(e?.message || '保存失败'); } finally { saving.value = false; - modalApi.setState({ confirming: false }); + modalApi.setState({ confirmLoading: false }); } } diff --git a/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderModelsModal.vue b/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderModelsModal.vue index dcd9e2a4..72f4e9d2 100644 --- a/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderModelsModal.vue +++ b/apps/web/apps/web-antd/src/views/agent/llm-settings/components/ProviderModelsModal.vue @@ -29,7 +29,7 @@ const emit = defineEmits<{ success: [] }>(); type ModelRow = { model: string; - contextWindow: number | null; + contextWindow: number | undefined; isDefault: boolean; enabled: boolean; }; @@ -63,7 +63,7 @@ function applyProviderModels(detail: AgentVO.LlmProvider) { modelRows.value = (detail.models || []).map((m) => ({ model: m.model, contextWindow: - m.contextWindow != null && m.contextWindow > 0 ? m.contextWindow : null, + m.contextWindow != null && m.contextWindow > 0 ? m.contextWindow : undefined, isDefault: !!m.isDefault, enabled: m.enabled !== false, })); @@ -101,7 +101,7 @@ function toggleProbed(p: AgentVO.ProbedLlmModel, checked: boolean) { contextWindow: p.contextWindow != null && p.contextWindow > 0 ? p.contextWindow - : null, + : undefined, isDefault: false, enabled: true, }); @@ -143,7 +143,7 @@ function addManual() { } modelRows.value.push({ model: id, - contextWindow: null, + contextWindow: undefined, isDefault: false, enabled: true, }); @@ -214,7 +214,7 @@ async function handleSave() { return; } saving.value = true; - modalApi.setState({ confirming: true }); + modalApi.setState({ confirmLoading: true }); try { const models = modelRows.value.map((m) => ({ model: m.model, @@ -234,7 +234,7 @@ async function handleSave() { message.error(e?.message || '保存失败'); } finally { saving.value = false; - modalApi.setState({ confirming: false }); + modalApi.setState({ confirmLoading: false }); } } diff --git a/apps/web/apps/web-antd/src/views/channel/pdd/components/PddShopSidebarList.vue b/apps/web/apps/web-antd/src/views/channel/pdd/components/PddShopSidebarList.vue index 3c7cd718..44fe2098 100644 --- a/apps/web/apps/web-antd/src/views/channel/pdd/components/PddShopSidebarList.vue +++ b/apps/web/apps/web-antd/src/views/channel/pdd/components/PddShopSidebarList.vue @@ -310,11 +310,11 @@ onMounted(() => {
-
+
@@ -337,7 +337,7 @@ onMounted(() => { v-if="showUnassignedFilter" size="small" :body-style="{ padding: '10px 12px' }" - class="mb-2 cursor-pointer !shadow-none hover:border-primary" + class="cursor-pointer !shadow-none hover:border-primary" :class=" unassignedSelected ? 'border-primary bg-primary/5' : undefined " @@ -371,19 +371,22 @@ onMounted(() => {
- + -