bnpanel 0.6.5 → 0.6.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/assets/diagnose/account-diagnosis/LICENSE +21 -0
- package/assets/diagnose/account-diagnosis/SKILL.md +87 -0
- package/assets/diagnose/account-diagnosis/assets/report-template.md +92 -0
- package/assets/diagnose/account-diagnosis/references/diagnosis-framework.md +70 -0
- package/assets/diagnose/account-diagnosis/references/prescription-library.md +184 -0
- package/assets/diagnose/creator-research/SKILL.md +63 -0
- package/assets/diagnose/creator-research/references/research-checklist.md +55 -0
- package/assets/diagnose/topic-planner/SKILL.md +73 -0
- package/assets/diagnose/topic-planner/references/formula-card.md +49 -0
- package/client.js +1084 -12
- package/index.js +906 -26
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
--bn-toast-bg:#34302c; --bn-toast-fg:#f6f3ec;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
.bn-root{position:relative;display:grid;grid-template-columns:minmax(0,208px) minmax(0,1fr);height:100%;min-height:520px;width:100%;max-width:100%;min-width:0;overflow:hidden;background:var(--bn-bg);color:var(--bn-ink);font:13px/1.55 var(--bn-font);-webkit-font-smoothing:antialiased}
|
|
46
|
+
.bn-root{position:relative;display:grid;grid-template-columns:minmax(0,208px) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;height:100%;min-height:520px;width:100%;max-width:100%;min-width:0;overflow:hidden;background:var(--bn-bg);color:var(--bn-ink);font:13px/1.55 var(--bn-font);-webkit-font-smoothing:antialiased}
|
|
47
47
|
.bn-root *{box-sizing:border-box}
|
|
48
|
-
.bn-rail{display:flex;flex-direction:column;gap:2px;min-height:0;overflow:auto;padding:16px 10px;border-right:1px solid var(--bn-line);background:var(--bn-surface-2)}
|
|
48
|
+
.bn-rail{grid-column:1;grid-row:1 / span 2;display:flex;flex-direction:column;gap:2px;min-height:0;overflow:auto;padding:16px 10px;border-right:1px solid var(--bn-line);background:var(--bn-surface-2)}
|
|
49
49
|
.bn-logo{display:flex;align-items:center;gap:9px;padding:2px 8px 16px;font-weight:680;letter-spacing:-.01em}
|
|
50
50
|
.bn-logo .dot{width:22px;height:22px;border-radius:7px;background:var(--bn-ink);box-shadow:inset 0 0 0 2.5px var(--bn-accent),0 2px 8px rgba(0,0,0,.18);overflow:hidden}
|
|
51
51
|
.bn-logo .dot img{width:100%;height:100%;object-fit:cover;display:block}
|
|
@@ -92,9 +92,8 @@
|
|
|
92
92
|
.bn-wx code{display:block;margin-top:2px;font-family:var(--bn-mono);font-size:14px;color:var(--bn-ink);letter-spacing:.01em}
|
|
93
93
|
.bn-wx .bn-btn{height:30px;padding:0 12px;background:var(--bn-solid);color:var(--bn-on-solid);border-color:var(--bn-solid)}
|
|
94
94
|
.bn-manual{display:flex;align-items:center;justify-content:center;width:100%;margin-top:14px;height:36px;text-decoration:none;box-sizing:border-box}
|
|
95
|
-
.bn-main{overflow:auto;overflow-x:hidden;padding:22px 26px 40px;min-width:0;max-width:100%}
|
|
96
|
-
.bn-
|
|
97
|
-
.bn-foot-note{position:absolute;z-index:4;left:208px;bottom:16px;margin:0;padding-left:26px;max-width:min(460px,calc(100% - 208px - 86px));display:flex;flex-direction:column;gap:3px;color:var(--bn-faint);font-size:12px;line-height:1.65;pointer-events:none}
|
|
95
|
+
.bn-main{grid-column:2;grid-row:1;overflow:auto;overflow-x:hidden;padding:22px 26px 40px;min-width:0;max-width:100%}
|
|
96
|
+
.bn-foot-note{grid-column:2;grid-row:2;margin:0;padding:8px 86px 12px 26px;display:flex;flex-direction:column;gap:3px;color:var(--bn-faint);font-size:12px;line-height:1.65;pointer-events:none;background:var(--bn-bg)}
|
|
98
97
|
.bn-cs{position:absolute;z-index:5;right:18px;bottom:16px;width:46px;height:46px;padding:0;border:0;border-radius:50%;display:grid;place-items:center;cursor:pointer;background:#111;color:#d4f07a;box-shadow:0 10px 24px rgba(0,0,0,.18),inset 0 0 0 2px #d4f07a}
|
|
99
98
|
.bn-cs svg{animation:bn-cs-breathe 2.2s ease-in-out infinite}
|
|
100
99
|
.bn-cs:hover{transform:translateY(-1px)}
|
|
@@ -281,8 +280,93 @@
|
|
|
281
280
|
.bn-lic .status .bn-btn{height:26px;padding:0 8px;font-size:12px}
|
|
282
281
|
.bn-lic .bn-desc{min-height:0;margin-top:10px}
|
|
283
282
|
.bn-activate{display:flex;gap:10px;align-items:center;margin-top:16px;flex-wrap:nowrap}
|
|
283
|
+
.bn-activate.batch{flex-wrap:wrap;align-items:flex-start}
|
|
284
|
+
.bn-activate textarea.bn-input{flex:1 1 280px;width:auto;min-width:220px;max-width:none;min-height:78px;height:auto;padding:8px 10px;resize:vertical;font-family:var(--bn-mono);font-size:12px;line-height:1.65}
|
|
285
|
+
.bn-activate .bn-activate-out{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;margin-top:2px;font-size:12px}
|
|
286
|
+
.bn-activate .bn-activate-out .row{display:flex;align-items:center;gap:8px;min-width:0}
|
|
287
|
+
.bn-upgrade{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:22px;border:1px solid var(--bn-line);border-radius:var(--bn-r-sm);background:radial-gradient(320px 140px at 100% 0%,var(--bn-accent-soft),transparent 70%),var(--bn-surface-2)}
|
|
288
|
+
.bn-upgrade h3{margin:0;font-size:15px}
|
|
289
|
+
.bn-upgrade p{margin:0;color:var(--bn-muted);font-size:12.5px;line-height:1.65;max-width:58ch}
|
|
290
|
+
.bn-diagnose-card{display:flex;flex-direction:column;gap:6px}
|
|
291
|
+
.bn-diagnose-card .bn-desc{margin:0}
|
|
292
|
+
/* 账号增长工作台:号脉、对标、选题与复诊共用本机会话和档案 */
|
|
293
|
+
.bn-growth-tabs{display:flex;width:fit-content;max-width:100%;margin-bottom:16px;overflow:auto}
|
|
294
|
+
.bn-growth-tabs button{white-space:nowrap}
|
|
295
|
+
.bn-growth-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}
|
|
296
|
+
.bn-growth-form .bn-field{margin:0;min-width:0}
|
|
297
|
+
.bn-growth-form .full{grid-column:1 / -1}
|
|
298
|
+
.bn-growth-form textarea.bn-input{min-height:78px;resize:vertical;line-height:1.6}
|
|
299
|
+
.bn-growth-source{display:flex;align-items:center;gap:10px;margin-top:12px;padding:10px 12px;border:1px solid var(--bn-line);border-radius:10px;background:var(--bn-accent-soft);color:var(--bn-ink-2);font-size:12px}
|
|
300
|
+
.bn-growth-source span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
301
|
+
.bn-growth-compare{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}
|
|
302
|
+
.bn-growth-compare>div{min-width:0;padding:12px;border:1px solid var(--bn-line);border-radius:12px;background:var(--bn-surface-2)}
|
|
303
|
+
.bn-growth-compare b{display:block;margin-bottom:4px;font-size:12px}
|
|
304
|
+
.bn-growth-compare span{display:block;color:var(--bn-muted);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
305
|
+
@media (max-width:720px){.bn-growth-form,.bn-growth-compare{grid-template-columns:1fr}.bn-growth-form .full{grid-column:auto}}
|
|
306
|
+
.bn-diag-hero{position:relative;overflow:hidden;border-radius:var(--bn-r);padding:22px 24px;margin-bottom:16px;display:flex;gap:20px;align-items:flex-start;justify-content:space-between;background:radial-gradient(420px 180px at 100% 0%,rgba(212,240,122,.22),transparent 70%),linear-gradient(140deg,#101010 0%,#1d1d1a 55%,#2f3a17 100%);color:#f4f1ea}
|
|
307
|
+
.bn-diag-hero:after{content:'';position:absolute;right:-40px;bottom:-80px;width:240px;height:240px;border-radius:50%;background:radial-gradient(circle,rgba(212,240,122,.16),transparent 65%);pointer-events:none}
|
|
308
|
+
.bn-diag-kicker{font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:#d4f07a;font-weight:700}
|
|
309
|
+
.bn-diag-hero h2{margin:6px 0 0;font-size:20px;line-height:1.35;letter-spacing:-.02em;font-weight:700;max-width:30em}
|
|
310
|
+
.bn-diag-hero p{margin:7px 0 0;font-size:12.5px;line-height:1.65;color:rgba(244,241,234,.72);max-width:52em}
|
|
311
|
+
.bn-diag-values{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
|
|
312
|
+
.bn-diag-values span{display:inline-flex;align-items:center;gap:6px;border:1px solid rgba(212,240,122,.3);background:rgba(212,240,122,.1);color:#e8f7b8;border-radius:999px;padding:4px 10px;font-size:11px;font-weight:600}
|
|
313
|
+
.bn-diag-values b{font-weight:800;color:#d4f07a}
|
|
314
|
+
.bn-diag-hero-side{flex:none;display:flex;flex-direction:column;gap:6px;align-items:flex-end;position:relative;z-index:1}
|
|
315
|
+
.bn-diag-hero-side .bn-chip{border-color:rgba(212,240,122,.4);color:#d4f07a;background:rgba(212,240,122,.12)}
|
|
316
|
+
.bn-diag-work{padding:20px 22px}
|
|
317
|
+
.bn-diag-block-head{display:flex;align-items:baseline;gap:10px;margin-bottom:12px;flex-wrap:wrap}
|
|
318
|
+
.bn-diag-block-head h2{margin:0;font-size:15px}
|
|
319
|
+
.bn-diag-block-head span{font-size:11.5px;color:var(--bn-faint)}
|
|
320
|
+
.bn-drop{border:1.5px dashed var(--bn-line-strong);border-radius:14px;padding:26px 18px;text-align:center;cursor:pointer;background:var(--bn-surface-2);transition:border-color .15s,background .15s,transform .15s}
|
|
321
|
+
.bn-drop:hover,.bn-drop.hot{border-color:var(--bn-accent-deep);background:var(--bn-accent-soft);transform:translateY(-1px)}
|
|
322
|
+
.bn-drop-ico{width:46px;height:46px;border-radius:13px;margin:0 auto 10px;display:grid;place-items:center;background:var(--bn-ink);color:var(--bn-accent);font-size:22px;line-height:1;box-shadow:inset 0 0 0 2px var(--bn-accent)}
|
|
323
|
+
.bn-drop b{display:block;font-size:13.5px}
|
|
324
|
+
.bn-drop small{display:block;margin-top:4px;font-size:11.5px;color:var(--bn-muted);line-height:1.55}
|
|
325
|
+
.bn-media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px;margin-top:12px}
|
|
326
|
+
.bn-media{position:relative;border:1px solid var(--bn-line);border-radius:12px;overflow:hidden;background:var(--bn-surface)}
|
|
327
|
+
.bn-media img,.bn-media video{display:block;width:100%;height:82px;object-fit:cover;background:var(--bn-line)}
|
|
328
|
+
.bn-media-ph{display:grid;place-items:center;height:82px;background:linear-gradient(135deg,var(--bn-line),var(--bn-surface-2));color:var(--bn-muted);font-size:11.5px}
|
|
329
|
+
.bn-media-info{padding:7px 9px;display:flex;align-items:center;gap:6px}
|
|
330
|
+
.bn-media-name{min-width:0;flex:1;font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
331
|
+
.bn-media-size{font-size:10.5px;color:var(--bn-faint);flex:none}
|
|
332
|
+
.bn-media-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;font-size:13px;line-height:1;cursor:pointer;display:grid;place-items:center}
|
|
333
|
+
.bn-media-x:hover{background:var(--bn-bad)}
|
|
334
|
+
.bn-diag-label{margin:14px 0 6px;font-size:11.5px;color:var(--bn-muted);font-weight:600}
|
|
335
|
+
.bn-diag-text{width:100%;height:auto;min-height:84px;resize:vertical;font-family:var(--bn-font);line-height:1.65}
|
|
336
|
+
.bn-diag-cta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px;padding-top:14px;border-top:1px solid var(--bn-line)}
|
|
337
|
+
.bn-diag-cta .bn-btn.primary{height:38px;padding:0 20px;border-radius:10px;font-size:13px;font-weight:650}
|
|
338
|
+
.bn-diag-cta small{font-size:11px;color:var(--bn-faint);line-height:1.5}
|
|
339
|
+
.bn-diag-status{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:3px 9px;font-size:11px;background:var(--bn-surface-2);border:1px solid var(--bn-line);color:var(--bn-muted)}
|
|
340
|
+
.bn-diag-status:before{content:'';width:6px;height:6px;border-radius:50%;background:var(--bn-faint)}
|
|
341
|
+
.bn-diag-status.live{color:var(--bn-warn);border-color:var(--bn-warn);background:var(--bn-warn-soft)}
|
|
342
|
+
.bn-diag-status.live:before{background:var(--bn-warn);animation:bn-pulse 1.2s infinite}
|
|
343
|
+
.bn-diag-status.ok{color:var(--bn-ok);border-color:var(--bn-ok);background:var(--bn-ok-soft)}
|
|
344
|
+
.bn-diag-status.ok:before{background:var(--bn-ok)}
|
|
345
|
+
@keyframes bn-pulse{0%,100%{opacity:1}50%{opacity:.3}}
|
|
346
|
+
.bn-archive{display:grid;grid-template-columns:repeat(auto-fill,minmax(236px,1fr));gap:10px}
|
|
347
|
+
.bn-archive-item{position:relative;border:1px solid var(--bn-line);border-radius:12px;padding:12px 12px 10px;background:var(--bn-surface);cursor:pointer;transition:box-shadow .15s,border-color .15s,transform .1s}
|
|
348
|
+
.bn-archive-item:hover{box-shadow:var(--bn-shadow);border-color:var(--bn-line-strong);transform:translateY(-1px)}
|
|
349
|
+
.bn-archive-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
350
|
+
.bn-archive-kind{font-size:10.5px;color:var(--bn-faint);letter-spacing:.04em}
|
|
351
|
+
.bn-archive-title{margin-top:6px;font-size:13px;font-weight:650;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
352
|
+
.bn-archive-meta{margin-top:5px;font-size:11px;color:var(--bn-muted);display:flex;gap:6px;align-items:center;min-width:0}
|
|
353
|
+
.bn-archive-del{position:absolute;right:8px;bottom:8px;opacity:0;transition:opacity .15s}
|
|
354
|
+
.bn-archive-item:hover .bn-archive-del{opacity:1}
|
|
355
|
+
.bn-empty{padding:26px 18px;text-align:center;border:1px dashed var(--bn-line-strong);border-radius:12px;color:var(--bn-faint);font-size:12px;line-height:1.7;white-space:pre-line}
|
|
356
|
+
.bn-diag-upsell{display:flex;gap:24px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding:24px;border-radius:var(--bn-r);border:1px solid var(--bn-line);background:radial-gradient(320px 160px at 0% 0%,var(--bn-accent-soft),transparent 70%),var(--bn-surface);box-shadow:var(--bn-shadow)}
|
|
357
|
+
.bn-diag-upsell h2{margin:0;font-size:18px;letter-spacing:-.01em}
|
|
358
|
+
.bn-diag-upsell p{margin:6px 0 0;font-size:12.5px;color:var(--bn-muted);line-height:1.65;max-width:46em}
|
|
359
|
+
.bn-diag-upsell ul{margin:12px 0 0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:8px}
|
|
360
|
+
.bn-diag-upsell li{font-size:11.5px;color:var(--bn-ink-2);background:var(--bn-surface-2);border:1px solid var(--bn-line);border-radius:999px;padding:4px 10px}
|
|
361
|
+
.bn-diag-upsell li:before{content:'✓';color:var(--bn-ok);margin-right:5px;font-weight:700}
|
|
362
|
+
@media (max-width:720px){
|
|
363
|
+
.bn-diag-hero{flex-direction:column;gap:12px;padding:18px}
|
|
364
|
+
.bn-diag-hero h2{font-size:18px}
|
|
365
|
+
.bn-diag-hero-side{align-items:flex-start}
|
|
366
|
+
.bn-diag-work{padding:16px}
|
|
367
|
+
}
|
|
284
368
|
.bn-activate .bn-dd{flex:0 1 280px;width:280px;min-width:180px;max-width:320px;height:36px}
|
|
285
|
-
.bn-activate .bn-input{flex:1 1 220px;width:auto;min-width:160px;max-width:none;height:36px}
|
|
369
|
+
.bn-activate .bn-input:not(textarea){flex:1 1 220px;width:auto;min-width:160px;max-width:none;height:36px}
|
|
286
370
|
.bn-activate .bn-dd-trigger,.bn-activate .bn-btn{height:36px;max-height:36px;overflow:hidden}
|
|
287
371
|
@media (max-width:720px){
|
|
288
372
|
.bn-activate{flex-wrap:wrap}
|
|
@@ -345,6 +429,7 @@
|
|
|
345
429
|
key: 'M21 2l-2 2m-7.6 7.6a5 5 0 11-7 7 5 5 0 017-7zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3-3.5 3.5z',
|
|
346
430
|
chat: 'M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z',
|
|
347
431
|
book: 'M6 3h9l5 5v13H6zM15 3v5h5M9 13h6M9 17h6',
|
|
432
|
+
lock: 'M7 10V7a5 5 0 0110 0v3M5 10h14v10H5z',
|
|
348
433
|
};
|
|
349
434
|
return { tag: 'svg', props: { width: s, height: s, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.7, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, children: [{ tag: 'path', props: { d: paths[name] || paths.grid }, children: [] }] };
|
|
350
435
|
}
|
|
@@ -389,6 +474,7 @@
|
|
|
389
474
|
if (!res.ok) {
|
|
390
475
|
const err = new Error((data && data.error) || res.statusText);
|
|
391
476
|
if (data && data.code) err.code = data.code;
|
|
477
|
+
if (data && data.promptText) err.promptText = data.promptText;
|
|
392
478
|
throw err;
|
|
393
479
|
}
|
|
394
480
|
return data;
|
|
@@ -645,8 +731,52 @@
|
|
|
645
731
|
const confirmLock = useRef(false);
|
|
646
732
|
const [keyInput, setKeyInput] = useState('');
|
|
647
733
|
const [productInput, setProductInput] = useState('biutalk');
|
|
734
|
+
const [activateResult, setActivateResult] = useState(null);
|
|
648
735
|
const [lookupEmail, setLookupEmail] = useState('');
|
|
649
736
|
const [lookupResult, setLookupResult] = useState(null);
|
|
737
|
+
const [diagText, setDiagText] = useState('');
|
|
738
|
+
const [diagSnap, setDiagSnap] = useState(null);
|
|
739
|
+
const [diagMedia, setDiagMedia] = useState([]);
|
|
740
|
+
const [diagUploading, setDiagUploading] = useState(false);
|
|
741
|
+
const [diagHot, setDiagHot] = useState(false);
|
|
742
|
+
const [diagAnalysis, setDiagAnalysis] = useState('');
|
|
743
|
+
const [diagSession, setDiagSession] = useState('');
|
|
744
|
+
const [diagProject, setDiagProject] = useState('');
|
|
745
|
+
const [diagPrompt, setDiagPrompt] = useState('');
|
|
746
|
+
const [diagBusy, setDiagBusy] = useState('');
|
|
747
|
+
const [diagErr, setDiagErr] = useState('');
|
|
748
|
+
const [diagReports, setDiagReports] = useState([]);
|
|
749
|
+
const diagFileRef = useRef(null);
|
|
750
|
+
const researchFileRef = useRef(null);
|
|
751
|
+
const [diagView, setDiagView] = useState('diagnose');
|
|
752
|
+
const [growth, setGrowth] = useState(() => ({
|
|
753
|
+
research: {
|
|
754
|
+
input: { accounts: '', links: '', positioning: '', notes: '' },
|
|
755
|
+
media: [], reports: [], analysis: '', sessionId: '', projectPath: '', promptText: '', recordId: '',
|
|
756
|
+
busy: '', error: '', uploading: false, hot: false,
|
|
757
|
+
},
|
|
758
|
+
planner: {
|
|
759
|
+
input: {
|
|
760
|
+
diagnosisId: null, positioning: '', frequency: '3', notes: '',
|
|
761
|
+
startDate: new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, 10),
|
|
762
|
+
},
|
|
763
|
+
media: [], reports: [], analysis: '', sessionId: '', projectPath: '', promptText: '', recordId: '',
|
|
764
|
+
busy: '', error: '', uploading: false, hot: false,
|
|
765
|
+
},
|
|
766
|
+
followup: {
|
|
767
|
+
input: { baselineId: null, currentId: null, notes: '' },
|
|
768
|
+
media: [], reports: [], analysis: '', sessionId: '', projectPath: '', promptText: '', recordId: '',
|
|
769
|
+
busy: '', error: '', uploading: false, hot: false,
|
|
770
|
+
},
|
|
771
|
+
}));
|
|
772
|
+
const growthPatch = (kind, patch) => setGrowth((current) => ({
|
|
773
|
+
...current,
|
|
774
|
+
[kind]: { ...current[kind], ...(typeof patch === 'function' ? patch(current[kind]) : patch) },
|
|
775
|
+
}));
|
|
776
|
+
const growthInput = (kind, key, value) => setGrowth((current) => ({
|
|
777
|
+
...current,
|
|
778
|
+
[kind]: { ...current[kind], input: { ...current[kind].input, [key]: value } },
|
|
779
|
+
}));
|
|
650
780
|
const [studioAgentId, setStudioAgentId] = useState(null);
|
|
651
781
|
const [pendingPerm, setPendingPerm] = useState(null);
|
|
652
782
|
const [contactOpen, setContactOpen] = useState(false);
|
|
@@ -687,6 +817,100 @@
|
|
|
687
817
|
return () => clearInterval(timer);
|
|
688
818
|
}, [campaignCount]);
|
|
689
819
|
useEffect(() => { if (!toast) return undefined; const t = setTimeout(() => setToast(null), toast.bad ? 12000 : 3200); return () => clearTimeout(t); }, [toast]);
|
|
820
|
+
useEffect(() => {
|
|
821
|
+
if (tab !== 'diagnose') return undefined;
|
|
822
|
+
let alive = true;
|
|
823
|
+
api('/diagnose/reports')
|
|
824
|
+
.then((data) => {
|
|
825
|
+
if (!alive) return;
|
|
826
|
+
const rows = Array.isArray(data.reports) ? data.reports : [];
|
|
827
|
+
setDiagReports(rows);
|
|
828
|
+
})
|
|
829
|
+
.catch(() => { /* 存档读不到不影响抓取 */ });
|
|
830
|
+
return () => { alive = false; };
|
|
831
|
+
}, [tab]);
|
|
832
|
+
useEffect(() => {
|
|
833
|
+
const completed = diagReports.filter((row) => String(row.analysis || '').trim());
|
|
834
|
+
const valid = (id) => completed.some((row) => row.id === id);
|
|
835
|
+
setGrowth((current) => {
|
|
836
|
+
const plannerId = current.planner.input.diagnosisId;
|
|
837
|
+
const baselineId = current.followup.input.baselineId;
|
|
838
|
+
const currentId = current.followup.input.currentId;
|
|
839
|
+
const nextPlanner = plannerId === null ? (completed[0]?.id || null) : (valid(plannerId) ? plannerId : '');
|
|
840
|
+
const nextBaseline = baselineId === null ? (completed[1]?.id || null) : (valid(baselineId) ? baselineId : '');
|
|
841
|
+
const nextCurrent = currentId === null ? (completed[0]?.id || null) : (valid(currentId) ? currentId : '');
|
|
842
|
+
if (nextPlanner === plannerId && nextBaseline === baselineId && nextCurrent === currentId) return current;
|
|
843
|
+
return {
|
|
844
|
+
...current,
|
|
845
|
+
planner: { ...current.planner, input: { ...current.planner.input, diagnosisId: nextPlanner } },
|
|
846
|
+
followup: {
|
|
847
|
+
...current.followup,
|
|
848
|
+
input: { ...current.followup.input, baselineId: nextBaseline, currentId: nextCurrent },
|
|
849
|
+
},
|
|
850
|
+
};
|
|
851
|
+
});
|
|
852
|
+
}, [diagReports]);
|
|
853
|
+
useEffect(() => {
|
|
854
|
+
if (tab !== 'diagnose' || diagView === 'diagnose') return undefined;
|
|
855
|
+
const kind = diagView;
|
|
856
|
+
let alive = true;
|
|
857
|
+
api('/growth/reports?kind=' + encodeURIComponent(kind))
|
|
858
|
+
.then((data) => {
|
|
859
|
+
if (alive) growthPatch(kind, { reports: Array.isArray(data.reports) ? data.reports : [] });
|
|
860
|
+
})
|
|
861
|
+
.catch((error) => { if (alive) growthPatch(kind, { error: error.message || '读取本地档案失败' }); });
|
|
862
|
+
return () => { alive = false; };
|
|
863
|
+
}, [tab, diagView]);
|
|
864
|
+
// 分析回填:模型把结论写到会话目录 report.md,面板按 sessionId 取回。
|
|
865
|
+
useEffect(() => {
|
|
866
|
+
if (tab !== 'diagnose' || !diagSession || diagAnalysis) return undefined;
|
|
867
|
+
let alive = true;
|
|
868
|
+
const tick = async () => {
|
|
869
|
+
try {
|
|
870
|
+
const data = await api('/diagnose/session-report?sessionId=' + encodeURIComponent(diagSession));
|
|
871
|
+
if (!alive || !data.report || !data.report.analysis) return;
|
|
872
|
+
setDiagAnalysis(String(data.report.analysis));
|
|
873
|
+
setDiagReports((rows) => rows.map((row) => (row.id === data.report.id ? data.report : row)));
|
|
874
|
+
setToast({ text: '分析已回填到面板' });
|
|
875
|
+
} catch {
|
|
876
|
+
/* 还没写完,下一轮再取 */
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
const timer = setInterval(tick, 5000);
|
|
880
|
+
tick();
|
|
881
|
+
return () => { alive = false; clearInterval(timer); };
|
|
882
|
+
}, [tab, diagSession, diagAnalysis]);
|
|
883
|
+
useEffect(() => {
|
|
884
|
+
if (tab !== 'diagnose' || diagView === 'diagnose') return undefined;
|
|
885
|
+
const kind = diagView;
|
|
886
|
+
const current = growth[kind];
|
|
887
|
+
if (!current.sessionId || current.analysis) return undefined;
|
|
888
|
+
let alive = true;
|
|
889
|
+
const tick = async () => {
|
|
890
|
+
try {
|
|
891
|
+
const data = await api('/growth/session-report?sessionId=' + encodeURIComponent(current.sessionId));
|
|
892
|
+
if (!alive || !data.report || !String(data.report.analysis || '').trim()) return;
|
|
893
|
+
setGrowth((all) => {
|
|
894
|
+
const item = all[kind];
|
|
895
|
+
return {
|
|
896
|
+
...all,
|
|
897
|
+
[kind]: {
|
|
898
|
+
...item,
|
|
899
|
+
analysis: String(data.report.analysis || ''),
|
|
900
|
+
recordId: String(data.report.id || item.recordId || ''),
|
|
901
|
+
reports: [data.report, ...item.reports.filter((row) => row.id !== data.report.id)].slice(0, 60),
|
|
902
|
+
},
|
|
903
|
+
};
|
|
904
|
+
});
|
|
905
|
+
setToast({ text: '结果已回填到面板' });
|
|
906
|
+
} catch {
|
|
907
|
+
/* 模型尚未写完,下一轮继续读取本机 report.md */
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
const timer = setInterval(tick, 5000);
|
|
911
|
+
tick();
|
|
912
|
+
return () => { alive = false; clearInterval(timer); };
|
|
913
|
+
}, [tab, diagView, growth[diagView]?.sessionId, growth[diagView]?.analysis]);
|
|
690
914
|
useEffect(() => {
|
|
691
915
|
if (!contactOpen) return;
|
|
692
916
|
const onKey = (ev) => { if (ev.key === 'Escape') setContactOpen(false); };
|
|
@@ -831,6 +1055,377 @@
|
|
|
831
1055
|
throw new Error('任务超时,请到「任务」查看');
|
|
832
1056
|
};
|
|
833
1057
|
|
|
1058
|
+
/** 一行一个:优先按「产品 KEY」拆;只有 KEY 时用下拉里选的产品。 */
|
|
1059
|
+
const parseKeys = (text) => String(text || '')
|
|
1060
|
+
.split(/\r?\n/)
|
|
1061
|
+
.map((line) => line.trim())
|
|
1062
|
+
.filter(Boolean)
|
|
1063
|
+
.map((line) => {
|
|
1064
|
+
const pair = line.match(/^([A-Za-z][A-Za-z0-9._-]*)\s+(\S+)$/);
|
|
1065
|
+
if (pair) return { line, product: pair[1].toLowerCase(), key: pair[2].toUpperCase() };
|
|
1066
|
+
return { line, product: productInput, key: line.toUpperCase() };
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
const activateKeys = () => act(async () => {
|
|
1070
|
+
const rows = parseKeys(keyInput);
|
|
1071
|
+
if (!rows.length) throw new Error('请先粘贴激活码');
|
|
1072
|
+
const ok = [];
|
|
1073
|
+
const failed = [];
|
|
1074
|
+
for (const row of rows) {
|
|
1075
|
+
try {
|
|
1076
|
+
await api('/activate', { method: 'POST', body: { key: row.key, product: row.product } });
|
|
1077
|
+
ok.push(row.product);
|
|
1078
|
+
} catch (err) {
|
|
1079
|
+
failed.push({ ...row, error: err.message });
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
setActivateResult({ ok, failed });
|
|
1083
|
+
setKeyInput(failed.map((row) => row.line).join('\n'));
|
|
1084
|
+
if (!failed.length) return ok.length > 1 ? '已激活 ' + ok.length + ' 个产品' : '已激活 ' + ok[0];
|
|
1085
|
+
if (!ok.length) throw new Error(failed[0].error);
|
|
1086
|
+
return '成功 ' + ok.length + ' 个,失败 ' + failed.length + ' 个(失败行已保留)';
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
const uploadDiagFiles = async (source, target = 'diagnose') => {
|
|
1090
|
+
const input = source && source.target ? source.target : null;
|
|
1091
|
+
const files = Array.from((input ? input.files : source) || []);
|
|
1092
|
+
if (input) input.value = '';
|
|
1093
|
+
if (!files.length) return;
|
|
1094
|
+
const setUploading = (value) => target === 'research' ? growthPatch('research', { uploading: value }) : setDiagUploading(value);
|
|
1095
|
+
const setUploadError = (value) => target === 'research' ? growthPatch('research', { error: value }) : setDiagErr(value);
|
|
1096
|
+
setUploading(true);
|
|
1097
|
+
setUploadError('');
|
|
1098
|
+
const added = [];
|
|
1099
|
+
for (const file of files) {
|
|
1100
|
+
const video = file.type.indexOf('video/') === 0 || /\.(mp4|mov|m4v|webm|avi|mkv)$/i.test(file.name);
|
|
1101
|
+
const image = file.type.indexOf('image/') === 0 || /\.(jpe?g|png|webp|gif|bmp|heic)$/i.test(file.name);
|
|
1102
|
+
if (!video && !image) {
|
|
1103
|
+
setUploadError('只支持图片或视频:' + file.name);
|
|
1104
|
+
continue;
|
|
1105
|
+
}
|
|
1106
|
+
if (file.size > 300 * 1024 * 1024) {
|
|
1107
|
+
setUploadError(file.name + ' 超过 300MB');
|
|
1108
|
+
continue;
|
|
1109
|
+
}
|
|
1110
|
+
try {
|
|
1111
|
+
const res = await fetch(BASE + '/diagnose/upload?name=' + encodeURIComponent(file.name), {
|
|
1112
|
+
method: 'POST',
|
|
1113
|
+
headers: { 'content-type': file.type || 'application/octet-stream' },
|
|
1114
|
+
body: file,
|
|
1115
|
+
});
|
|
1116
|
+
const data = await res.json().catch(() => ({}));
|
|
1117
|
+
if (!res.ok) throw new Error(data.error || '上传失败');
|
|
1118
|
+
added.push({ ...data.media, previewUrl: image ? URL.createObjectURL(file) : '' });
|
|
1119
|
+
} catch (err) {
|
|
1120
|
+
setUploadError(err.message || ('上传失败:' + file.name));
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
if (added.length) {
|
|
1124
|
+
if (target === 'research') {
|
|
1125
|
+
growthPatch('research', (current) => ({ media: [...current.media, ...added].slice(0, 12) }));
|
|
1126
|
+
} else {
|
|
1127
|
+
setDiagMedia((rows) => [...rows, ...added].slice(0, 12));
|
|
1128
|
+
setDiagSnap((prev) => prev || {
|
|
1129
|
+
title: added[0].name,
|
|
1130
|
+
kind: 'upload',
|
|
1131
|
+
media: added.map((item) => item.name),
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
setUploading(false);
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
const removeDiagMedia = (id) => setDiagMedia((rows) => rows.filter((row) => row.id !== id));
|
|
1139
|
+
|
|
1140
|
+
const openDiagSession = () => {
|
|
1141
|
+
if (!diagSession) return;
|
|
1142
|
+
if (!revealCreationSession) {
|
|
1143
|
+
setToast({ text: '请到 DSH 会话列表里找「账号体检」', bad: true });
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
try {
|
|
1147
|
+
revealCreationSession(diagSession);
|
|
1148
|
+
} catch {
|
|
1149
|
+
setToast({ text: '暂时切不过去,请到会话列表里找', bad: true });
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
const runDiagSession = async () => {
|
|
1154
|
+
if (!diagSnap && !diagMedia.length) {
|
|
1155
|
+
setDiagErr('请先上传后台截图或视频');
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
setDiagBusy('session');
|
|
1159
|
+
setDiagErr('');
|
|
1160
|
+
try {
|
|
1161
|
+
const data = await api('/diagnose/session', {
|
|
1162
|
+
method: 'POST',
|
|
1163
|
+
body: {
|
|
1164
|
+
snapshot: diagSnap || undefined,
|
|
1165
|
+
media: diagMedia.map(({ id, name, kind, size }) => ({ id, name, kind, size })),
|
|
1166
|
+
},
|
|
1167
|
+
});
|
|
1168
|
+
const snapshot = diagSnap || {
|
|
1169
|
+
title: (diagMedia[0] && diagMedia[0].name) || '未命名体检',
|
|
1170
|
+
kind: 'upload',
|
|
1171
|
+
media: diagMedia.map((item) => item.name),
|
|
1172
|
+
};
|
|
1173
|
+
if (!diagSnap) setDiagSnap(snapshot);
|
|
1174
|
+
setDiagSession(String(data.sessionId || ''));
|
|
1175
|
+
setDiagProject(String(data.projectPath || ''));
|
|
1176
|
+
setDiagPrompt(String(data.promptText || ''));
|
|
1177
|
+
// 先存档再切会话:切走后面板可能重挂载,快照和 sessionId 不能只留在内存里。
|
|
1178
|
+
let archived = false;
|
|
1179
|
+
try {
|
|
1180
|
+
const saved = await api('/diagnose/reports', {
|
|
1181
|
+
method: 'POST',
|
|
1182
|
+
body: {
|
|
1183
|
+
snapshot,
|
|
1184
|
+
analysis: diagAnalysis,
|
|
1185
|
+
sessionId: data.sessionId,
|
|
1186
|
+
projectPath: data.projectPath,
|
|
1187
|
+
media: data.media || diagMedia,
|
|
1188
|
+
},
|
|
1189
|
+
});
|
|
1190
|
+
if (saved.report) {
|
|
1191
|
+
setDiagReports((rows) => [saved.report, ...rows].slice(0, 50));
|
|
1192
|
+
archived = true;
|
|
1193
|
+
}
|
|
1194
|
+
} catch {
|
|
1195
|
+
/* 存档失败不影响分析会话语义 */
|
|
1196
|
+
}
|
|
1197
|
+
// 旧分析已入档,清空以允许新一轮 report.md 回填。
|
|
1198
|
+
if (archived) setDiagAnalysis('');
|
|
1199
|
+
if (data.sessionId) {
|
|
1200
|
+
try {
|
|
1201
|
+
if (revealCreationSession) revealCreationSession(data.sessionId);
|
|
1202
|
+
} catch {
|
|
1203
|
+
/* 会话已建好,切不过去也能从列表进入 */
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
setToast({ text: '已开分析会话;结果写成 report.md 后会自动回填,也可以手动粘贴' });
|
|
1207
|
+
} catch (err) {
|
|
1208
|
+
if (err.promptText) setDiagPrompt(String(err.promptText));
|
|
1209
|
+
setDiagErr(err.message || '开不了 DSH 会话');
|
|
1210
|
+
} finally {
|
|
1211
|
+
setDiagBusy('');
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1215
|
+
const saveDiagnose = async () => {
|
|
1216
|
+
if (!diagSnap && !diagMedia.length) return;
|
|
1217
|
+
try {
|
|
1218
|
+
const data = await api('/diagnose/reports', {
|
|
1219
|
+
method: 'POST',
|
|
1220
|
+
body: {
|
|
1221
|
+
snapshot: diagSnap || { title: (diagMedia[0] && diagMedia[0].name) || '未命名体检', kind: 'upload' },
|
|
1222
|
+
analysis: diagAnalysis,
|
|
1223
|
+
sessionId: diagSession,
|
|
1224
|
+
projectPath: diagProject,
|
|
1225
|
+
media: diagMedia,
|
|
1226
|
+
},
|
|
1227
|
+
});
|
|
1228
|
+
if (data.report) setDiagReports((rows) => [data.report, ...rows].slice(0, 50));
|
|
1229
|
+
setToast({ text: '报告已保存到本机' });
|
|
1230
|
+
} catch (err) {
|
|
1231
|
+
setToast({ text: err.message || '保存失败', bad: true });
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
const openDiagReport = (report) => {
|
|
1236
|
+
if (!report || !report.snapshot) return;
|
|
1237
|
+
setDiagSnap(report.snapshot);
|
|
1238
|
+
setDiagMedia((Array.isArray(report.media) ? report.media : []).map((item) => ({
|
|
1239
|
+
...item,
|
|
1240
|
+
previewUrl: item.kind === 'image' ? BASE + '/diagnose/media/' + item.id : '',
|
|
1241
|
+
})));
|
|
1242
|
+
setDiagAnalysis(String(report.analysis || ''));
|
|
1243
|
+
setDiagSession(String(report.sessionId || ''));
|
|
1244
|
+
setDiagProject(String(report.projectPath || ''));
|
|
1245
|
+
setDiagPrompt('');
|
|
1246
|
+
setDiagErr('');
|
|
1247
|
+
setDiagText('');
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
const removeDiagReport = (report) => setConfirm({
|
|
1251
|
+
title: '删除这份诊断?',
|
|
1252
|
+
hint: report.title || '已保存的诊断报告',
|
|
1253
|
+
confirmLabel: '删除',
|
|
1254
|
+
run: () => act(async () => {
|
|
1255
|
+
await api('/diagnose/reports/delete', { method: 'POST', body: { id: report.id } });
|
|
1256
|
+
setDiagReports((rows) => rows.filter((row) => row.id !== report.id));
|
|
1257
|
+
}, '已删除'),
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
const growthLabels = { research: '对标调研', planner: '选题规划', followup: '复诊对比' };
|
|
1261
|
+
const growthLinks = (kind, input) => kind === 'planner'
|
|
1262
|
+
? { diagnosisId: input.diagnosisId || '' }
|
|
1263
|
+
: kind === 'followup'
|
|
1264
|
+
? { baselineId: input.baselineId || '', currentId: input.currentId || '' }
|
|
1265
|
+
: {};
|
|
1266
|
+
|
|
1267
|
+
const runGrowthSession = async (kind) => {
|
|
1268
|
+
const current = growth[kind];
|
|
1269
|
+
const input = current.input;
|
|
1270
|
+
let validation = '';
|
|
1271
|
+
if (kind === 'research' && !String(input.accounts || '').trim()) validation = '请先填写至少一个对标账号名';
|
|
1272
|
+
if (kind === 'planner' && !input.diagnosisId && !String(input.positioning || '').trim()) validation = '请选择号脉报告,或填写账号定位';
|
|
1273
|
+
if (kind === 'followup' && (!input.baselineId || !input.currentId)) validation = '请选择基线号脉和本次号脉';
|
|
1274
|
+
if (kind === 'followup' && input.baselineId && input.baselineId === input.currentId) validation = '复诊需要选择两份不同的号脉报告';
|
|
1275
|
+
if (validation) {
|
|
1276
|
+
growthPatch(kind, { error: validation });
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
growthPatch(kind, { busy: 'session', error: '' });
|
|
1280
|
+
try {
|
|
1281
|
+
const data = await api('/growth/session', {
|
|
1282
|
+
method: 'POST',
|
|
1283
|
+
body: {
|
|
1284
|
+
kind,
|
|
1285
|
+
input,
|
|
1286
|
+
media: kind === 'research' ? current.media.map(({ id, name, kind: mediaKind, size }) => ({ id, name, kind: mediaKind, size })) : [],
|
|
1287
|
+
},
|
|
1288
|
+
});
|
|
1289
|
+
setGrowth((all) => {
|
|
1290
|
+
const item = all[kind];
|
|
1291
|
+
const record = data.record || null;
|
|
1292
|
+
return {
|
|
1293
|
+
...all,
|
|
1294
|
+
[kind]: {
|
|
1295
|
+
...item,
|
|
1296
|
+
sessionId: String(data.sessionId || ''),
|
|
1297
|
+
projectPath: String(data.projectPath || ''),
|
|
1298
|
+
promptText: String(data.promptText || ''),
|
|
1299
|
+
recordId: String(record?.id || ''),
|
|
1300
|
+
analysis: '',
|
|
1301
|
+
reports: record ? [record, ...item.reports.filter((row) => row.id !== record.id)].slice(0, 60) : item.reports,
|
|
1302
|
+
},
|
|
1303
|
+
};
|
|
1304
|
+
});
|
|
1305
|
+
if (data.sessionId && revealCreationSession) {
|
|
1306
|
+
try { revealCreationSession(data.sessionId); } catch { /* 可从 DSH 会话列表进入 */ }
|
|
1307
|
+
}
|
|
1308
|
+
setToast({ text: '已开' + growthLabels[kind] + '会话;report.md 写好后会自动回填' });
|
|
1309
|
+
} catch (error) {
|
|
1310
|
+
growthPatch(kind, {
|
|
1311
|
+
error: error.message || '开不了 DSH 会话',
|
|
1312
|
+
promptText: String(error.promptText || current.promptText || ''),
|
|
1313
|
+
});
|
|
1314
|
+
} finally {
|
|
1315
|
+
growthPatch(kind, { busy: '' });
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1319
|
+
const saveGrowth = async (kind) => {
|
|
1320
|
+
const current = growth[kind];
|
|
1321
|
+
if (!String(current.analysis || '').trim()) return;
|
|
1322
|
+
try {
|
|
1323
|
+
const data = await api('/growth/reports', {
|
|
1324
|
+
method: 'POST',
|
|
1325
|
+
body: {
|
|
1326
|
+
kind,
|
|
1327
|
+
id: current.recordId || undefined,
|
|
1328
|
+
input: current.input,
|
|
1329
|
+
analysis: current.analysis,
|
|
1330
|
+
sessionId: current.sessionId,
|
|
1331
|
+
projectPath: current.projectPath,
|
|
1332
|
+
media: current.media.map(({ id, name, kind: mediaKind, size }) => ({ id, name, kind: mediaKind, size })),
|
|
1333
|
+
links: growthLinks(kind, current.input),
|
|
1334
|
+
},
|
|
1335
|
+
});
|
|
1336
|
+
if (data.report) {
|
|
1337
|
+
setGrowth((all) => {
|
|
1338
|
+
const item = all[kind];
|
|
1339
|
+
return {
|
|
1340
|
+
...all,
|
|
1341
|
+
[kind]: {
|
|
1342
|
+
...item,
|
|
1343
|
+
recordId: String(data.report.id || ''),
|
|
1344
|
+
reports: [data.report, ...item.reports.filter((row) => row.id !== data.report.id)].slice(0, 60),
|
|
1345
|
+
},
|
|
1346
|
+
};
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
setToast({ text: growthLabels[kind] + '已保存到本机' });
|
|
1350
|
+
} catch (error) {
|
|
1351
|
+
growthPatch(kind, { error: error.message || '保存失败' });
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
const openGrowthRecord = (kind, report) => {
|
|
1356
|
+
if (!report) return;
|
|
1357
|
+
growthPatch(kind, (current) => ({
|
|
1358
|
+
input: { ...current.input, ...(report.input || {}) },
|
|
1359
|
+
analysis: String(report.analysis || ''),
|
|
1360
|
+
sessionId: String(report.sessionId || ''),
|
|
1361
|
+
projectPath: String(report.projectPath || ''),
|
|
1362
|
+
recordId: String(report.id || ''),
|
|
1363
|
+
promptText: '',
|
|
1364
|
+
error: '',
|
|
1365
|
+
media: (Array.isArray(report.media) ? report.media : []).map((item) => ({
|
|
1366
|
+
...item,
|
|
1367
|
+
previewUrl: item.kind === 'image' ? BASE + '/diagnose/media/' + item.id : '',
|
|
1368
|
+
})),
|
|
1369
|
+
}));
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
const removeGrowthRecord = (kind, report) => setConfirm({
|
|
1373
|
+
title: '删除这份' + growthLabels[kind] + '?',
|
|
1374
|
+
hint: report.title || '已保存的本机报告',
|
|
1375
|
+
confirmLabel: '删除',
|
|
1376
|
+
run: () => act(async () => {
|
|
1377
|
+
await api('/growth/reports/delete', { method: 'POST', body: { kind, id: report.id } });
|
|
1378
|
+
setGrowth((all) => {
|
|
1379
|
+
const item = all[kind];
|
|
1380
|
+
const opened = item.recordId === report.id;
|
|
1381
|
+
return {
|
|
1382
|
+
...all,
|
|
1383
|
+
[kind]: {
|
|
1384
|
+
...item,
|
|
1385
|
+
reports: item.reports.filter((row) => row.id !== report.id),
|
|
1386
|
+
...(opened ? { recordId: '', sessionId: '', projectPath: '', analysis: '', promptText: '' } : {}),
|
|
1387
|
+
},
|
|
1388
|
+
};
|
|
1389
|
+
});
|
|
1390
|
+
}, '已删除'),
|
|
1391
|
+
});
|
|
1392
|
+
|
|
1393
|
+
const openGrowthConversation = (kind) => {
|
|
1394
|
+
const sessionId = growth[kind].sessionId;
|
|
1395
|
+
if (!sessionId) return;
|
|
1396
|
+
if (!revealCreationSession) {
|
|
1397
|
+
setToast({ text: '请到 DSH 会话列表里找「' + growthLabels[kind] + '」', bad: true });
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
try { revealCreationSession(sessionId); }
|
|
1401
|
+
catch { setToast({ text: '暂时切不过去,请到会话列表里找', bad: true }); }
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
const planFromDiagnosis = (report) => {
|
|
1405
|
+
if (!report || !String(report.analysis || '').trim()) return;
|
|
1406
|
+
growthInput('planner', 'diagnosisId', report.id);
|
|
1407
|
+
setDiagView('planner');
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
const followupFromDiagnosis = (report) => {
|
|
1411
|
+
if (!report || !String(report.analysis || '').trim()) return;
|
|
1412
|
+
setGrowth((all) => {
|
|
1413
|
+
const other = diagReports.find((row) => row.id !== report.id && String(row.analysis || '').trim());
|
|
1414
|
+
const previousBaseline = all.followup.input.baselineId;
|
|
1415
|
+
const baselineId = previousBaseline && previousBaseline !== report.id
|
|
1416
|
+
? previousBaseline
|
|
1417
|
+
: (other?.id || '');
|
|
1418
|
+
return {
|
|
1419
|
+
...all,
|
|
1420
|
+
followup: {
|
|
1421
|
+
...all.followup,
|
|
1422
|
+
input: { ...all.followup.input, baselineId, currentId: report.id },
|
|
1423
|
+
},
|
|
1424
|
+
};
|
|
1425
|
+
});
|
|
1426
|
+
setDiagView('followup');
|
|
1427
|
+
};
|
|
1428
|
+
|
|
834
1429
|
const closePlayer = () => {
|
|
835
1430
|
if (document.fullscreenElement && document.exitFullscreen) document.exitFullscreen().catch(() => {});
|
|
836
1431
|
setPlayer(null);
|
|
@@ -1096,6 +1691,27 @@
|
|
|
1096
1691
|
const doc = docs.find((item) => item.id === docId) || docs[0] || null;
|
|
1097
1692
|
const openDocs = () => { setDocBlocked(false); setDocsOpen(true); };
|
|
1098
1693
|
const licenseOn = !!(state.license && (state.license.state === 'active' || state.license.state === 'grace'));
|
|
1694
|
+
const member = state.member || null;
|
|
1695
|
+
const memberOn = !!(member && member.active);
|
|
1696
|
+
const memberCampaign = (state.campaigns || []).find(
|
|
1697
|
+
(c) => c.kind !== 'link' && /会员|年费|年卡|member|vip/i.test(String(c.name || '') + ' ' + String(c.slug || '')),
|
|
1698
|
+
);
|
|
1699
|
+
const memberHref = state.buyUrl
|
|
1700
|
+
? state.buyUrl + (memberCampaign ? (String(state.buyUrl).indexOf('?') >= 0 ? '&' : '?') + 'c=' + encodeURIComponent(memberCampaign.slug) : '')
|
|
1701
|
+
: '';
|
|
1702
|
+
const diagKindLabel = (kind) => kind === 'profile' ? '账号主页' : kind === 'note' ? '图文' : kind === 'text' ? '文案' : kind === 'upload' ? '上传素材' : '视频';
|
|
1703
|
+
const fmtCount = (value) => {
|
|
1704
|
+
if (value == null) return '';
|
|
1705
|
+
if (value >= 10000) return (Math.round(value / 1000) / 10) + 'w';
|
|
1706
|
+
return String(value);
|
|
1707
|
+
};
|
|
1708
|
+
const diagSize = (bytes) => {
|
|
1709
|
+
const size = Number(bytes) || 0;
|
|
1710
|
+
if (size >= 1024 * 1024) return (Math.round(size / 1024 / 102.4) / 10) + 'MB';
|
|
1711
|
+
if (size >= 1024) return Math.round(size / 1024) + 'KB';
|
|
1712
|
+
return size ? size + 'B' : '';
|
|
1713
|
+
};
|
|
1714
|
+
const diagReady = !!(diagMedia.length || diagSnap);
|
|
1099
1715
|
const openManual = () => {
|
|
1100
1716
|
if (!docs.length) {
|
|
1101
1717
|
setToast({ text: '还没有手册', bad: true });
|
|
@@ -1133,12 +1749,273 @@
|
|
|
1133
1749
|
: ''
|
|
1134
1750
|
: '';
|
|
1135
1751
|
|
|
1752
|
+
const completedDiagReports = diagReports.filter((report) => String(report.analysis || '').trim());
|
|
1753
|
+
const growthHeroCopy = {
|
|
1754
|
+
research: {
|
|
1755
|
+
title: '拆透对标,只迁移你能用的结构',
|
|
1756
|
+
desc: '拆解公开信息与真实作品,分清事实和推断,提炼五维内容公式,并明确哪些能借鉴、哪些不能照搬。',
|
|
1757
|
+
values: ['公开事实', '五维公式', '迁移边界', '下周动作'],
|
|
1758
|
+
},
|
|
1759
|
+
planner: {
|
|
1760
|
+
title: '让号脉结论直接变成下周选题',
|
|
1761
|
+
desc: '自动带入选定号脉报告,把诊断结论和真实素材转成日期、钩子、形式、公式卡与检查点都齐全的内容计划。',
|
|
1762
|
+
values: ['自动衔接号脉', '真实素材', '逐条公式卡', '指标检查点'],
|
|
1763
|
+
},
|
|
1764
|
+
followup: {
|
|
1765
|
+
title: '用两次真实号脉,看清改变是否发生',
|
|
1766
|
+
desc: '选择基线和本次号脉,只对同口径指标计算变化,验收此前 30 天目标,再决定处方的保留、停止与新增。',
|
|
1767
|
+
values: ['同口径对照', '变化量', '目标验收', '下阶段处方'],
|
|
1768
|
+
},
|
|
1769
|
+
};
|
|
1770
|
+
const growthHero = (kind) => {
|
|
1771
|
+
const copy = growthHeroCopy[kind];
|
|
1772
|
+
return h('section', { className: 'bn-diag-hero' },
|
|
1773
|
+
h('div', { style: { minWidth: 0 } },
|
|
1774
|
+
h('div', { className: 'bn-diag-kicker' }, memberOn ? '年会员 · ' + growthLabels[kind] : '年会员专属'),
|
|
1775
|
+
h('h2', null, copy.title),
|
|
1776
|
+
h('p', null, copy.desc + ' 素材与报告只存在本机。'),
|
|
1777
|
+
h('div', { className: 'bn-diag-values' }, copy.values.map((value, index) =>
|
|
1778
|
+
h('span', { key: value }, h('b', null, String(index + 1).padStart(2, '0')), value))),
|
|
1779
|
+
),
|
|
1780
|
+
h('div', { className: 'bn-diag-hero-side' }, memberOn
|
|
1781
|
+
? h('span', { className: 'bn-chip ok' }, member.daysLeft ? '剩余 ' + member.daysLeft + ' 天' : '已开通')
|
|
1782
|
+
: h('span', { className: 'bn-chip dim' }, '未开通')),
|
|
1783
|
+
);
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
const growthMedia = (kind) => {
|
|
1787
|
+
const current = growth[kind];
|
|
1788
|
+
if (!current.media.length) return null;
|
|
1789
|
+
return h('div', { className: 'bn-media-grid' }, current.media.map((item) => h('div', { key: item.id, className: 'bn-media' },
|
|
1790
|
+
item.previewUrl ? h('img', { src: item.previewUrl, alt: '' }) : h('div', { className: 'bn-media-ph' }, item.kind === 'video' ? '▶ 视频' : '图片'),
|
|
1791
|
+
h('div', { className: 'bn-media-info' },
|
|
1792
|
+
h('span', { className: 'bn-media-name', title: item.name }, item.name),
|
|
1793
|
+
h('span', { className: 'bn-media-size' }, diagSize(item.size)),
|
|
1794
|
+
),
|
|
1795
|
+
h('button', {
|
|
1796
|
+
className: 'bn-media-x', title: '移除',
|
|
1797
|
+
onClick: (event) => {
|
|
1798
|
+
event.stopPropagation();
|
|
1799
|
+
growthPatch(kind, (itemState) => ({ media: itemState.media.filter((row) => row.id !== item.id) }));
|
|
1800
|
+
},
|
|
1801
|
+
}, '×'),
|
|
1802
|
+
)));
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
const growthResult = (kind) => {
|
|
1806
|
+
const current = growth[kind];
|
|
1807
|
+
if (!current.sessionId && !current.analysis && !current.promptText) return null;
|
|
1808
|
+
return h('section', { className: 'bn-panel' },
|
|
1809
|
+
h('div', { className: 'bn-sec-head' },
|
|
1810
|
+
h('h2', null, growthLabels[kind] + '报告'),
|
|
1811
|
+
h('div', { className: 'bn-sec-actions' },
|
|
1812
|
+
h('span', { className: 'bn-diag-status ' + (current.analysis ? 'ok' : current.sessionId ? 'live' : '') },
|
|
1813
|
+
current.analysis ? '已回填' : current.sessionId ? '分析中' : '手动模式'),
|
|
1814
|
+
),
|
|
1815
|
+
),
|
|
1816
|
+
h('textarea', {
|
|
1817
|
+
className: 'bn-input bn-diag-text', rows: 10,
|
|
1818
|
+
placeholder: '分析完成后自动回填;也可以把结果粘贴到这里保存',
|
|
1819
|
+
value: current.analysis,
|
|
1820
|
+
onChange: (event) => growthPatch(kind, { analysis: event.target.value }),
|
|
1821
|
+
}),
|
|
1822
|
+
h('div', { className: 'bn-diag-cta' },
|
|
1823
|
+
h('button', { className: 'bn-btn primary', disabled: !String(current.analysis || '').trim(), onClick: () => saveGrowth(kind) }, '保存到档案'),
|
|
1824
|
+
current.promptText ? h('button', { className: 'bn-btn', onClick: () => copyPrompt(current.promptText) }, '复制提示词') : null,
|
|
1825
|
+
current.sessionId ? h('button', { className: 'bn-btn ghost', onClick: () => openGrowthConversation(kind) }, '回到分析会话') : null,
|
|
1826
|
+
h('small', null, '报告仅保存在本机;切换档案不会上传素材或内容。'),
|
|
1827
|
+
),
|
|
1828
|
+
);
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
const growthArchive = (kind) => {
|
|
1832
|
+
const reports = growth[kind].reports;
|
|
1833
|
+
return h('section', { className: 'bn-panel' },
|
|
1834
|
+
h('div', { className: 'bn-sec-head' },
|
|
1835
|
+
h('h2', null, growthLabels[kind] + '档案'),
|
|
1836
|
+
h('div', { className: 'bn-sec-actions' }, h('span', { className: 'bn-chip dim' }, String(reports.length))),
|
|
1837
|
+
),
|
|
1838
|
+
reports.length ? h('div', { className: 'bn-archive' }, reports.map((report) => h('article', {
|
|
1839
|
+
key: report.id, className: 'bn-archive-item', onClick: () => openGrowthRecord(kind, report),
|
|
1840
|
+
},
|
|
1841
|
+
h('div', { className: 'bn-archive-top' },
|
|
1842
|
+
h('span', { className: 'bn-archive-kind' }, report.analysis ? '已完成' : report.sessionId ? '待回填' : '手动存档'),
|
|
1843
|
+
h('span', { className: 'bn-archive-kind' }, timeAgo(report.createdAt)),
|
|
1844
|
+
),
|
|
1845
|
+
h('div', { className: 'bn-archive-title' }, report.title || growthLabels[kind]),
|
|
1846
|
+
h('div', { className: 'bn-archive-meta' }, h('span', null, '本机档案 · 点击回看')),
|
|
1847
|
+
h('button', {
|
|
1848
|
+
className: 'bn-btn ghost bn-archive-del',
|
|
1849
|
+
onClick: (event) => { event.stopPropagation(); removeGrowthRecord(kind, report); },
|
|
1850
|
+
}, '删除'),
|
|
1851
|
+
))) : h('div', { className: 'bn-empty' }, '还没有' + growthLabels[kind] + '档案。\n完成一次分析后会存在本机。'),
|
|
1852
|
+
);
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
const researchWorkspace = () => {
|
|
1856
|
+
const current = growth.research;
|
|
1857
|
+
const input = current.input;
|
|
1858
|
+
return h('div', null,
|
|
1859
|
+
growthHero('research'),
|
|
1860
|
+
h('input', {
|
|
1861
|
+
ref: researchFileRef, type: 'file', accept: 'image/*,video/*', multiple: true, style: { display: 'none' },
|
|
1862
|
+
onChange: (event) => uploadDiagFiles(event, 'research'),
|
|
1863
|
+
}),
|
|
1864
|
+
h('section', { className: 'bn-panel bn-diag-work' },
|
|
1865
|
+
h('div', { className: 'bn-diag-block-head' }, h('h2', null, '确定调研对象'), h('span', null, '账号名必填,主页与高播放作品截图越完整,拆解越可靠')),
|
|
1866
|
+
h('div', { className: 'bn-growth-form' },
|
|
1867
|
+
h('div', { className: 'bn-field' }, h('label', null, '对标账号名(必填)'), h('input', {
|
|
1868
|
+
className: 'bn-input', value: input.accounts, placeholder: '多个账号用逗号分隔',
|
|
1869
|
+
onChange: (event) => growthInput('research', 'accounts', event.target.value),
|
|
1870
|
+
})),
|
|
1871
|
+
h('div', { className: 'bn-field' }, h('label', null, '主页链接(可选)'), h('input', {
|
|
1872
|
+
className: 'bn-input', value: input.links, placeholder: '粘贴抖音主页或公开报道链接',
|
|
1873
|
+
onChange: (event) => growthInput('research', 'links', event.target.value),
|
|
1874
|
+
})),
|
|
1875
|
+
h('div', { className: 'bn-field full' }, h('label', null, '你的定位与现有资源(可选,影响可迁移判断)'), h('textarea', {
|
|
1876
|
+
className: 'bn-input', value: input.positioning, placeholder: '例如:给实体店主讲短视频获客;自己一个人拍摄,有真实门店和客户问题',
|
|
1877
|
+
onChange: (event) => growthInput('research', 'positioning', event.target.value),
|
|
1878
|
+
})),
|
|
1879
|
+
),
|
|
1880
|
+
h('div', {
|
|
1881
|
+
className: 'bn-drop' + (current.hot ? ' hot' : ''), style: { marginTop: 12 },
|
|
1882
|
+
onClick: () => { if (!current.uploading && researchFileRef.current) researchFileRef.current.click(); },
|
|
1883
|
+
onDragOver: (event) => { event.preventDefault(); growthPatch('research', { hot: true }); },
|
|
1884
|
+
onDragLeave: () => growthPatch('research', { hot: false }),
|
|
1885
|
+
onDrop: (event) => {
|
|
1886
|
+
event.preventDefault(); growthPatch('research', { hot: false });
|
|
1887
|
+
uploadDiagFiles(event.dataTransfer && event.dataTransfer.files, 'research');
|
|
1888
|
+
},
|
|
1889
|
+
},
|
|
1890
|
+
h('div', { className: 'bn-drop-ico' }, '+'),
|
|
1891
|
+
h('b', null, current.uploading ? '正在写入本机…' : '补充主页 / 作品截图或视频'),
|
|
1892
|
+
h('small', null, '建议包含 3–5 条代表作品的标题、发布时间与可见表现;模型会自行读取素材'),
|
|
1893
|
+
),
|
|
1894
|
+
growthMedia('research'),
|
|
1895
|
+
h('div', { className: 'bn-diag-label' }, '调研重点(可选)'),
|
|
1896
|
+
h('textarea', {
|
|
1897
|
+
className: 'bn-input bn-diag-text', rows: 3, value: input.notes,
|
|
1898
|
+
placeholder: '例如:重点看开头钩子和选题来源,不要建议需要团队才能做的形式',
|
|
1899
|
+
onChange: (event) => growthInput('research', 'notes', event.target.value),
|
|
1900
|
+
}),
|
|
1901
|
+
current.error ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, current.error) : null,
|
|
1902
|
+
h('div', { className: 'bn-diag-cta' },
|
|
1903
|
+
h('button', { className: 'bn-btn primary', disabled: !String(input.accounts || '').trim() || !!current.busy || current.uploading, onClick: () => runGrowthSession('research') }, current.busy ? '正在开调研会话…' : '开始对标调研'),
|
|
1904
|
+
h('small', null, '使用你自己的 DSH 模型;没有联网工具时会明确标未核实,不会假装检索。'),
|
|
1905
|
+
),
|
|
1906
|
+
),
|
|
1907
|
+
growthResult('research'),
|
|
1908
|
+
growthArchive('research'),
|
|
1909
|
+
);
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
const plannerWorkspace = () => {
|
|
1913
|
+
const current = growth.planner;
|
|
1914
|
+
const input = current.input;
|
|
1915
|
+
const selected = completedDiagReports.find((report) => report.id === input.diagnosisId) || null;
|
|
1916
|
+
return h('div', null,
|
|
1917
|
+
growthHero('planner'),
|
|
1918
|
+
h('section', { className: 'bn-panel bn-diag-work' },
|
|
1919
|
+
h('div', { className: 'bn-diag-block-head' }, h('h2', null, '衔接号脉与真实排期'), h('span', null, '默认选用最新已完成号脉,也可以切换或不用报告')),
|
|
1920
|
+
h('div', { className: 'bn-growth-form' },
|
|
1921
|
+
h('div', { className: 'bn-field full' }, h('label', null, '带入的号脉报告'), h('select', {
|
|
1922
|
+
className: 'bn-select', value: input.diagnosisId || '',
|
|
1923
|
+
onChange: (event) => growthInput('planner', 'diagnosisId', event.target.value),
|
|
1924
|
+
},
|
|
1925
|
+
h('option', { value: '' }, completedDiagReports.length ? '不使用号脉报告(需填写定位)' : '暂无已完成号脉报告'),
|
|
1926
|
+
completedDiagReports.map((report) => h('option', { key: report.id, value: report.id }, (report.title || '未命名号脉') + ' · ' + timeAgo(report.createdAt))),
|
|
1927
|
+
)),
|
|
1928
|
+
selected ? h('div', { className: 'bn-growth-source full' },
|
|
1929
|
+
h('span', null, '已自动衔接:' + (selected.title || '未命名号脉')),
|
|
1930
|
+
h('button', { className: 'bn-btn ghost', onClick: () => { openDiagReport(selected); setDiagView('diagnose'); } }, '查看原报告'),
|
|
1931
|
+
) : null,
|
|
1932
|
+
h('div', { className: 'bn-field full' }, h('label', null, '账号定位(留空时仅从号脉报告提取)'), h('input', {
|
|
1933
|
+
className: 'bn-input', value: input.positioning, placeholder: '给谁看、讲什么、凭什么信你;报告无法确认时会列入待补,不会编造',
|
|
1934
|
+
onChange: (event) => growthInput('planner', 'positioning', event.target.value),
|
|
1935
|
+
})),
|
|
1936
|
+
h('div', { className: 'bn-field' }, h('label', null, '开始日期'), h('input', {
|
|
1937
|
+
className: 'bn-input', type: 'date', value: input.startDate,
|
|
1938
|
+
onChange: (event) => growthInput('planner', 'startDate', event.target.value),
|
|
1939
|
+
})),
|
|
1940
|
+
h('div', { className: 'bn-field' }, h('label', null, '每周发布上限(条)'), h('input', {
|
|
1941
|
+
className: 'bn-input', type: 'number', min: 1, max: 14, value: input.frequency,
|
|
1942
|
+
onChange: (event) => growthInput('planner', 'frequency', event.target.value),
|
|
1943
|
+
})),
|
|
1944
|
+
h('div', { className: 'bn-field full' }, h('label', null, '真实素材与排期约束'), h('textarea', {
|
|
1945
|
+
className: 'bn-input', value: input.notes,
|
|
1946
|
+
placeholder: '列出近期真实在做的事、可拍事件、产品/项目、可拍时间;每条选题都必须能追溯到这些素材或号脉证据',
|
|
1947
|
+
onChange: (event) => growthInput('planner', 'notes', event.target.value),
|
|
1948
|
+
})),
|
|
1949
|
+
),
|
|
1950
|
+
current.error ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, current.error) : null,
|
|
1951
|
+
h('div', { className: 'bn-diag-cta' },
|
|
1952
|
+
h('button', {
|
|
1953
|
+
className: 'bn-btn primary', disabled: !!current.busy || (!input.diagnosisId && !String(input.positioning || '').trim()),
|
|
1954
|
+
onClick: () => runGrowthSession('planner'),
|
|
1955
|
+
}, current.busy ? '正在开规划会话…' : '生成选题计划'),
|
|
1956
|
+
h('small', null, selected ? '规划会话会读取这份号脉全文,并把诊断结论落实到选题设计逻辑。' : '不使用号脉时,账号定位必填。'),
|
|
1957
|
+
),
|
|
1958
|
+
),
|
|
1959
|
+
growthResult('planner'),
|
|
1960
|
+
growthArchive('planner'),
|
|
1961
|
+
);
|
|
1962
|
+
};
|
|
1963
|
+
|
|
1964
|
+
const followupWorkspace = () => {
|
|
1965
|
+
const current = growth.followup;
|
|
1966
|
+
const input = current.input;
|
|
1967
|
+
const baseline = completedDiagReports.find((report) => report.id === input.baselineId) || null;
|
|
1968
|
+
const currentReport = completedDiagReports.find((report) => report.id === input.currentId) || null;
|
|
1969
|
+
const selector = (key, placeholder) => h('select', {
|
|
1970
|
+
className: 'bn-select', value: input[key] || '', onChange: (event) => growthInput('followup', key, event.target.value),
|
|
1971
|
+
},
|
|
1972
|
+
h('option', { value: '' }, placeholder),
|
|
1973
|
+
completedDiagReports.map((report) => h('option', { key: report.id, value: report.id }, (report.title || '未命名号脉') + ' · ' + timeAgo(report.createdAt))),
|
|
1974
|
+
);
|
|
1975
|
+
return h('div', null,
|
|
1976
|
+
growthHero('followup'),
|
|
1977
|
+
h('section', { className: 'bn-panel bn-diag-work' },
|
|
1978
|
+
h('div', { className: 'bn-diag-block-head' }, h('h2', null, '选择两次号脉'), h('span', null, '只对照两份报告里真实存在且口径一致的指标')),
|
|
1979
|
+
completedDiagReports.length < 2
|
|
1980
|
+
? h('div', { className: 'bn-empty' }, '至少需要两份已回填的号脉报告。\n先完成新一轮号脉,再回来复诊。')
|
|
1981
|
+
: h('div', null,
|
|
1982
|
+
h('div', { className: 'bn-growth-form' },
|
|
1983
|
+
h('div', { className: 'bn-field' }, h('label', null, '基线号脉(此前)'), selector('baselineId', '选择基线号脉')),
|
|
1984
|
+
h('div', { className: 'bn-field' }, h('label', null, '本次号脉(最近)'), selector('currentId', '选择本次号脉')),
|
|
1985
|
+
),
|
|
1986
|
+
h('div', { className: 'bn-growth-compare' },
|
|
1987
|
+
h('div', null, h('b', null, '基线'), h('span', null, baseline ? baseline.title : '尚未选择')),
|
|
1988
|
+
h('div', null, h('b', null, '本次'), h('span', null, currentReport ? currentReport.title : '尚未选择')),
|
|
1989
|
+
),
|
|
1990
|
+
h('div', { className: 'bn-diag-label' }, '本次复诊重点(可选)'),
|
|
1991
|
+
h('textarea', {
|
|
1992
|
+
className: 'bn-input bn-diag-text', rows: 3, value: input.notes,
|
|
1993
|
+
placeholder: '例如:重点验收更新频率和中位播放,说明上一轮哪条处方该继续',
|
|
1994
|
+
onChange: (event) => growthInput('followup', 'notes', event.target.value),
|
|
1995
|
+
}),
|
|
1996
|
+
),
|
|
1997
|
+
current.error ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, current.error) : null,
|
|
1998
|
+
h('div', { className: 'bn-diag-cta' },
|
|
1999
|
+
h('button', {
|
|
2000
|
+
className: 'bn-btn primary',
|
|
2001
|
+
disabled: completedDiagReports.length < 2 || !!current.busy || !input.baselineId || !input.currentId || input.baselineId === input.currentId,
|
|
2002
|
+
onClick: () => runGrowthSession('followup'),
|
|
2003
|
+
}, current.busy ? '正在开复诊会话…' : '开始复诊对比'),
|
|
2004
|
+
input.baselineId && input.baselineId === input.currentId ? h('small', null, '两份报告不能相同。') : h('small', null, '缺失或口径不一致的指标会明确标注,不做虚假计算。'),
|
|
2005
|
+
),
|
|
2006
|
+
),
|
|
2007
|
+
growthResult('followup'),
|
|
2008
|
+
growthArchive('followup'),
|
|
2009
|
+
);
|
|
2010
|
+
};
|
|
2011
|
+
|
|
1136
2012
|
return h('div', { className: 'bn-root' },
|
|
1137
2013
|
h('aside', { className: 'bn-rail' },
|
|
1138
2014
|
h('div', { className: 'bn-logo' }, h('span', { className: 'dot' }, h('img', { src: BASE + '/icons/app.svg', alt: '' })), BRAND),
|
|
1139
2015
|
h('nav', { className: 'bn-nav' },
|
|
1140
2016
|
h('button', { className: tab === 'agents' ? 'on' : '', onClick: () => setTab('agents') }, h(Icon, { name: 'grid' }), 'Agents', h('span', { className: 'count' }, String(agents.length))),
|
|
1141
2017
|
h('button', { className: tab === 'studio' ? 'on' : '', onClick: () => studioAgentId && setTab('studio'), disabled: !studioAgentId }, h(Icon, { name: 'external' }), 'Studio'),
|
|
2018
|
+
h('button', { className: tab === 'diagnose' ? 'on' : '', onClick: () => setTab('diagnose') }, h(Icon, { name: memberOn ? 'bolt' : 'lock' }), '号脉', memberOn ? null : h('span', { className: 'count' }, '会员')),
|
|
1142
2019
|
h('button', { className: tab === 'tasks' ? 'on' : '', onClick: () => setTab('tasks') }, h(Icon, { name: 'list' }), '任务', h('span', { className: 'count' }, String(tasks.filter((t) => t.status === 'running').length || ''))),
|
|
1143
2020
|
h('button', { className: tab === 'account' ? 'on' : '', onClick: () => setTab('account') }, h(Icon, { name: 'key' }), '我的授权', h('span', { className: 'count' }, String(licenses.length || ''))),
|
|
1144
2021
|
h('button', { className: tab === 'settings' ? 'on' : '', onClick: () => setTab('settings') }, h(Icon, { name: 'gear' }), '设置'),
|
|
@@ -1171,11 +2048,11 @@
|
|
|
1171
2048
|
h('div', { className: 'bn-mono', style: { marginTop: 4 } }, licenses.length ? (licenses.length + ' 产品授权') : state.license.state),
|
|
1172
2049
|
),
|
|
1173
2050
|
),
|
|
1174
|
-
h('main', { className: 'bn-main'
|
|
2051
|
+
h('main', { className: 'bn-main' },
|
|
1175
2052
|
tab !== 'studio' ? h('div', { className: 'bn-head' },
|
|
1176
2053
|
h('div', null,
|
|
1177
|
-
h('h1', { className: 'bn-h1' }, tab === 'agents' ? '今天就出片' : tab === 'tasks' ? '任务' : tab === 'account' ? '我的授权' : '设置'),
|
|
1178
|
-
h('div', { className: 'bn-sub' }, tab === 'agents' ? '看一条成片,选一个 Agent。模板里已经写好提示词,改一句就能开拍。' : tab === 'tasks' ? '安装与创作进度' : tab === 'account' ? '激活码与购买' : '偏好设置'),
|
|
2054
|
+
h('h1', { className: 'bn-h1' }, tab === 'agents' ? '今天就出片' : tab === 'diagnose' ? (diagView === 'diagnose' ? '号脉' : growthLabels[diagView]) : tab === 'tasks' ? '任务' : tab === 'account' ? '我的授权' : '设置'),
|
|
2055
|
+
h('div', { className: 'bn-sub' }, tab === 'agents' ? '看一条成片,选一个 Agent。模板里已经写好提示词,改一句就能开拍。' : tab === 'diagnose' ? '年会员专属 · 号脉、对标、选题与复诊 · 素材与报告只存在本机' : tab === 'tasks' ? '安装与创作进度' : tab === 'account' ? '激活码与购买' : '偏好设置'),
|
|
1179
2056
|
),
|
|
1180
2057
|
h('div', { className: 'bn-head-actions' }, topSeg),
|
|
1181
2058
|
) : null,
|
|
@@ -1289,6 +2166,184 @@
|
|
|
1289
2166
|
)
|
|
1290
2167
|
) : null,
|
|
1291
2168
|
|
|
2169
|
+
tab === 'diagnose' ? h('div', null,
|
|
2170
|
+
h('div', { className: 'bn-seg bn-growth-tabs' },
|
|
2171
|
+
h('button', { type: 'button', className: diagView === 'diagnose' ? 'on' : '', onClick: () => setDiagView('diagnose') }, '号脉'),
|
|
2172
|
+
h('button', { type: 'button', className: diagView === 'research' ? 'on' : '', onClick: () => setDiagView('research') }, '对标调研'),
|
|
2173
|
+
h('button', { type: 'button', className: diagView === 'planner' ? 'on' : '', onClick: () => setDiagView('planner') }, '选题规划'),
|
|
2174
|
+
h('button', { type: 'button', className: diagView === 'followup' ? 'on' : '', onClick: () => setDiagView('followup') }, '复诊对比'),
|
|
2175
|
+
),
|
|
2176
|
+
diagView !== 'diagnose' ? (memberOn
|
|
2177
|
+
? diagView === 'research' ? researchWorkspace() : diagView === 'planner' ? plannerWorkspace() : followupWorkspace()
|
|
2178
|
+
: h('section', { className: 'bn-diag-upsell' },
|
|
2179
|
+
h('div', { style: { minWidth: 0 } },
|
|
2180
|
+
h('h2', null, growthLabels[diagView] + '是年会员能力'),
|
|
2181
|
+
h('p', null, '与号脉共用本机档案和 DSH 会话,不增加平台服务器模型成本;开通后可使用完整账号增长工作流。'),
|
|
2182
|
+
),
|
|
2183
|
+
memberHref
|
|
2184
|
+
? h('a', { className: 'bn-btn primary', href: memberHref, target: '_blank', rel: 'noreferrer' }, '开通年会员')
|
|
2185
|
+
: h('div', { className: 'bn-sub' }, '暂时打不开购买页,请到「我的授权」重试。'),
|
|
2186
|
+
)) : null,
|
|
2187
|
+
diagView === 'diagnose' ? h('div', null,
|
|
2188
|
+
h('section', { className: 'bn-diag-hero' },
|
|
2189
|
+
h('div', { style: { minWidth: 0 } },
|
|
2190
|
+
h('div', { className: 'bn-diag-kicker' }, memberOn ? '年会员 · 账号体检' : '年会员专属'),
|
|
2191
|
+
h('h2', null, '看清账号瓶颈,拿到 30 天改法'),
|
|
2192
|
+
h('p', null, '上传抖音后台截图,从真实作品数据建立基线,完成四维诊断,给出带方法论出处的优化处方和验收指标。素材与报告只存在本机。'),
|
|
2193
|
+
h('div', { className: 'bn-diag-values' },
|
|
2194
|
+
h('span', null, h('b', null, '01'), '数据基线'),
|
|
2195
|
+
h('span', null, h('b', null, '02'), '四维诊断'),
|
|
2196
|
+
h('span', null, h('b', null, '03'), '溯源处方'),
|
|
2197
|
+
h('span', null, h('b', null, '04'), '30 天指标'),
|
|
2198
|
+
),
|
|
2199
|
+
),
|
|
2200
|
+
h('div', { className: 'bn-diag-hero-side' },
|
|
2201
|
+
memberOn
|
|
2202
|
+
? h('span', { className: 'bn-chip ok' }, member.daysLeft ? '剩余 ' + member.daysLeft + ' 天' : '已开通')
|
|
2203
|
+
: h('span', { className: 'bn-chip dim' }, '未开通'),
|
|
2204
|
+
),
|
|
2205
|
+
),
|
|
2206
|
+
memberOn
|
|
2207
|
+
? h('div', null,
|
|
2208
|
+
h('input', {
|
|
2209
|
+
ref: diagFileRef,
|
|
2210
|
+
type: 'file',
|
|
2211
|
+
accept: 'image/*,video/*',
|
|
2212
|
+
multiple: true,
|
|
2213
|
+
style: { display: 'none' },
|
|
2214
|
+
onChange: uploadDiagFiles,
|
|
2215
|
+
}),
|
|
2216
|
+
h('section', { className: 'bn-panel bn-diag-work' },
|
|
2217
|
+
h('div', { className: 'bn-diag-block-head' },
|
|
2218
|
+
h('h2', null, '输入账号素材'),
|
|
2219
|
+
h('span', null, '后台截图为主,视频与补充说明可选'),
|
|
2220
|
+
),
|
|
2221
|
+
h('div', {
|
|
2222
|
+
className: 'bn-drop' + (diagHot ? ' hot' : ''),
|
|
2223
|
+
onClick: () => { if (!diagUploading) diagFileRef.current && diagFileRef.current.click(); },
|
|
2224
|
+
onDragOver: (e) => { e.preventDefault(); setDiagHot(true); },
|
|
2225
|
+
onDragLeave: () => setDiagHot(false),
|
|
2226
|
+
onDrop: (e) => {
|
|
2227
|
+
e.preventDefault();
|
|
2228
|
+
setDiagHot(false);
|
|
2229
|
+
uploadDiagFiles(e.dataTransfer && e.dataTransfer.files);
|
|
2230
|
+
},
|
|
2231
|
+
},
|
|
2232
|
+
h('div', { className: 'bn-drop-ico' }, '+'),
|
|
2233
|
+
h('b', null, diagUploading ? '正在写入本机…' : '拖入或点击上传后台截图 / 视频'),
|
|
2234
|
+
h('small', null, '建议提供至少 5 条作品的标题、播放量与发布时间;视频由 DSH 模型自己抽帧'),
|
|
2235
|
+
),
|
|
2236
|
+
diagMedia.length ? h('div', { className: 'bn-media-grid' },
|
|
2237
|
+
diagMedia.map((item) => h('div', { key: item.id, className: 'bn-media' },
|
|
2238
|
+
item.previewUrl
|
|
2239
|
+
? h('img', { src: item.previewUrl, alt: '' })
|
|
2240
|
+
: h('div', { className: 'bn-media-ph' }, item.kind === 'video' ? '▶ 视频' : '图片'),
|
|
2241
|
+
h('div', { className: 'bn-media-info' },
|
|
2242
|
+
h('span', { className: 'bn-media-name', title: item.name }, item.name),
|
|
2243
|
+
h('span', { className: 'bn-media-size' }, diagSize(item.size)),
|
|
2244
|
+
),
|
|
2245
|
+
h('button', {
|
|
2246
|
+
className: 'bn-media-x',
|
|
2247
|
+
title: '移除',
|
|
2248
|
+
onClick: (e) => { e.stopPropagation(); removeDiagMedia(item.id); },
|
|
2249
|
+
}, '×'),
|
|
2250
|
+
)),
|
|
2251
|
+
) : null,
|
|
2252
|
+
h('div', { className: 'bn-diag-label' }, '补充说明(可选)'),
|
|
2253
|
+
h('textarea', {
|
|
2254
|
+
className: 'bn-input bn-diag-text',
|
|
2255
|
+
rows: 3,
|
|
2256
|
+
placeholder: '粘贴作品数据 / 文案,或说明重点想诊断什么,例如:播放量长期低于 500,问题在哪里',
|
|
2257
|
+
value: diagText,
|
|
2258
|
+
onChange: (e) => setDiagText(e.target.value),
|
|
2259
|
+
}),
|
|
2260
|
+
diagErr ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, diagErr) : null,
|
|
2261
|
+
h('div', { className: 'bn-diag-cta' },
|
|
2262
|
+
h('button', {
|
|
2263
|
+
className: 'bn-btn primary',
|
|
2264
|
+
disabled: !diagReady || !!diagBusy || diagUploading,
|
|
2265
|
+
onClick: runDiagSession,
|
|
2266
|
+
}, diagBusy === 'session' ? '正在开分析会话…' : '开始账号体检'),
|
|
2267
|
+
h('small', null, diagSession
|
|
2268
|
+
? '诊断在 DSH 会话里进行,写成 report.md 后会自动回填。'
|
|
2269
|
+
: '会在 DSH 新开「账号体检」会话,用你自己的模型分析。'),
|
|
2270
|
+
diagSession ? h('button', { className: 'bn-btn ghost', onClick: openDiagSession }, '回到分析会话') : null,
|
|
2271
|
+
),
|
|
2272
|
+
),
|
|
2273
|
+
diagSession || diagAnalysis ? h('section', { className: 'bn-panel' },
|
|
2274
|
+
h('div', { className: 'bn-sec-head' },
|
|
2275
|
+
h('h2', null, '账号体检报告'),
|
|
2276
|
+
h('div', { className: 'bn-sec-actions' },
|
|
2277
|
+
h('span', { className: 'bn-diag-status ' + (diagAnalysis ? 'ok' : 'live') }, diagAnalysis ? '已回填' : '分析中'),
|
|
2278
|
+
),
|
|
2279
|
+
),
|
|
2280
|
+
h('textarea', {
|
|
2281
|
+
className: 'bn-input bn-diag-text',
|
|
2282
|
+
rows: 8,
|
|
2283
|
+
placeholder: '分析完成后会自动回填;模型没写文件时,也可以把结果粘贴到这里',
|
|
2284
|
+
value: diagAnalysis,
|
|
2285
|
+
onChange: (e) => setDiagAnalysis(e.target.value),
|
|
2286
|
+
}),
|
|
2287
|
+
h('div', { className: 'bn-diag-cta' },
|
|
2288
|
+
h('button', { className: 'bn-btn primary', disabled: !diagAnalysis.trim(), onClick: saveDiagnose }, '保存到档案'),
|
|
2289
|
+
diagPrompt ? h('button', { className: 'bn-btn', onClick: () => copyPrompt(diagPrompt) }, '复制提示词') : null,
|
|
2290
|
+
h('small', null, '报告只保存在本机,可在下方档案里随时回看。'),
|
|
2291
|
+
),
|
|
2292
|
+
) : null,
|
|
2293
|
+
h('section', { className: 'bn-panel' },
|
|
2294
|
+
h('div', { className: 'bn-sec-head' },
|
|
2295
|
+
h('h2', null, '体检档案'),
|
|
2296
|
+
h('div', { className: 'bn-sec-actions' },
|
|
2297
|
+
h('span', { className: 'bn-chip dim' }, String(diagReports.length)),
|
|
2298
|
+
),
|
|
2299
|
+
),
|
|
2300
|
+
diagReports.length
|
|
2301
|
+
? h('div', { className: 'bn-archive' },
|
|
2302
|
+
diagReports.map((report) => h('article', {
|
|
2303
|
+
key: report.id,
|
|
2304
|
+
className: 'bn-archive-item',
|
|
2305
|
+
onClick: () => openDiagReport(report),
|
|
2306
|
+
},
|
|
2307
|
+
h('div', { className: 'bn-archive-top' },
|
|
2308
|
+
h('span', { className: 'bn-archive-kind' }, report.analysis ? '已分析' : report.sessionId ? '待回填' : '待分析'),
|
|
2309
|
+
h('span', { className: 'bn-archive-kind' }, timeAgo(report.createdAt)),
|
|
2310
|
+
),
|
|
2311
|
+
h('div', { className: 'bn-archive-title' }, report.title || '未命名体检'),
|
|
2312
|
+
h('div', { className: 'bn-archive-meta' },
|
|
2313
|
+
h('span', { style: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } },
|
|
2314
|
+
[report.snapshot && report.snapshot.author, report.snapshot && diagKindLabel(report.snapshot.kind)].filter(Boolean).join(' · ') || '本机存档',
|
|
2315
|
+
),
|
|
2316
|
+
),
|
|
2317
|
+
report.analysis ? h('div', { className: 'bn-card-actions', style: { marginTop: 8, paddingTop: 8, paddingRight: 34 } },
|
|
2318
|
+
h('button', { className: 'bn-btn', onClick: (event) => { event.stopPropagation(); planFromDiagnosis(report); } }, '做选题'),
|
|
2319
|
+
h('button', { className: 'bn-btn ghost', onClick: (event) => { event.stopPropagation(); followupFromDiagnosis(report); } }, '去复诊'),
|
|
2320
|
+
) : null,
|
|
2321
|
+
h('button', {
|
|
2322
|
+
className: 'bn-btn ghost bn-archive-del',
|
|
2323
|
+
onClick: (e) => { e.stopPropagation(); removeDiagReport(report); },
|
|
2324
|
+
}, '删除'),
|
|
2325
|
+
)),
|
|
2326
|
+
)
|
|
2327
|
+
: h('div', { className: 'bn-empty' }, '还没有体检档案。\n完成一次诊断后会存在本机,方便回看和对比。'),
|
|
2328
|
+
),
|
|
2329
|
+
)
|
|
2330
|
+
: h('section', { className: 'bn-diag-upsell' },
|
|
2331
|
+
h('div', { style: { minWidth: 0 } },
|
|
2332
|
+
h('h2', null, '账号体检是年会员能力'),
|
|
2333
|
+
h('p', null, '从后台真实数据定位账号瓶颈,交付带出处处方和 30 天验收指标;报告存在本机,同时获得全部 Agent 的一年授权。'),
|
|
2334
|
+
h('ul', null,
|
|
2335
|
+
h('li', null, '四维定位真实瓶颈'),
|
|
2336
|
+
h('li', null, '处方可溯源、可执行'),
|
|
2337
|
+
h('li', null, '30 天指标可验收'),
|
|
2338
|
+
),
|
|
2339
|
+
),
|
|
2340
|
+
memberHref
|
|
2341
|
+
? h('a', { className: 'bn-btn primary', href: memberHref, target: '_blank', rel: 'noreferrer' }, '开通年会员')
|
|
2342
|
+
: h('div', { className: 'bn-sub' }, '暂时打不开购买页,请到「我的授权」重试。'),
|
|
2343
|
+
),
|
|
2344
|
+
) : null,
|
|
2345
|
+
) : null,
|
|
2346
|
+
|
|
1292
2347
|
tab === 'tasks' ? h('section', { className: 'bn-panel' },
|
|
1293
2348
|
h('h2', null, '最近任务'),
|
|
1294
2349
|
tasks.length ? tasks.slice(0, 20).map((t) => h(TaskRow, { key: t.id, task: t })) : h('div', { className: 'bn-sub' }, '暂无任务'),
|
|
@@ -1344,7 +2399,7 @@
|
|
|
1344
2399
|
: h('div', { className: 'bn-sub' }, Number(state.trialRuns) > 0
|
|
1345
2400
|
? '尚未激活正式授权。安装后每个 Agent 可试用 ' + state.trialRuns + ' 次;购买后激活码会发到邮箱。'
|
|
1346
2401
|
: '尚未激活正式授权。购买后激活码会发到邮箱。'),
|
|
1347
|
-
h('div', { className: 'bn-activate' },
|
|
2402
|
+
h('div', { className: 'bn-activate batch' },
|
|
1348
2403
|
h(BnDropdown, {
|
|
1349
2404
|
value: productInput,
|
|
1350
2405
|
onChange: (v) => setProductInput(v),
|
|
@@ -1372,8 +2427,25 @@
|
|
|
1372
2427
|
return opts;
|
|
1373
2428
|
})(),
|
|
1374
2429
|
}),
|
|
1375
|
-
h('
|
|
1376
|
-
|
|
2430
|
+
h('textarea', {
|
|
2431
|
+
className: 'bn-input',
|
|
2432
|
+
rows: 3,
|
|
2433
|
+
placeholder: '每行一个:产品 KEY\n也可以只粘 KEY,用左侧产品激活',
|
|
2434
|
+
value: keyInput,
|
|
2435
|
+
onChange: (e) => setKeyInput(e.target.value),
|
|
2436
|
+
}),
|
|
2437
|
+
h('button', { className: 'bn-btn primary', disabled: busy || !keyInput.trim(), onClick: activateKeys }, '激活'),
|
|
2438
|
+
activateResult ? h('div', { className: 'bn-activate-out' },
|
|
2439
|
+
activateResult.ok.map((p) => h('div', { key: 'ok:' + p, className: 'row' },
|
|
2440
|
+
h('span', { className: 'bn-chip ok' }, '成功'),
|
|
2441
|
+
h('span', null, p),
|
|
2442
|
+
)),
|
|
2443
|
+
activateResult.failed.map((f) => h('div', { key: 'bad:' + f.line, className: 'row' },
|
|
2444
|
+
h('span', { className: 'bn-chip bad' }, '失败'),
|
|
2445
|
+
h('span', { className: 'bn-mono', style: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, f.product + ' ' + f.key),
|
|
2446
|
+
h('span', { className: 'bn-sub', style: { margin: 0 } }, f.error),
|
|
2447
|
+
)),
|
|
2448
|
+
) : null,
|
|
1377
2449
|
),
|
|
1378
2450
|
),
|
|
1379
2451
|
h('section', { className: 'bn-panel' },
|