node-resource-utils 0.0.0-stage → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +35 -2
- package/lib/sync.js +121 -0
- package/package.json +14 -4
- package/resources/.cache/ref.b64 +1 -0
- package/resources/README.md +97 -0
- package/resources/_.env +6 -0
- package/resources/_.env.example +25 -0
- package/resources/_.gitignore +18 -0
- package/resources/_.lintstagedrc.json +9 -0
- package/resources/_.npmrc +5 -0
- package/resources/_.prettierrc +7 -0
- package/resources/commitlint.config.mjs +1 -0
- package/resources/content/docs/README.md +63 -0
- package/resources/content/docs/faq.md +107 -0
- package/resources/content/docs/features/_meta.json +5 -0
- package/resources/content/docs/features/ai.md +71 -0
- package/resources/content/docs/features/appearance.md +47 -0
- package/resources/content/docs/features/feedback.md +79 -0
- package/resources/content/docs/features/files.md +74 -0
- package/resources/content/docs/features/graph.md +66 -0
- package/resources/content/docs/features/inbox.md +61 -0
- package/resources/content/docs/guide/_meta.json +5 -0
- package/resources/content/docs/guide/account.md +76 -0
- package/resources/content/docs/guide/data.md +87 -0
- package/resources/content/docs/guide/navigation.md +81 -0
- package/resources/content/docs/guide/permissions.md +67 -0
- package/resources/content/docs/guide/system.md +92 -0
- package/resources/content/docs/quick-start.md +70 -0
- package/resources/content/docs/shortcuts.md +69 -0
- package/resources/eslint.config.mjs +17 -0
- package/resources/next-env.d.ts +6 -0
- package/resources/next.config.ts +13 -0
- package/resources/postcss.config.mjs +7 -0
- package/resources/prisma/org.config.ts +98 -0
- package/resources/prisma/schema.prisma +336 -0
- package/resources/prisma/seed.ts +721 -0
- package/resources/prisma/seedSafe.ts +347 -0
- package/resources/prisma.config.ts +14 -0
- package/resources/scripts/check-config.mjs +773 -0
- package/resources/scripts/lib/schema-graph.mjs +410 -0
- package/resources/scripts/patch-next-trace.mjs +86 -0
- package/resources/scripts/suggest-relations.mjs +105 -0
- package/resources/src/app/(admin)/ai/page.tsx +469 -0
- package/resources/src/app/(admin)/dashboard/page.tsx +260 -0
- package/resources/src/app/(admin)/demo/employees/page.tsx +508 -0
- package/resources/src/app/(admin)/demo/files/page.tsx +451 -0
- package/resources/src/app/(admin)/demo/loading/page.tsx +513 -0
- package/resources/src/app/(admin)/error.tsx +96 -0
- package/resources/src/app/(admin)/feedback/page.tsx +573 -0
- package/resources/src/app/(admin)/graph/page.tsx +1224 -0
- package/resources/src/app/(admin)/inbox/page.tsx +31 -0
- package/resources/src/app/(admin)/layout.tsx +58 -0
- package/resources/src/app/(admin)/loading.tsx +31 -0
- package/resources/src/app/(admin)/system/depts/page.tsx +415 -0
- package/resources/src/app/(admin)/system/logs/page.tsx +215 -0
- package/resources/src/app/(admin)/system/menus/page.tsx +403 -0
- package/resources/src/app/(admin)/system/roles/page.tsx +433 -0
- package/resources/src/app/(admin)/system/users/page.tsx +620 -0
- package/resources/src/app/api/account-recovery/route.ts +132 -0
- package/resources/src/app/api/ai/act/route.ts +70 -0
- package/resources/src/app/api/ai/ask/route.ts +82 -0
- package/resources/src/app/api/ai/chat/route.ts +404 -0
- package/resources/src/app/api/ai/report/route.ts +164 -0
- package/resources/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/resources/src/app/api/auth/change-password/route.ts +57 -0
- package/resources/src/app/api/auth/forgot/route.ts +98 -0
- package/resources/src/app/api/auth/register/route.ts +95 -0
- package/resources/src/app/api/auth/register-config/route.ts +51 -0
- package/resources/src/app/api/badges/route.ts +39 -0
- package/resources/src/app/api/depts/[id]/route.ts +145 -0
- package/resources/src/app/api/depts/route.ts +126 -0
- package/resources/src/app/api/docs/export/route.ts +87 -0
- package/resources/src/app/api/docs/parse/route.ts +57 -0
- package/resources/src/app/api/docs/search/route.ts +22 -0
- package/resources/src/app/api/employees/[id]/route.ts +147 -0
- package/resources/src/app/api/employees/export/route.ts +115 -0
- package/resources/src/app/api/employees/import/route.ts +205 -0
- package/resources/src/app/api/employees/route.ts +149 -0
- package/resources/src/app/api/export/route.ts +254 -0
- package/resources/src/app/api/favorites/route.ts +56 -0
- package/resources/src/app/api/feedback/ai/route.ts +31 -0
- package/resources/src/app/api/feedback/approve/route.ts +67 -0
- package/resources/src/app/api/feedback/report/route.ts +213 -0
- package/resources/src/app/api/feedback/route.ts +246 -0
- package/resources/src/app/api/files/[name]/route.ts +82 -0
- package/resources/src/app/api/graph/focus/route.ts +75 -0
- package/resources/src/app/api/graph/node/move/route.ts +48 -0
- package/resources/src/app/api/graph/node/route.ts +274 -0
- package/resources/src/app/api/graph/route.ts +272 -0
- package/resources/src/app/api/health/route.ts +11 -0
- package/resources/src/app/api/inbox/read/route.ts +36 -0
- package/resources/src/app/api/inbox/summary/route.ts +15 -0
- package/resources/src/app/api/logs/route.ts +82 -0
- package/resources/src/app/api/menus/[id]/route.ts +132 -0
- package/resources/src/app/api/menus/mine/route.ts +23 -0
- package/resources/src/app/api/menus/route.ts +89 -0
- package/resources/src/app/api/roles/[id]/menus/route.ts +73 -0
- package/resources/src/app/api/roles/[id]/route.ts +96 -0
- package/resources/src/app/api/roles/route.ts +114 -0
- package/resources/src/app/api/search/route.ts +22 -0
- package/resources/src/app/api/stats/route.ts +92 -0
- package/resources/src/app/api/upload/route.ts +38 -0
- package/resources/src/app/api/users/[id]/password/route.ts +55 -0
- package/resources/src/app/api/users/[id]/route.ts +145 -0
- package/resources/src/app/api/users/route.ts +153 -0
- package/resources/src/app/api/visits/route.ts +48 -0
- package/resources/src/app/change-password/ChangePasswordForm.tsx +174 -0
- package/resources/src/app/change-password/page.tsx +19 -0
- package/resources/src/app/docs/[[...slug]]/page.tsx +56 -0
- package/resources/src/app/docs/layout.tsx +34 -0
- package/resources/src/app/docs/loading.tsx +19 -0
- package/resources/src/app/docs/not-found.tsx +25 -0
- package/resources/src/app/forgot/page.tsx +392 -0
- package/resources/src/app/global-error.tsx +75 -0
- package/resources/src/app/globals.css +235 -0
- package/resources/src/app/layout.tsx +44 -0
- package/resources/src/app/login/page.tsx +267 -0
- package/resources/src/app/page.tsx +14 -0
- package/resources/src/app/register/page.tsx +237 -0
- package/resources/src/auth.ts +215 -0
- package/resources/src/components/AiPanel.tsx +970 -0
- package/resources/src/components/AuthContext.tsx +82 -0
- package/resources/src/components/DataTable.tsx +459 -0
- package/resources/src/components/EChart.tsx +140 -0
- package/resources/src/components/FeedbackAiModal.tsx +476 -0
- package/resources/src/components/FeedbackReportModal.tsx +479 -0
- package/resources/src/components/Markdown.tsx +532 -0
- package/resources/src/components/OntologyGraph.tsx +1196 -0
- package/resources/src/components/Providers.tsx +99 -0
- package/resources/src/components/VisitTracker.tsx +89 -0
- package/resources/src/components/admin/AdminShell.tsx +749 -0
- package/resources/src/components/admin/CountBadge.tsx +67 -0
- package/resources/src/components/admin/GlobalSearch.tsx +509 -0
- package/resources/src/components/admin/InboxBell.tsx +78 -0
- package/resources/src/components/admin/VisitStats.tsx +145 -0
- package/resources/src/components/admin/menu-icons.tsx +56 -0
- package/resources/src/components/ai/AiInputForm.tsx +351 -0
- package/resources/src/components/appearance/AppearanceDrawer.tsx +268 -0
- package/resources/src/components/appearance/AppearanceProvider.tsx +160 -0
- package/resources/src/components/docs/DocArticle.tsx +106 -0
- package/resources/src/components/docs/DocToc.tsx +100 -0
- package/resources/src/components/docs/DocsChrome.tsx +259 -0
- package/resources/src/components/docs/DocsHome.tsx +209 -0
- package/resources/src/components/docs/DocsSearch.tsx +365 -0
- package/resources/src/components/docs/docs.css +1458 -0
- package/resources/src/components/feedback/AsyncButton.tsx +108 -0
- package/resources/src/components/feedback/LoadingOverlay.tsx +125 -0
- package/resources/src/components/feedback/PressableCard.tsx +92 -0
- package/resources/src/components/feedback/README.md +97 -0
- package/resources/src/components/feedback/RouteProgress.tsx +108 -0
- package/resources/src/components/feedback/Skeleton.tsx +249 -0
- package/resources/src/components/feedback/StatCard.tsx +70 -0
- package/resources/src/components/feedback/TaskHint.tsx +153 -0
- package/resources/src/components/feedback/index.ts +93 -0
- package/resources/src/components/feedback/motion.css +204 -0
- package/resources/src/components/feedback/motion.ts +63 -0
- package/resources/src/components/feedback/useCountUp.ts +110 -0
- package/resources/src/components/feedback/usePending.ts +209 -0
- package/resources/src/components/feedback/useRowFlash.ts +40 -0
- package/resources/src/components/inbox/InboxView.tsx +409 -0
- package/resources/src/components/ui/button.tsx +35 -0
- package/resources/src/components/ui/card.tsx +37 -0
- package/resources/src/components/ui/input.tsx +19 -0
- package/resources/src/lib/ai.ts +310 -0
- package/resources/src/lib/aiContext.ts +357 -0
- package/resources/src/lib/aiForm.test.ts +191 -0
- package/resources/src/lib/aiForm.ts +532 -0
- package/resources/src/lib/aiFormTypes.ts +83 -0
- package/resources/src/lib/aiToken.ts +72 -0
- package/resources/src/lib/aiTools.ts +823 -0
- package/resources/src/lib/api.ts +160 -0
- package/resources/src/lib/appInfo.ts +128 -0
- package/resources/src/lib/appearance.ts +643 -0
- package/resources/src/lib/badge-count.ts +146 -0
- package/resources/src/lib/badges.test.ts +58 -0
- package/resources/src/lib/badges.ts +79 -0
- package/resources/src/lib/brand-mark.test.ts +87 -0
- package/resources/src/lib/brand-mark.ts +45 -0
- package/resources/src/lib/docs-shared.test.ts +148 -0
- package/resources/src/lib/docs-shared.ts +422 -0
- package/resources/src/lib/docs.ts +381 -0
- package/resources/src/lib/err-text.ts +21 -0
- package/resources/src/lib/excel.ts +152 -0
- package/resources/src/lib/favorite-path.ts +60 -0
- package/resources/src/lib/favorites.ts +59 -0
- package/resources/src/lib/features.ts +69 -0
- package/resources/src/lib/feedback-access.ts +17 -0
- package/resources/src/lib/feedbackAi.ts +1621 -0
- package/resources/src/lib/formRules.ts +76 -0
- package/resources/src/lib/format.ts +52 -0
- package/resources/src/lib/graph-cascade.ts +304 -0
- package/resources/src/lib/graph-focus.ts +301 -0
- package/resources/src/lib/graph-link.ts +17 -0
- package/resources/src/lib/graph-node-write.ts +150 -0
- package/resources/src/lib/graph-schema.ts +475 -0
- package/resources/src/lib/graph-scope.test.ts +46 -0
- package/resources/src/lib/graph-scope.ts +28 -0
- package/resources/src/lib/http.ts +157 -0
- package/resources/src/lib/inbox-types.ts +57 -0
- package/resources/src/lib/inbox.ts +55 -0
- package/resources/src/lib/menu-service.ts +204 -0
- package/resources/src/lib/notifications.ts +113 -0
- package/resources/src/lib/office.ts +531 -0
- package/resources/src/lib/ontology.ts +277 -0
- package/resources/src/lib/openaiCompat.ts +257 -0
- package/resources/src/lib/pending.ts +98 -0
- package/resources/src/lib/prisma.ts +30 -0
- package/resources/src/lib/rbac.test.ts +106 -0
- package/resources/src/lib/rbac.ts +185 -0
- package/resources/src/lib/search-data.ts +158 -0
- package/resources/src/lib/security-questions.ts +20 -0
- package/resources/src/lib/skin-theme.ts +155 -0
- package/resources/src/lib/system-config.ts +55 -0
- package/resources/src/lib/theme.ts +96 -0
- package/resources/src/lib/todos/feedback.ts +86 -0
- package/resources/src/lib/todos/index.ts +73 -0
- package/resources/src/lib/todos/types.ts +33 -0
- package/resources/src/lib/upload.ts +106 -0
- package/resources/src/lib/utils.test.ts +9 -0
- package/resources/src/lib/utils.ts +6 -0
- package/resources/src/lib/validation.test.ts +297 -0
- package/resources/src/lib/validation.ts +658 -0
- package/resources/src/lib/visit-stats.ts +109 -0
- package/resources/src/lib/visits.ts +111 -0
- package/resources/src/lib/zodField.ts +44 -0
- package/resources/tsconfig.json +41 -0
- package/resources/vitest.config.ts +16 -0
- package/resources/vitest.setup.ts +1 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';
|
|
4
|
+
import { Alert, App, Button, Modal, Space, Spin } from 'antd';
|
|
5
|
+
import {
|
|
6
|
+
CloseOutlined,
|
|
7
|
+
FileTextOutlined,
|
|
8
|
+
ReloadOutlined,
|
|
9
|
+
ThunderboltOutlined,
|
|
10
|
+
} from '@ant-design/icons';
|
|
11
|
+
import dayjs from 'dayjs';
|
|
12
|
+
import Markdown from '@/components/Markdown';
|
|
13
|
+
import { formatElapsed, useElapsed } from '@/components/feedback';
|
|
14
|
+
import { fs, MILITARY } from '@/lib/theme';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 智能反馈分析报告弹窗。
|
|
18
|
+
*
|
|
19
|
+
* 只由超管从反馈页的「智能生成报告」进入;打开即自动请求一次,
|
|
20
|
+
* 之后可以「重新生成」。报告内容由后端调用本地模型生成,
|
|
21
|
+
* 这里只负责把结果排成一份像样的「档案」:
|
|
22
|
+
* 深军绿封面 + 统计条 + 白纸正文 + 底部操作栏。
|
|
23
|
+
*
|
|
24
|
+
* 为什么不用普通 Modal 直接塞一段文字:
|
|
25
|
+
* 这是比赛演示的亮点功能,评委第一眼看到的是排版。
|
|
26
|
+
* 封面、统计卡、纸张层次能把「AI 真的读了数据」这件事讲清楚。
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export interface FeedbackReportStats {
|
|
30
|
+
total: number;
|
|
31
|
+
pending: number;
|
|
32
|
+
doing: number;
|
|
33
|
+
resolved: number;
|
|
34
|
+
closed: number;
|
|
35
|
+
bug: number;
|
|
36
|
+
suggest: number;
|
|
37
|
+
data: number;
|
|
38
|
+
other: number;
|
|
39
|
+
last7: number;
|
|
40
|
+
users: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface ReportPayload {
|
|
44
|
+
report: string;
|
|
45
|
+
stats: FeedbackReportStats;
|
|
46
|
+
total: number;
|
|
47
|
+
analyzed: number;
|
|
48
|
+
truncated: boolean;
|
|
49
|
+
model: string;
|
|
50
|
+
generatedAt: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface Props {
|
|
54
|
+
open: boolean;
|
|
55
|
+
onClose: () => void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** 封面小徽标:卡其描边的半透明胶囊 */
|
|
59
|
+
function MetaPill({ children }: { children: ReactNode }) {
|
|
60
|
+
return (
|
|
61
|
+
<span
|
|
62
|
+
style={{
|
|
63
|
+
fontSize: fs(11.5),
|
|
64
|
+
padding: '3px 10px',
|
|
65
|
+
borderRadius: 999,
|
|
66
|
+
border: '1px solid var(--wb-brand-line)',
|
|
67
|
+
background: 'var(--wb-brand-glass)',
|
|
68
|
+
color: 'var(--wb-brand-text)',
|
|
69
|
+
whiteSpace: 'nowrap',
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{children}
|
|
73
|
+
</span>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 封面四角的定位角标(纯边框,呼应全站的军绿档案风格) */
|
|
78
|
+
function CornerBrackets() {
|
|
79
|
+
const base: React.CSSProperties = {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
width: 14,
|
|
82
|
+
height: 14,
|
|
83
|
+
borderColor: 'var(--wb-brand-tint)',
|
|
84
|
+
borderStyle: 'solid',
|
|
85
|
+
borderWidth: 0,
|
|
86
|
+
};
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<span style={{ ...base, left: 10, top: 10, borderLeftWidth: 1, borderTopWidth: 1 }} />
|
|
90
|
+
<span style={{ ...base, right: 10, top: 10, borderRightWidth: 1, borderTopWidth: 1 }} />
|
|
91
|
+
<span style={{ ...base, left: 10, bottom: 10, borderLeftWidth: 1, borderBottomWidth: 1 }} />
|
|
92
|
+
<span style={{ ...base, right: 10, bottom: 10, borderRightWidth: 1, borderBottomWidth: 1 }} />
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function StatTile({
|
|
98
|
+
label,
|
|
99
|
+
value,
|
|
100
|
+
suffix,
|
|
101
|
+
hint,
|
|
102
|
+
color,
|
|
103
|
+
}: {
|
|
104
|
+
label: string;
|
|
105
|
+
value: number;
|
|
106
|
+
suffix: string;
|
|
107
|
+
hint: string;
|
|
108
|
+
color: string;
|
|
109
|
+
}) {
|
|
110
|
+
return (
|
|
111
|
+
<div
|
|
112
|
+
style={{
|
|
113
|
+
background: MILITARY.card,
|
|
114
|
+
border: `1px solid ${MILITARY.borderSoft}`,
|
|
115
|
+
borderLeft: `3px solid ${color}`,
|
|
116
|
+
borderRadius: 10,
|
|
117
|
+
padding: '10px 14px',
|
|
118
|
+
boxShadow: '0 2px 8px rgba(43,55,33,.04)',
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<div style={{ fontSize: fs(11), color: MILITARY.textMuted, letterSpacing: 0.5 }}>{label}</div>
|
|
122
|
+
<div style={{ display: 'flex', alignItems: 'baseline', gap: 4, marginTop: 1 }}>
|
|
123
|
+
<span
|
|
124
|
+
style={{
|
|
125
|
+
fontSize: fs(24),
|
|
126
|
+
fontWeight: 700,
|
|
127
|
+
color,
|
|
128
|
+
lineHeight: 1.25,
|
|
129
|
+
fontVariantNumeric: 'tabular-nums',
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
{value}
|
|
133
|
+
</span>
|
|
134
|
+
<span style={{ fontSize: fs(11.5), color: MILITARY.textMuted }}>{suffix}</span>
|
|
135
|
+
</div>
|
|
136
|
+
<div style={{ fontSize: fs(11), color: MILITARY.textMuted, marginTop: 1 }}>{hint}</div>
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default function FeedbackReportModal({ open, onClose }: Props) {
|
|
142
|
+
const { message } = App.useApp();
|
|
143
|
+
const [data, setData] = useState<ReportPayload | null>(null);
|
|
144
|
+
const [loading, setLoading] = useState(false);
|
|
145
|
+
const [error, setError] = useState('');
|
|
146
|
+
const pendingRef = useRef(false);
|
|
147
|
+
const autoStartedRef = useRef(false);
|
|
148
|
+
const elapsed = useElapsed(loading);
|
|
149
|
+
|
|
150
|
+
const generate = useCallback(async () => {
|
|
151
|
+
if (pendingRef.current) return;
|
|
152
|
+
pendingRef.current = true;
|
|
153
|
+
setLoading(true);
|
|
154
|
+
setError('');
|
|
155
|
+
try {
|
|
156
|
+
const res = await fetch('/api/feedback/report', {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
headers: { 'Content-Type': 'application/json' },
|
|
159
|
+
body: '{}',
|
|
160
|
+
});
|
|
161
|
+
const j = (await res.json()) as {
|
|
162
|
+
code: number;
|
|
163
|
+
data?: ReportPayload;
|
|
164
|
+
message?: string;
|
|
165
|
+
};
|
|
166
|
+
// 注意:脚手架 ok() 的成功码是 0,不是 200
|
|
167
|
+
if (j.code !== 0 || !j.data) {
|
|
168
|
+
setError(j.message || '生成失败,请稍后重试');
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
setData(j.data);
|
|
172
|
+
message.success(`已分析 ${j.data.analyzed} 条反馈并生成报告`);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
setError(`生成失败:${e instanceof Error ? e.message : String(e)}`);
|
|
175
|
+
} finally {
|
|
176
|
+
pendingRef.current = false;
|
|
177
|
+
setLoading(false);
|
|
178
|
+
}
|
|
179
|
+
}, [message]);
|
|
180
|
+
|
|
181
|
+
// 首次打开自动生成;关闭再打开时保留上一次结果,避免重复消耗模型
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (!open || autoStartedRef.current) return;
|
|
184
|
+
autoStartedRef.current = true;
|
|
185
|
+
void generate();
|
|
186
|
+
}, [open, generate]);
|
|
187
|
+
|
|
188
|
+
const stage =
|
|
189
|
+
elapsed >= 20_000
|
|
190
|
+
? '模型仍在深入分析,请再稍等…'
|
|
191
|
+
: elapsed >= 8_000
|
|
192
|
+
? '正在归纳用户诉求、排出改进优先级…'
|
|
193
|
+
: '正在读取全部反馈并交给本地模型…';
|
|
194
|
+
|
|
195
|
+
const tiles: { label: string; value: number; suffix: string; hint: string; color: string }[] =
|
|
196
|
+
data
|
|
197
|
+
? [
|
|
198
|
+
{
|
|
199
|
+
label: '反馈总数',
|
|
200
|
+
value: data.stats.total,
|
|
201
|
+
suffix: '条',
|
|
202
|
+
hint: `近 7 天新增 ${data.stats.last7} 条`,
|
|
203
|
+
color: MILITARY.primary,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
label: '待处理',
|
|
207
|
+
value: data.stats.pending,
|
|
208
|
+
suffix: '条',
|
|
209
|
+
hint: `处理中 ${data.stats.doing} 条`,
|
|
210
|
+
color: MILITARY.warning,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
label: '已解决',
|
|
214
|
+
value: data.stats.resolved,
|
|
215
|
+
suffix: '条',
|
|
216
|
+
hint: `已关闭 ${data.stats.closed} 条`,
|
|
217
|
+
color: MILITARY.success,
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
label: '体验建议',
|
|
221
|
+
value: data.stats.suggest,
|
|
222
|
+
suffix: '条',
|
|
223
|
+
hint: `功能诉求主要来源`,
|
|
224
|
+
color: MILITARY.accent,
|
|
225
|
+
},
|
|
226
|
+
]
|
|
227
|
+
: [];
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<Modal
|
|
231
|
+
open={open}
|
|
232
|
+
onCancel={onClose}
|
|
233
|
+
footer={null}
|
|
234
|
+
width={920}
|
|
235
|
+
centered
|
|
236
|
+
closable={false}
|
|
237
|
+
styles={{
|
|
238
|
+
body: {
|
|
239
|
+
padding: 0,
|
|
240
|
+
display: 'flex',
|
|
241
|
+
flexDirection: 'column',
|
|
242
|
+
maxHeight: '86vh',
|
|
243
|
+
overflow: 'hidden',
|
|
244
|
+
},
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
{/* ---------------- 封面 ---------------- */}
|
|
248
|
+
<div
|
|
249
|
+
style={{
|
|
250
|
+
position: 'relative',
|
|
251
|
+
flexShrink: 0,
|
|
252
|
+
overflow: 'hidden',
|
|
253
|
+
padding: '22px 26px 20px',
|
|
254
|
+
borderRadius: '8px 8px 0 0',
|
|
255
|
+
borderBottom: '2px solid var(--wb-brand-tint)',
|
|
256
|
+
backgroundImage: 'var(--wb-brand-panel)',
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
<CornerBrackets />
|
|
260
|
+
<Button
|
|
261
|
+
type="text"
|
|
262
|
+
shape="circle"
|
|
263
|
+
aria-label="关闭"
|
|
264
|
+
icon={<CloseOutlined />}
|
|
265
|
+
onClick={onClose}
|
|
266
|
+
style={{ position: 'absolute', right: 12, top: 12, color: 'var(--wb-brand-text-soft)' }}
|
|
267
|
+
/>
|
|
268
|
+
|
|
269
|
+
<div style={{ position: 'relative' }}>
|
|
270
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
271
|
+
<span style={{ width: 6, height: 6, background: MILITARY.accent, display: 'inline-block' }} />
|
|
272
|
+
<span
|
|
273
|
+
style={{
|
|
274
|
+
fontSize: fs(10.5),
|
|
275
|
+
letterSpacing: 3,
|
|
276
|
+
color: 'var(--wb-brand-kicker)',
|
|
277
|
+
fontWeight: 600,
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
FEEDBACK INTELLIGENCE · AI ANALYSIS
|
|
281
|
+
</span>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div
|
|
285
|
+
style={{
|
|
286
|
+
fontSize: fs(23),
|
|
287
|
+
fontWeight: 700,
|
|
288
|
+
color: 'var(--wb-brand-text)',
|
|
289
|
+
marginTop: 8,
|
|
290
|
+
letterSpacing: 0.5,
|
|
291
|
+
}}
|
|
292
|
+
>
|
|
293
|
+
用户反馈分析报告
|
|
294
|
+
</div>
|
|
295
|
+
<div style={{ fontSize: fs(12.5), color: 'var(--wb-brand-text-soft)', marginTop: 6 }}>
|
|
296
|
+
基于全部真实反馈,自动归纳呼声最高的功能、主要问题与改进优先级
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', marginTop: 14 }}>
|
|
300
|
+
{data ? (
|
|
301
|
+
<>
|
|
302
|
+
<MetaPill>生成于 {dayjs(data.generatedAt).format('YYYY-MM-DD HH:mm')}</MetaPill>
|
|
303
|
+
<MetaPill>
|
|
304
|
+
分析 {data.analyzed} 条{data.truncated ? ` / 共 ${data.total} 条` : ''}
|
|
305
|
+
</MetaPill>
|
|
306
|
+
<MetaPill>{data.model}</MetaPill>
|
|
307
|
+
</>
|
|
308
|
+
) : (
|
|
309
|
+
<MetaPill>{loading ? 'AI 正在分析全部反馈' : '等待生成'}</MetaPill>
|
|
310
|
+
)}
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
{/* ---------------- 统计条 ---------------- */}
|
|
316
|
+
{data && (
|
|
317
|
+
<div
|
|
318
|
+
style={{
|
|
319
|
+
display: 'grid',
|
|
320
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))',
|
|
321
|
+
gap: 10,
|
|
322
|
+
padding: '14px 22px 4px',
|
|
323
|
+
background: MILITARY.paper,
|
|
324
|
+
flexShrink: 0,
|
|
325
|
+
}}
|
|
326
|
+
>
|
|
327
|
+
{tiles.map((t) => (
|
|
328
|
+
<StatTile key={t.label} {...t} />
|
|
329
|
+
))}
|
|
330
|
+
</div>
|
|
331
|
+
)}
|
|
332
|
+
|
|
333
|
+
{/* ---------------- 报告正文 ---------------- */}
|
|
334
|
+
<div
|
|
335
|
+
style={{
|
|
336
|
+
flex: 1,
|
|
337
|
+
minHeight: 0,
|
|
338
|
+
overflowY: 'auto',
|
|
339
|
+
padding: '12px 22px 18px',
|
|
340
|
+
background: MILITARY.paper,
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
{loading ? (
|
|
344
|
+
<div
|
|
345
|
+
style={{
|
|
346
|
+
minHeight: 240,
|
|
347
|
+
display: 'flex',
|
|
348
|
+
flexDirection: 'column',
|
|
349
|
+
alignItems: 'center',
|
|
350
|
+
justifyContent: 'center',
|
|
351
|
+
textAlign: 'center',
|
|
352
|
+
color: MILITARY.textMuted,
|
|
353
|
+
fontSize: fs(13),
|
|
354
|
+
}}
|
|
355
|
+
>
|
|
356
|
+
<div
|
|
357
|
+
style={{
|
|
358
|
+
width: 60,
|
|
359
|
+
height: 60,
|
|
360
|
+
borderRadius: '50%',
|
|
361
|
+
display: 'grid',
|
|
362
|
+
placeItems: 'center',
|
|
363
|
+
background: MILITARY.soft,
|
|
364
|
+
border: `1px solid ${MILITARY.softStrong}`,
|
|
365
|
+
marginBottom: 16,
|
|
366
|
+
}}
|
|
367
|
+
>
|
|
368
|
+
<Spin />
|
|
369
|
+
</div>
|
|
370
|
+
<div style={{ color: MILITARY.text, fontWeight: 600, fontSize: fs(14) }}>{stage}</div>
|
|
371
|
+
<div style={{ marginTop: 6, fontSize: fs(12) }}>已等待 {formatElapsed(elapsed)}</div>
|
|
372
|
+
<div style={{ marginTop: 10, fontSize: fs(11.5), color: MILITARY.textMuted }}>
|
|
373
|
+
本地模型分析全部反馈通常需要 10~60 秒,请勿关闭
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
) : error ? (
|
|
377
|
+
<div style={{ paddingTop: 8 }}>
|
|
378
|
+
<Alert
|
|
379
|
+
type="error"
|
|
380
|
+
showIcon
|
|
381
|
+
title="报告生成失败"
|
|
382
|
+
description={error}
|
|
383
|
+
action={
|
|
384
|
+
<Button size="small" icon={<ReloadOutlined />} onClick={() => void generate()}>
|
|
385
|
+
重试
|
|
386
|
+
</Button>
|
|
387
|
+
}
|
|
388
|
+
/>
|
|
389
|
+
</div>
|
|
390
|
+
) : data ? (
|
|
391
|
+
<>
|
|
392
|
+
<div
|
|
393
|
+
style={{
|
|
394
|
+
background: MILITARY.card,
|
|
395
|
+
border: `1px solid ${MILITARY.borderSoft}`,
|
|
396
|
+
borderRadius: 12,
|
|
397
|
+
padding: '18px 22px 20px',
|
|
398
|
+
boxShadow: '0 10px 28px rgba(43,55,33,.06)',
|
|
399
|
+
}}
|
|
400
|
+
>
|
|
401
|
+
<div
|
|
402
|
+
style={{
|
|
403
|
+
display: 'flex',
|
|
404
|
+
alignItems: 'center',
|
|
405
|
+
gap: 8,
|
|
406
|
+
paddingBottom: 10,
|
|
407
|
+
marginBottom: 10,
|
|
408
|
+
borderBottom: `1px dashed ${MILITARY.border}`,
|
|
409
|
+
}}
|
|
410
|
+
>
|
|
411
|
+
<span
|
|
412
|
+
style={{
|
|
413
|
+
width: 26,
|
|
414
|
+
height: 26,
|
|
415
|
+
borderRadius: 7,
|
|
416
|
+
display: 'grid',
|
|
417
|
+
placeItems: 'center',
|
|
418
|
+
background: MILITARY.soft,
|
|
419
|
+
border: `1px solid ${MILITARY.softStrong}`,
|
|
420
|
+
color: MILITARY.primary,
|
|
421
|
+
fontSize: fs(13),
|
|
422
|
+
}}
|
|
423
|
+
>
|
|
424
|
+
<FileTextOutlined />
|
|
425
|
+
</span>
|
|
426
|
+
<span style={{ fontSize: fs(13), fontWeight: 600, color: MILITARY.text }}>AI 分析正文</span>
|
|
427
|
+
<span style={{ marginLeft: 'auto', fontSize: fs(11), color: MILITARY.textMuted }}>
|
|
428
|
+
{data.truncated
|
|
429
|
+
? `样本:最近 ${data.analyzed} / ${data.total} 条`
|
|
430
|
+
: `样本:全部 ${data.total} 条`}
|
|
431
|
+
</span>
|
|
432
|
+
</div>
|
|
433
|
+
<Markdown text={data.report} style={{ fontSize: fs(13.5) }} />
|
|
434
|
+
</div>
|
|
435
|
+
<div
|
|
436
|
+
style={{
|
|
437
|
+
marginTop: 10,
|
|
438
|
+
textAlign: 'right',
|
|
439
|
+
fontSize: fs(11),
|
|
440
|
+
color: MILITARY.textMuted,
|
|
441
|
+
}}
|
|
442
|
+
>
|
|
443
|
+
报告由本地大模型生成 · 数据不出内网 · 参与用户 {data.stats.users} 人
|
|
444
|
+
</div>
|
|
445
|
+
</>
|
|
446
|
+
) : null}
|
|
447
|
+
</div>
|
|
448
|
+
|
|
449
|
+
{/* ---------------- 底部操作 ---------------- */}
|
|
450
|
+
<div
|
|
451
|
+
style={{
|
|
452
|
+
display: 'flex',
|
|
453
|
+
alignItems: 'center',
|
|
454
|
+
justifyContent: 'space-between',
|
|
455
|
+
gap: 12,
|
|
456
|
+
padding: '12px 22px',
|
|
457
|
+
borderTop: `1px solid ${MILITARY.borderSoft}`,
|
|
458
|
+
background: MILITARY.card,
|
|
459
|
+
flexShrink: 0,
|
|
460
|
+
}}
|
|
461
|
+
>
|
|
462
|
+
<span style={{ fontSize: fs(11.5), color: MILITARY.textMuted }}>
|
|
463
|
+
AI 结论仅供参考,重要决策请结合原始反馈复核
|
|
464
|
+
</span>
|
|
465
|
+
<Space>
|
|
466
|
+
<Button onClick={onClose}>关闭</Button>
|
|
467
|
+
<Button
|
|
468
|
+
type="primary"
|
|
469
|
+
icon={<ThunderboltOutlined />}
|
|
470
|
+
loading={loading}
|
|
471
|
+
onClick={() => void generate()}
|
|
472
|
+
>
|
|
473
|
+
{data ? '重新生成' : error ? '重试' : '生成报告'}
|
|
474
|
+
</Button>
|
|
475
|
+
</Space>
|
|
476
|
+
</div>
|
|
477
|
+
</Modal>
|
|
478
|
+
);
|
|
479
|
+
}
|