dsh-plugin-content-studio 0.0.0-stage → 0.2.0
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 +9 -0
- package/README.md +32 -2
- package/cordis.patch.yml +3 -0
- package/dist/client.js +2992 -0
- package/dist/index.js +2099 -0
- package/dist/studio.css +940 -0
- package/docs/screenshots/editor.png +0 -0
- package/docs/screenshots/export.png +0 -0
- package/docs/screenshots/narrow.png +0 -0
- package/docs/screenshots/workbench.png +0 -0
- package/docs//344/272/247/345/223/201/344/270/216/345/267/245/347/250/213/350/256/276/350/256/241.md +48 -0
- package/docs//344/275/277/347/224/250/346/214/207/345/215/227.md +137 -0
- package/docs//346/216/245/345/217/243/346/240/270/351/252/214.md +38 -0
- package/docs//351/252/214/350/257/201/350/256/260/345/275/225.md +94 -0
- package/examples//347/244/272/344/276/213/345/233/276/347/211/207.png +0 -0
- package/examples//347/244/272/344/276/213/346/235/220/346/226/231.md +13 -0
- package/package.json +84 -4
package/dist/client.js
ADDED
|
@@ -0,0 +1,2992 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({id:"dsh-plugin-content-studio",factory:(require)=>{var module={exports:{}};var exports=module.exports;
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// client/index.tsx
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
apply: () => apply,
|
|
35
|
+
inject: () => inject
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
39
|
+
|
|
40
|
+
// client/assistant.tsx
|
|
41
|
+
var import_react2 = require("react");
|
|
42
|
+
|
|
43
|
+
// client/api.ts
|
|
44
|
+
var import_react = require("react");
|
|
45
|
+
function createApi(scope) {
|
|
46
|
+
const boundScope = Object.freeze({ ...scope });
|
|
47
|
+
async function api(action, body = {}) {
|
|
48
|
+
const res = await fetch("/content-studio-api/command", {
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: { "Content-Type": "application/json" },
|
|
51
|
+
body: JSON.stringify({ action, body, scope: boundScope })
|
|
52
|
+
});
|
|
53
|
+
if (res.status === 401)
|
|
54
|
+
throw Error("\u5BBF\u4E3B\u4F1A\u8BDD\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u7528 dsh \u542F\u52A8\u94FE\u63A5\u91CD\u65B0\u767B\u5F55");
|
|
55
|
+
const data = await res.json();
|
|
56
|
+
if (!res.ok || !data.ok) throw Error(data.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
57
|
+
return data.result;
|
|
58
|
+
}
|
|
59
|
+
return Object.assign(api, {
|
|
60
|
+
scope: boundScope,
|
|
61
|
+
url: (path) => path + "?" + new URLSearchParams(boundScope).toString()
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
var StudioContext = (0, import_react.createContext)(
|
|
65
|
+
void 0
|
|
66
|
+
);
|
|
67
|
+
var StudioApiProvider = StudioContext.Provider;
|
|
68
|
+
var useStudioApi = () => {
|
|
69
|
+
const api = (0, import_react.useContext)(StudioContext);
|
|
70
|
+
if (!api) throw Error("\u5185\u5BB9\u5DE5\u4F5C\u533A\u5C1A\u672A\u521D\u59CB\u5316");
|
|
71
|
+
return api;
|
|
72
|
+
};
|
|
73
|
+
var date = (s) => new Date(s).toLocaleString("zh-CN", {
|
|
74
|
+
month: "short",
|
|
75
|
+
day: "numeric",
|
|
76
|
+
hour: "2-digit",
|
|
77
|
+
minute: "2-digit"
|
|
78
|
+
});
|
|
79
|
+
async function base64(file) {
|
|
80
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
81
|
+
let binary = "";
|
|
82
|
+
for (let i = 0; i < bytes.length; i += 8192)
|
|
83
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
|
|
84
|
+
return btoa(binary);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/prompts.ts
|
|
88
|
+
var steps = {
|
|
89
|
+
compose: {
|
|
90
|
+
label: "\u81EA\u52A8\u521B\u4F5C",
|
|
91
|
+
output: "document",
|
|
92
|
+
confirm: "\u540E\u53F0\u4F9D\u6B21\u751F\u6210\uFF0C\u968F\u65F6\u53EF\u53D6\u6D88"
|
|
93
|
+
},
|
|
94
|
+
chat: {
|
|
95
|
+
label: "\u5BF9\u8BDD\u6539\u7A3F",
|
|
96
|
+
output: "document",
|
|
97
|
+
confirm: "\u4FEE\u6539\u5148\u5B58\u4E3A\u5019\u9009\u7248\u672C\uFF0C\u6BD4\u8F83\u540E\u91C7\u7528"
|
|
98
|
+
},
|
|
99
|
+
topics: {
|
|
100
|
+
label: "\u63D0\u70BC\u9009\u9898",
|
|
101
|
+
output: "topics",
|
|
102
|
+
confirm: "\u7F3A\u5931\u771F\u5B9E\u7ECF\u5386\u65F6\u5217\u51FA\u95EE\u9898\uFF0C\u4E0D\u4EE3\u5199\u7ECF\u5386"
|
|
103
|
+
},
|
|
104
|
+
brief: {
|
|
105
|
+
label: "\u7F16\u8F91\u7B80\u62A5",
|
|
106
|
+
output: "brief",
|
|
107
|
+
confirm: "\u7ACB\u573A\u4E0D\u660E\u786E\u65F6\u5217\u4E3A\u5F85\u786E\u8BA4"
|
|
108
|
+
},
|
|
109
|
+
research: {
|
|
110
|
+
label: "\u4E8B\u5B9E\u6838\u9A8C",
|
|
111
|
+
output: "facts",
|
|
112
|
+
confirm: "\u516C\u5F00\u6765\u6E90\u53EA\u80FD\u5F62\u6210\u5F85\u6838\u5B9E\u4E8B\u5B9E\uFF0C\u7531\u4F5C\u8005\u786E\u8BA4"
|
|
113
|
+
},
|
|
114
|
+
outline: { label: "\u751F\u6210\u63D0\u7EB2", output: "outline", confirm: "" },
|
|
115
|
+
draft: {
|
|
116
|
+
label: "\u751F\u6210\u5019\u9009\u7A3F",
|
|
117
|
+
output: "document",
|
|
118
|
+
confirm: "\u6240\u6709\u751F\u6210\u7A3F\u5747\u5F85\u7EC8\u5BA1"
|
|
119
|
+
},
|
|
120
|
+
review: { label: "\u5185\u5BB9\u5BA1\u9605", output: "comments", confirm: "" },
|
|
121
|
+
polish: {
|
|
122
|
+
label: "\u5168\u6587\u6DA6\u8272",
|
|
123
|
+
output: "document",
|
|
124
|
+
confirm: "\u663E\u5F0F\u70B9\u51FB\u6267\u884C\uFF0C\u4FDD\u7559\u4F5C\u8005\u7ACB\u573A"
|
|
125
|
+
},
|
|
126
|
+
selection: {
|
|
127
|
+
label: "\u9009\u6BB5\u6539\u5199",
|
|
128
|
+
output: "replacement",
|
|
129
|
+
confirm: "\u9009\u4E2D\u8303\u56F4\u5FC5\u987B\u4ECD\u4E0E\u57FA\u51C6\u7248\u672C\u4E00\u81F4"
|
|
130
|
+
},
|
|
131
|
+
adapt: { label: "\u5E73\u53F0\u9002\u914D", output: "document", confirm: "\u53EA\u5199\u5F53\u524D\u5E73\u53F0" },
|
|
132
|
+
images: {
|
|
133
|
+
label: "\u56FE\u7247\u7B80\u62A5",
|
|
134
|
+
output: "comments",
|
|
135
|
+
confirm: "\u6388\u6743\u672A\u786E\u8BA4\u7684\u56FE\u7247\u9700\u4EBA\u5DE5\u590D\u6838"
|
|
136
|
+
},
|
|
137
|
+
retrospective: {
|
|
138
|
+
label: "\u53D1\u5E03\u590D\u76D8",
|
|
139
|
+
output: "comments",
|
|
140
|
+
confirm: "\u533A\u5206\u96F6\u4E0E\u65E0\u6570\u636E\uFF0C\u4E0D\u628A\u76F8\u5173\u6027\u5199\u6210\u56E0\u679C"
|
|
141
|
+
},
|
|
142
|
+
ocr: {
|
|
143
|
+
label: "\u8BC6\u56FE / OCR",
|
|
144
|
+
output: "replacement",
|
|
145
|
+
confirm: "\u7ED3\u679C\u4E3A\u6A21\u578B\u8BC6\u522B\uFF0C\u672A\u6838\u5B9E"
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var stepDefinitions = Object.fromEntries(
|
|
149
|
+
Object.entries(steps).map(([id, step]) => [
|
|
150
|
+
id,
|
|
151
|
+
{
|
|
152
|
+
...step,
|
|
153
|
+
inputs: id === "selection" ? ["project", "baseVersion", "selectedRange", "instruction"] : id === "ocr" ? ["material", "imageAttachment", "instruction"] : [
|
|
154
|
+
"project",
|
|
155
|
+
"linkedEvidence",
|
|
156
|
+
"baseVersion",
|
|
157
|
+
"authorSettings",
|
|
158
|
+
"instruction"
|
|
159
|
+
],
|
|
160
|
+
capability: id === "research" ? ["web.search", "llm.stream"] : id === "ocr" ? ["attachments.saveImage", "llm.stream:image"] : ["llm.stream"],
|
|
161
|
+
states: [
|
|
162
|
+
"queued",
|
|
163
|
+
"running",
|
|
164
|
+
"completed",
|
|
165
|
+
"failed",
|
|
166
|
+
"cancelled",
|
|
167
|
+
"interrupted"
|
|
168
|
+
],
|
|
169
|
+
cancellation: "AbortSignal; retain input and partial output; never apply cancelled results",
|
|
170
|
+
retry: "Explicit new task on current input, no automatic retry; daily budget and concurrency limits apply"
|
|
171
|
+
}
|
|
172
|
+
])
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// client/assistant.tsx
|
|
176
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
177
|
+
var platformName = (p) => p === "wechat" ? "\u516C\u4F17\u53F7" : "\u5C0F\u7EA2\u4E66";
|
|
178
|
+
var active = (t) => ["queued", "running"].includes(t.status);
|
|
179
|
+
function CreateWithAI({
|
|
180
|
+
platform,
|
|
181
|
+
materials,
|
|
182
|
+
model,
|
|
183
|
+
open
|
|
184
|
+
}) {
|
|
185
|
+
const api = useStudioApi();
|
|
186
|
+
const [idea, setIdea] = (0, import_react2.useState)("");
|
|
187
|
+
const [materialText, setMaterialText] = (0, import_react2.useState)("");
|
|
188
|
+
const [url, setUrl] = (0, import_react2.useState)("");
|
|
189
|
+
const [ids, setIds] = (0, import_react2.useState)([]);
|
|
190
|
+
const [files, setFiles] = (0, import_react2.useState)([]);
|
|
191
|
+
const [error, setError] = (0, import_react2.useState)("");
|
|
192
|
+
const [phase, setPhase] = (0, import_react2.useState)("");
|
|
193
|
+
const locked = (0, import_react2.useRef)(false);
|
|
194
|
+
const start = async () => {
|
|
195
|
+
if (locked.current || !idea.trim()) return;
|
|
196
|
+
locked.current = true;
|
|
197
|
+
setError("");
|
|
198
|
+
setPhase("\u6B63\u5728\u4FDD\u5B58\u7D20\u6750\u2026");
|
|
199
|
+
try {
|
|
200
|
+
const linked = [...ids];
|
|
201
|
+
if (url.trim()) {
|
|
202
|
+
setPhase("\u6B63\u5728\u8BFB\u53D6\u53C2\u8003\u94FE\u63A5\u2026");
|
|
203
|
+
const m = await api("url.read", { url: url.trim() });
|
|
204
|
+
linked.push(m.id);
|
|
205
|
+
}
|
|
206
|
+
for (const file of files) {
|
|
207
|
+
if (file.size > 20 * 1024 * 1024) throw Error("\u5355\u4E2A\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7 20 MB");
|
|
208
|
+
const m = await api("material.import", {
|
|
209
|
+
title: file.name,
|
|
210
|
+
filename: file.name,
|
|
211
|
+
base64: await base64(file),
|
|
212
|
+
type: "text"
|
|
213
|
+
});
|
|
214
|
+
linked.push(m.id);
|
|
215
|
+
}
|
|
216
|
+
setPhase("\u6B63\u5728\u521B\u5EFA\u9879\u76EE\u5E76\u542F\u52A8 AI\u2026");
|
|
217
|
+
const result = await api("studio.create", {
|
|
218
|
+
idea,
|
|
219
|
+
materialText,
|
|
220
|
+
materialIds: linked,
|
|
221
|
+
platform
|
|
222
|
+
});
|
|
223
|
+
await open(result.project, platform);
|
|
224
|
+
} catch (e) {
|
|
225
|
+
setError(e.message);
|
|
226
|
+
} finally {
|
|
227
|
+
locked.current = false;
|
|
228
|
+
setPhase("");
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "ai-start", "aria-labelledby": "ai-start-title", children: [
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "eyebrow", children: "\u4ECE\u4E00\u4E2A\u60F3\u6CD5\uFF0C\u5230\u7B2C\u4E00\u7BC7\u521D\u7A3F" }),
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { id: "ai-start-title", children: "\u4ECA\u5929\uFF0C\u60F3\u5199\u70B9\u4EC0\u4E48\uFF1F" }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "\u8BF4\u8BF4\u4F60\u7684\u60F3\u6CD5\uFF0CAI \u5E2E\u4F60\u6574\u7406\u601D\u8DEF\u3001\u62DF\u63D0\u7EB2\u3001\u5199\u521D\u7A3F\u3002\u4F60\u6765\u51B3\u5B9A\u6700\u7EC8\u8868\u8FBE\u3002" }),
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
236
|
+
"form",
|
|
237
|
+
{
|
|
238
|
+
onSubmit: (e) => {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
void start();
|
|
241
|
+
},
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { disabled: !!phase, children: [
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "field", children: [
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u544A\u8BC9 AI \u4F60\u60F3\u5199\u4EC0\u4E48" }),
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
|
+
"textarea",
|
|
248
|
+
{
|
|
249
|
+
className: "idea-input",
|
|
250
|
+
value: idea,
|
|
251
|
+
maxLength: 1e4,
|
|
252
|
+
required: true,
|
|
253
|
+
onChange: (e) => setIdea(e.target.value),
|
|
254
|
+
placeholder: "\u4F8B\u5982\uFF1A\u5199\u4E00\u7BC7\u7ED9\u666E\u901A\u4EBA\u7684 AI \u4F7F\u7528\u6307\u5357\u3002\u6211\u7684\u89C2\u70B9\u662F\u5148\u627E\u4E00\u4E2A\u5177\u4F53\u95EE\u9898\uFF0C\u4E0D\u5FC5\u8FFD\u6BCF\u4E00\u4E2A\u65B0\u5DE5\u5177\u3002"
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "idea-examples", "aria-label": "\u8BD5\u8BD5\u8FD9\u4E9B\u60F3\u6CD5", children: [
|
|
259
|
+
"\u628A\u96F6\u6563\u7B14\u8BB0\u6574\u7406\u6210\u4E00\u7BC7\u6709\u89C2\u70B9\u7684\u6587\u7AE0",
|
|
260
|
+
"\u7ED9\u666E\u901A\u4EBA\u5199\u4E00\u4EFD AI \u5DE5\u5177\u5165\u95E8\u6307\u5357",
|
|
261
|
+
"\u628A\u4E00\u4E2A\u5DE5\u4F5C\u65B9\u6CD5\u8BB2\u6E05\u695A\uFF0C\u9644\u4E0A\u5177\u4F53\u4F8B\u5B50"
|
|
262
|
+
].map((x) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setIdea(x), children: x }, x)) }),
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { className: "source-picker", children: [
|
|
264
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
|
|
265
|
+
"\u6DFB\u52A0\u53C2\u8003\u7D20\u6750\uFF08\u53EF\u9009\uFF09",
|
|
266
|
+
ids.length + files.length > 0 ? ` \xB7 \u5DF2\u9009 ${ids.length + files.length} \u4EFD` : ""
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "field", children: [
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u7C98\u8D34\u53C2\u8003\u7D20\u6750" }),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
271
|
+
"textarea",
|
|
272
|
+
{
|
|
273
|
+
value: materialText,
|
|
274
|
+
maxLength: 1e6,
|
|
275
|
+
onChange: (e) => setMaterialText(e.target.value),
|
|
276
|
+
placeholder: "\u539F\u59CB\u7B14\u8BB0\u3001\u53C2\u8003\u6587\u7AE0\u3001\u4E8B\u5B9E\u6216\u6570\u636E\u3002\u4F1A\u81EA\u52A8\u4FDD\u5B58\u5230\u7D20\u6750\u5E93\u5E76\u5173\u8054\u8FD9\u7BC7\u6587\u7AE0\u3002"
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "field", children: [
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u53C2\u8003\u94FE\u63A5" }),
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
283
|
+
"input",
|
|
284
|
+
{
|
|
285
|
+
type: "url",
|
|
286
|
+
value: url,
|
|
287
|
+
onChange: (e) => setUrl(e.target.value),
|
|
288
|
+
placeholder: "https://\u2026"
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
] }),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "field", children: [
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u6DFB\u52A0 Markdown / TXT \u6587\u4EF6" }),
|
|
294
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
295
|
+
"input",
|
|
296
|
+
{
|
|
297
|
+
type: "file",
|
|
298
|
+
accept: ".md,.txt",
|
|
299
|
+
multiple: true,
|
|
300
|
+
onChange: (e) => setFiles(Array.from(e.target.files || []))
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
] }),
|
|
304
|
+
materials.filter((m) => !m.deleted && m.type !== "image").length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "\u4ECE\u5DF2\u6709\u7D20\u6750\u9009\u62E9" }),
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "source-list", children: materials.filter((m) => !m.deleted && m.type !== "image").map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "check", children: [
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
308
|
+
"input",
|
|
309
|
+
{
|
|
310
|
+
type: "checkbox",
|
|
311
|
+
checked: ids.includes(m.id),
|
|
312
|
+
onChange: (e) => setIds(
|
|
313
|
+
e.target.checked ? [...ids, m.id] : ids.filter((id) => id !== m.id)
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
m.title
|
|
318
|
+
] }, m.id)) })
|
|
319
|
+
] })
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "start-actions", children: [
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "field", children: [
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u53D1\u5E03\u5E73\u53F0" }),
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: platformName(platform) })
|
|
325
|
+
] }),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
327
|
+
"button",
|
|
328
|
+
{
|
|
329
|
+
className: "primary",
|
|
330
|
+
type: "submit",
|
|
331
|
+
disabled: !idea.trim() || !!phase,
|
|
332
|
+
children: phase || "\u5F00\u59CB\u521B\u4F5C \u2192"
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] })
|
|
336
|
+
] }),
|
|
337
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "inline-error", role: "alert", children: [
|
|
338
|
+
error,
|
|
339
|
+
"\u3002\u8F93\u5165\u5DF2\u4FDD\u7559\uFF0C\u53EF\u4FEE\u6539\u540E\u91CD\u8BD5\u3002"
|
|
340
|
+
] }),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "composer-note", role: "status", children: phase || `\u4F7F\u7528 ${model} \xB7 \u81EA\u52A8\u5EFA\u7ACB\u9879\u76EE\u5E76\u751F\u6210\u521D\u7A3F \xB7 \u751F\u6210\u540E\u53EF\u7EE7\u7EED\u5BF9\u8BDD\u4FEE\u6539` })
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
] });
|
|
346
|
+
}
|
|
347
|
+
function GenerationProgress({
|
|
348
|
+
tasks,
|
|
349
|
+
run
|
|
350
|
+
}) {
|
|
351
|
+
const api = useStudioApi();
|
|
352
|
+
const flow = tasks.find((t) => t.step === "compose");
|
|
353
|
+
if (!flow) return null;
|
|
354
|
+
const children = tasks.filter((t) => t.input.parentId === flow.id).reverse();
|
|
355
|
+
const labels = [
|
|
356
|
+
"\u7F16\u8F91\u7B80\u62A5",
|
|
357
|
+
"\u751F\u6210\u63D0\u7EB2",
|
|
358
|
+
"\u751F\u6210\u5019\u9009\u7A3F",
|
|
359
|
+
...flow.input.both ? ["\u5E73\u53F0\u9002\u914D"] : [],
|
|
360
|
+
"\u5185\u5BB9\u5BA1\u9605"
|
|
361
|
+
];
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
363
|
+
"section",
|
|
364
|
+
{
|
|
365
|
+
className: "generation-progress",
|
|
366
|
+
"aria-label": "AI \u521B\u4F5C\u8FDB\u5EA6",
|
|
367
|
+
"aria-busy": active(flow),
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "section-title", children: [
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: active(flow) ? "AI \u6B63\u5728\u521B\u4F5C" : flow.status === "completed" ? "\u521D\u7A3F\u5DF2\u5C31\u7EEA\uFF0C\u7EE7\u7EED\u804A\u804A\u600E\u4E48\u6539" : "\u751F\u6210\u5DF2\u505C\u6B62\uFF0C\u5DF2\u5B8C\u6210\u7684\u5185\u5BB9\u90FD\u5DF2\u4FDD\u7559" }),
|
|
371
|
+
active(flow) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
372
|
+
"button",
|
|
373
|
+
{
|
|
374
|
+
onClick: () => run(() => api("task.cancel", { id: flow.id })),
|
|
375
|
+
children: "\u505C\u6B62\u751F\u6210"
|
|
376
|
+
}
|
|
377
|
+
) : flow.status !== "completed" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
378
|
+
"button",
|
|
379
|
+
{
|
|
380
|
+
onClick: () => run(() => api("task.retry", { id: flow.id })),
|
|
381
|
+
children: "\u91CD\u65B0\u751F\u6210"
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
] }),
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "generation-steps", children: labels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
386
|
+
"li",
|
|
387
|
+
{
|
|
388
|
+
className: children[i]?.status === "completed" ? "done" : children[i] && active(children[i]) ? "current" : "",
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: children[i]?.status === "completed" ? "\u2713" : i + 1 }),
|
|
391
|
+
label
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
label
|
|
395
|
+
)) }),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: flow.error || children.find(active)?.phase || flow.phase }),
|
|
397
|
+
active(flow) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: "\u53EF\u6D4F\u89C8\u5176\u4ED6\u9875\u9762\uFF0C\u540E\u53F0\u4F1A\u7EE7\u7EED\u751F\u6210\u3002\u6BCF\u4E00\u6B65\u5B8C\u6210\u540E\uFF0C\u7A3F\u4EF6\u548C\u63D0\u7EB2\u4F1A\u81EA\u52A8\u66F4\u65B0\u3002" })
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
function EditConversation({
|
|
403
|
+
tasks,
|
|
404
|
+
platform,
|
|
405
|
+
selection,
|
|
406
|
+
pending,
|
|
407
|
+
submit,
|
|
408
|
+
compare
|
|
409
|
+
}) {
|
|
410
|
+
const [text, setText] = (0, import_react2.useState)("");
|
|
411
|
+
const [error, setError] = (0, import_react2.useState)("");
|
|
412
|
+
const [sending, setSending] = (0, import_react2.useState)(false);
|
|
413
|
+
const lock = (0, import_react2.useRef)(false);
|
|
414
|
+
const send = async (adapt = false) => {
|
|
415
|
+
if (lock.current || pending || !adapt && !text.trim()) return;
|
|
416
|
+
lock.current = true;
|
|
417
|
+
setSending(true);
|
|
418
|
+
setError("");
|
|
419
|
+
try {
|
|
420
|
+
await submit(
|
|
421
|
+
adapt ? "\u6309\u5F53\u524D\u8D26\u53F7\u5728\u5F53\u524D\u5E73\u53F0\u7684\u5B9A\u4F4D\u3001\u8BED\u6C14\u548C\u89C4\u5219\u9002\u914D\u8FD9\u7BC7\u6587\u7AE0\uFF0C\u4FDD\u7559\u6838\u5FC3\u89C2\u70B9\u4E0E\u8BC1\u636E\u3002" : text,
|
|
422
|
+
adapt
|
|
423
|
+
);
|
|
424
|
+
setText("");
|
|
425
|
+
} catch (e) {
|
|
426
|
+
setError(e.message);
|
|
427
|
+
} finally {
|
|
428
|
+
lock.current = false;
|
|
429
|
+
setSending(false);
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
const history = tasks.filter(
|
|
433
|
+
(t) => t.platform === platform && (t.input.proposal || t.step === "chat")
|
|
434
|
+
).slice(0, 20).reverse();
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "panel ai-conversation", children: [
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "eyebrow", children: "\u4E00\u8D77\u628A\u6587\u7AE0\u5199\u597D" }),
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "\u548C AI \u804A\u804A\u8FD9\u7BC7\u7A3F" }),
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "muted", children: [
|
|
439
|
+
"\u5F53\u524D\uFF1A",
|
|
440
|
+
platformName(platform),
|
|
441
|
+
"\u3002\u4FEE\u6539\u5148\u7ED9\u4F60\u770B\uFF0C\u91C7\u7528\u540E\u624D\u66F4\u65B0\u6B63\u6587\u3002"
|
|
442
|
+
] }),
|
|
443
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "conversation-history", role: "log", "aria-label": "\u6539\u7A3F\u5BF9\u8BDD", children: [
|
|
444
|
+
!history.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "assistant-welcome", children: "\u4F60\u53EF\u4EE5\u8BF4\u300C\u5F00\u5934\u76F4\u63A5\u4E00\u70B9\u300D\uFF0C\u4E5F\u53EF\u4EE5\u9009\u4E2D\u6B63\u6587\u7684\u4E00\u6BB5\uFF0C\u8BA9\u6211\u53EA\u6539\u90A3\u91CC\u3002" }),
|
|
445
|
+
history.map((t) => {
|
|
446
|
+
const result = t.result;
|
|
447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "conversation-turn", children: [
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "user-message", children: [
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: "\u4F60" }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: String(t.input.instruction || steps[t.step]?.label) })
|
|
451
|
+
] }),
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "assistant-message", children: [
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: "AI \u7F16\u8F91" }),
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: active(t) ? t.phase : t.error || (result?.version ? "\u4FEE\u6539\u5EFA\u8BAE\u5DF2\u751F\u6210\u3002\u6BD4\u8F83\u540E\u53EF\u4EE5\u91C7\u7528\uFF0C\u4E5F\u53EF\u4EE5\u4FDD\u7559\u5F53\u524D\u7A3F\u4EF6\u3002" : t.phase) }),
|
|
455
|
+
result?.comments?.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: c }, i)),
|
|
456
|
+
result?.questions?.map((q, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
457
|
+
"\u5F85\u8865\u5145\uFF1A",
|
|
458
|
+
q
|
|
459
|
+
] }, i)),
|
|
460
|
+
result?.version && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { onClick: () => compare(result.version), children: "\u6BD4\u8F83\u4E0E\u91C7\u7528\u4FEE\u6539" })
|
|
461
|
+
] })
|
|
462
|
+
] }, t.id);
|
|
463
|
+
})
|
|
464
|
+
] }),
|
|
465
|
+
selection && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "selection-hint", children: [
|
|
466
|
+
"\u53EA\u4FEE\u6539\u9009\u4E2D\u7684 ",
|
|
467
|
+
selection.length,
|
|
468
|
+
" \u5B57\u7B26\uFF1A",
|
|
469
|
+
selection.slice(0, 70),
|
|
470
|
+
selection.length > 70 ? "\u2026" : ""
|
|
471
|
+
] }),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
473
|
+
"form",
|
|
474
|
+
{
|
|
475
|
+
onSubmit: (e) => {
|
|
476
|
+
e.preventDefault();
|
|
477
|
+
void send();
|
|
478
|
+
},
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "field", children: [
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u4F60\u7684\u6539\u7A3F\u8981\u6C42\u6216\u95EE\u9898" }),
|
|
482
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
483
|
+
"textarea",
|
|
484
|
+
{
|
|
485
|
+
value: text,
|
|
486
|
+
maxLength: 1e4,
|
|
487
|
+
onChange: (e) => setText(e.target.value),
|
|
488
|
+
placeholder: "\u5F00\u5934\u592A\u957F\u4E86\uFF0C\u76F4\u63A5\u8BF4\u7ED3\u8BBA\uFF1B\u4FDD\u7559\u6211\u7684\u89C2\u70B9\u3002"
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
] }),
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "chat-suggestions", children: ["\u5F00\u5934\u76F4\u63A5\u8BF4\u7ED3\u8BBA", "\u4FDD\u7559\u89C2\u70B9\uFF0C\u8868\u8FBE\u66F4\u81EA\u7136", "\u8FD9\u7BC7\u7A3F\u8FD8\u7F3A\u5C11\u4EC0\u4E48\uFF1F"].map(
|
|
493
|
+
(x) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setText(x), children: x }, x)
|
|
494
|
+
) }),
|
|
495
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "inline-error", role: "alert", children: error }),
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
497
|
+
"button",
|
|
498
|
+
{
|
|
499
|
+
type: "submit",
|
|
500
|
+
className: "primary",
|
|
501
|
+
disabled: pending || sending || !text.trim(),
|
|
502
|
+
children: sending ? "\u6B63\u5728\u53D1\u9001\u2026" : pending ? "AI \u6B63\u5728\u5904\u7406\u2026" : selection ? "\u53D1\u9001\u5E76\u6539\u5199\u9009\u6BB5" : "\u53D1\u9001\u7ED9 AI"
|
|
503
|
+
}
|
|
504
|
+
),
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
506
|
+
"button",
|
|
507
|
+
{
|
|
508
|
+
type: "button",
|
|
509
|
+
disabled: pending || sending,
|
|
510
|
+
onClick: () => void send(true),
|
|
511
|
+
children: "\u6309\u5E73\u53F0\u98CE\u683C\u9002\u914D"
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
] });
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// client/index.tsx
|
|
521
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
522
|
+
var names = {
|
|
523
|
+
home: "\u5DE5\u4F5C\u53F0",
|
|
524
|
+
topics: "\u9009\u9898\u5E93",
|
|
525
|
+
materials: "\u7D20\u6750\u5E93",
|
|
526
|
+
editor: "\u5185\u5BB9\u7F16\u8F91",
|
|
527
|
+
exports: "\u5BFC\u51FA",
|
|
528
|
+
settings: "\u8BBE\u7F6E"
|
|
529
|
+
};
|
|
530
|
+
var origins = [
|
|
531
|
+
"\u7528\u6237\u539F\u521B",
|
|
532
|
+
"\u7528\u6237\u4EB2\u5386",
|
|
533
|
+
"\u516C\u5F00\u8D44\u6599",
|
|
534
|
+
"\u53C2\u8003\u6587\u7AE0",
|
|
535
|
+
"\u6A21\u578B\u751F\u6210",
|
|
536
|
+
"\u5F85\u786E\u8BA4\u5185\u5BB9"
|
|
537
|
+
];
|
|
538
|
+
var textCategories = [
|
|
539
|
+
"\u4E8B\u5B9E",
|
|
540
|
+
"\u6570\u636E",
|
|
541
|
+
"\u5F15\u8BED",
|
|
542
|
+
"\u6848\u4F8B",
|
|
543
|
+
"\u89C2\u70B9",
|
|
544
|
+
"\u7075\u611F",
|
|
545
|
+
"\u53C2\u8003\u7ED3\u6784",
|
|
546
|
+
"\u5F85\u6838\u5B9E\u4FE1\u606F"
|
|
547
|
+
];
|
|
548
|
+
var imageCategories = [
|
|
549
|
+
"\u622A\u56FE",
|
|
550
|
+
"\u4EA7\u54C1\u754C\u9762",
|
|
551
|
+
"\u6570\u636E\u56FE",
|
|
552
|
+
"\u5C01\u9762",
|
|
553
|
+
"\u63D2\u56FE",
|
|
554
|
+
"\u7167\u7247",
|
|
555
|
+
"\u5176\u4ED6"
|
|
556
|
+
];
|
|
557
|
+
function Field({
|
|
558
|
+
label,
|
|
559
|
+
value,
|
|
560
|
+
onChange,
|
|
561
|
+
multi = false,
|
|
562
|
+
type = "text"
|
|
563
|
+
}) {
|
|
564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label }),
|
|
566
|
+
multi ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
567
|
+
"textarea",
|
|
568
|
+
{
|
|
569
|
+
"aria-label": label,
|
|
570
|
+
value,
|
|
571
|
+
onChange: (e) => onChange(e.target.value)
|
|
572
|
+
}
|
|
573
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
574
|
+
"input",
|
|
575
|
+
{
|
|
576
|
+
type,
|
|
577
|
+
"aria-label": label,
|
|
578
|
+
value,
|
|
579
|
+
onChange: (e) => onChange(e.target.value)
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
] });
|
|
583
|
+
}
|
|
584
|
+
function Select({
|
|
585
|
+
label,
|
|
586
|
+
value,
|
|
587
|
+
onChange,
|
|
588
|
+
items
|
|
589
|
+
}) {
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label }),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
593
|
+
"select",
|
|
594
|
+
{
|
|
595
|
+
"aria-label": label,
|
|
596
|
+
value,
|
|
597
|
+
onChange: (e) => onChange(e.target.value),
|
|
598
|
+
children: items.map((x) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { children: x }, x))
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
] });
|
|
602
|
+
}
|
|
603
|
+
function JsonEditor({
|
|
604
|
+
label,
|
|
605
|
+
value,
|
|
606
|
+
save
|
|
607
|
+
}) {
|
|
608
|
+
const [text, setText] = (0, import_react3.useState)(JSON.stringify(value, null, 2)), [error, setError] = (0, import_react3.useState)("");
|
|
609
|
+
(0, import_react3.useEffect)(() => setText(JSON.stringify(value, null, 2)), [value]);
|
|
610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: label }),
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u4FDD\u7559\u5B57\u6BB5\u540D\uFF1B\u7A7A\u6570\u636E\u4F7F\u7528 null\uFF0C\u6570\u503C 0 \u8868\u793A\u786E\u5B9E\u4E3A\u96F6\u3002" }),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
614
|
+
"textarea",
|
|
615
|
+
{
|
|
616
|
+
className: "json",
|
|
617
|
+
value: text,
|
|
618
|
+
onChange: (e) => setText(e.target.value)
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
onClick: () => {
|
|
625
|
+
try {
|
|
626
|
+
save(JSON.parse(text));
|
|
627
|
+
setError("");
|
|
628
|
+
} catch {
|
|
629
|
+
setError("JSON \u683C\u5F0F\u6709\u8BEF");
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
children: "\u4FDD\u5B58\u8BB0\u5F55"
|
|
633
|
+
}
|
|
634
|
+
),
|
|
635
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { role: "alert", children: error })
|
|
636
|
+
] });
|
|
637
|
+
}
|
|
638
|
+
function App() {
|
|
639
|
+
const [scope, setScope] = (0, import_react3.useState)(() => {
|
|
640
|
+
try {
|
|
641
|
+
const saved = JSON.parse(
|
|
642
|
+
sessionStorage.getItem("content-studio-scope") || "null"
|
|
643
|
+
);
|
|
644
|
+
if (saved && typeof saved.accountId === "string" && ["wechat", "xiaohongshu"].includes(saved.platform))
|
|
645
|
+
return saved;
|
|
646
|
+
} catch {
|
|
647
|
+
}
|
|
648
|
+
return { accountId: "default", platform: "wechat" };
|
|
649
|
+
});
|
|
650
|
+
const api = (0, import_react3.useMemo)(
|
|
651
|
+
() => createApi(scope),
|
|
652
|
+
[scope.accountId, scope.platform]
|
|
653
|
+
);
|
|
654
|
+
const changeScope = (next) => {
|
|
655
|
+
try {
|
|
656
|
+
sessionStorage.setItem("content-studio-scope", JSON.stringify(next));
|
|
657
|
+
} catch {
|
|
658
|
+
}
|
|
659
|
+
setScope(next);
|
|
660
|
+
};
|
|
661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StudioApiProvider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
662
|
+
Workspace,
|
|
663
|
+
{
|
|
664
|
+
scope,
|
|
665
|
+
changeScope
|
|
666
|
+
},
|
|
667
|
+
scope.accountId + ":" + scope.platform
|
|
668
|
+
) });
|
|
669
|
+
}
|
|
670
|
+
function Workspace({
|
|
671
|
+
scope,
|
|
672
|
+
changeScope
|
|
673
|
+
}) {
|
|
674
|
+
const api = useStudioApi();
|
|
675
|
+
const [data, setData] = (0, import_react3.useState)(), [page, setPage] = (0, import_react3.useState)("home"), [pid, setPid] = (0, import_react3.useState)(""), [initialPlatform, setInitialPlatform] = (0, import_react3.useState)(scope.platform), [error, setError] = (0, import_react3.useState)(""), [message, setMessage] = (0, import_react3.useState)(""), [busy, setBusy] = (0, import_react3.useState)(false), [caps, setCaps] = (0, import_react3.useState)();
|
|
676
|
+
const beforeLeave = (0, import_react3.useRef)(async () => {
|
|
677
|
+
});
|
|
678
|
+
const reload = async () => setData(await api("snapshot"));
|
|
679
|
+
const run = async (fn) => {
|
|
680
|
+
setBusy(true);
|
|
681
|
+
setError("");
|
|
682
|
+
try {
|
|
683
|
+
await fn();
|
|
684
|
+
await reload();
|
|
685
|
+
} catch (e) {
|
|
686
|
+
setError(e.message);
|
|
687
|
+
} finally {
|
|
688
|
+
setBusy(false);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
(0, import_react3.useEffect)(() => {
|
|
692
|
+
void run(async () => {
|
|
693
|
+
await reload();
|
|
694
|
+
setCaps(await api("capabilities"));
|
|
695
|
+
});
|
|
696
|
+
const interval = setInterval(() => {
|
|
697
|
+
void reload().catch(() => {
|
|
698
|
+
});
|
|
699
|
+
}, 2500);
|
|
700
|
+
return () => clearInterval(interval);
|
|
701
|
+
}, []);
|
|
702
|
+
const go = (to, id = pid) => void run(async () => {
|
|
703
|
+
await beforeLeave.current();
|
|
704
|
+
setPid(id);
|
|
705
|
+
setPage(to);
|
|
706
|
+
});
|
|
707
|
+
const p = data?.projects.find((p2) => p2.id === pid);
|
|
708
|
+
const create = () => void run(async () => {
|
|
709
|
+
const name = window.prompt("\u5185\u5BB9\u9879\u76EE\u540D\u79F0");
|
|
710
|
+
if (!name?.trim()) return;
|
|
711
|
+
const p2 = await api("project.create", { name });
|
|
712
|
+
setPid(p2.id);
|
|
713
|
+
setPage("editor");
|
|
714
|
+
});
|
|
715
|
+
const switchScope = (next) => void run(async () => {
|
|
716
|
+
await beforeLeave.current();
|
|
717
|
+
changeScope(next);
|
|
718
|
+
});
|
|
719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "cs", children: [
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("link", { rel: "stylesheet", href: "/content-studio-api/style.css" }),
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "cs-header", children: [
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "eyebrow", children: "CONTENT STUDIO" }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h1", { children: [
|
|
725
|
+
"\u5185\u5BB9\u5DE5\u4F5C\u53F0",
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u628A\u60F3\u6CD5\u5199\u6210\u4F5C\u54C1" })
|
|
727
|
+
] })
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: create, children: "\u65B0\u5EFA\u7A7A\u767D\u7A3F" }),
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "primary", onClick: () => go("home"), children: "\uFF0B AI \u521B\u4F5C" })
|
|
732
|
+
] })
|
|
733
|
+
] }),
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "workspace-bar", "aria-label": "\u8D26\u53F7\u4E0E\u5E73\u53F0\u5DE5\u4F5C\u533A", children: [
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5F53\u524D\u8D26\u53F7" }),
|
|
737
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
738
|
+
"select",
|
|
739
|
+
{
|
|
740
|
+
"aria-label": "\u5F53\u524D\u8D26\u53F7",
|
|
741
|
+
value: scope.accountId,
|
|
742
|
+
disabled: busy || !data,
|
|
743
|
+
onChange: (e) => switchScope({ ...scope, accountId: e.target.value }),
|
|
744
|
+
children: data ? data.accounts.map((a) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: a.id, children: a.name }, a.id)) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: scope.accountId, children: "\u6B63\u5728\u8BFB\u53D6\u8D26\u53F7\u2026" })
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
] }),
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
749
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5F53\u524D\u5E73\u53F0" }),
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
751
|
+
"select",
|
|
752
|
+
{
|
|
753
|
+
"aria-label": "\u5F53\u524D\u5E73\u53F0",
|
|
754
|
+
value: scope.platform,
|
|
755
|
+
disabled: busy,
|
|
756
|
+
onChange: (e) => switchScope({ ...scope, platform: e.target.value }),
|
|
757
|
+
children: [
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "wechat", children: "\u516C\u4F17\u53F7" }),
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "xiaohongshu", children: "\u5C0F\u7EA2\u4E66" })
|
|
760
|
+
]
|
|
761
|
+
}
|
|
762
|
+
)
|
|
763
|
+
] }),
|
|
764
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { disabled: busy, onClick: () => go("settings"), children: "\u8D26\u53F7\u4E0E\u5E73\u53F0\u8BBE\u7F6E" }),
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: data?.account.positioning || "\u4E3A\u6BCF\u4E2A\u8D26\u53F7\u5EFA\u7ACB\u5B9A\u4F4D\uFF0C\u4E3A\u6BCF\u4E2A\u5E73\u53F0\u4FDD\u7559\u81EA\u5DF1\u7684\u8868\u8FBE\u3002" })
|
|
766
|
+
] }),
|
|
767
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("nav", { "aria-label": "\u5185\u5BB9\u5DE5\u4F5C\u53F0\u5BFC\u822A", children: Object.entries(names).map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
768
|
+
"button",
|
|
769
|
+
{
|
|
770
|
+
className: page === key ? "active" : "",
|
|
771
|
+
onClick: () => go(key),
|
|
772
|
+
children: label
|
|
773
|
+
},
|
|
774
|
+
key
|
|
775
|
+
)) }),
|
|
776
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "alert", role: "alert", children: [
|
|
777
|
+
error,
|
|
778
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => void run(reload), children: "\u91CD\u65B0\u8FDE\u63A5" }),
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => setError(""), children: "\u5173\u95ED" }),
|
|
780
|
+
!data && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
781
|
+
"button",
|
|
782
|
+
{
|
|
783
|
+
onClick: () => changeScope({ accountId: "default", platform: "wechat" }),
|
|
784
|
+
children: "\u8FD4\u56DE\u9ED8\u8BA4\u5DE5\u4F5C\u533A"
|
|
785
|
+
}
|
|
786
|
+
)
|
|
787
|
+
] }),
|
|
788
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "notice", role: "status", children: [
|
|
789
|
+
message,
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => setMessage(""), children: "\u5173\u95ED" })
|
|
791
|
+
] }),
|
|
792
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "saving", role: "status", children: "\u6B63\u5728\u5904\u7406\u2026" }),
|
|
793
|
+
!data ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "empty", children: "\u6B63\u5728\u8BFB\u53D6\u672C\u5730\u5185\u5BB9\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("main", { children: [
|
|
794
|
+
page === "home" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
796
|
+
CreateWithAI,
|
|
797
|
+
{
|
|
798
|
+
platform: scope.platform,
|
|
799
|
+
materials: data.materials,
|
|
800
|
+
model: data.settings.model,
|
|
801
|
+
open: async (project, platform) => {
|
|
802
|
+
await reload();
|
|
803
|
+
setInitialPlatform(platform);
|
|
804
|
+
setPid(project.id);
|
|
805
|
+
setPage("editor");
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "section-title", children: [
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u7EE7\u7EED\u521B\u4F5C" }),
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => go("materials"), children: "\u6536\u96C6\u7D20\u6750 \u2192" })
|
|
812
|
+
] }),
|
|
813
|
+
data.projects.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "project-grid", children: data.projects.filter((p2) => !p2.archived).map((p2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
className: "project-card",
|
|
817
|
+
onClick: () => go("editor", p2.id),
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "badge", children: p2.stage }),
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: p2.name }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: p2.question || "\u4ECE\u4E00\u4E2A\u503C\u5F97\u56DE\u7B54\u7684\u95EE\u9898\u5F00\u59CB" }),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
823
|
+
p2.materialIds.length,
|
|
824
|
+
" \u4EFD\u7D20\u6750 \xB7 ",
|
|
825
|
+
date(p2.updatedAt),
|
|
826
|
+
" ",
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7EE7\u7EED\u7F16\u8F91 \u2197" })
|
|
828
|
+
] })
|
|
829
|
+
]
|
|
830
|
+
},
|
|
831
|
+
p2.id
|
|
832
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "empty", children: [
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u7B2C\u4E00\u7BC7\u4F5C\u54C1\uFF0C\u4ECE\u4E00\u6761\u60F3\u6CD5\u5F00\u59CB" }),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u5728\u4E0A\u65B9\u8BF4\u8BF4\u4F60\u7684\u60F3\u6CD5\uFF0CAI \u4F1A\u5E2E\u4F60\u5EFA\u7ACB\u9879\u76EE\u5E76\u5199\u51FA\u521D\u7A3F\u3002" }),
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: create, children: "\u4ECE\u7A7A\u767D\u7A3F\u624B\u52A8\u5F00\u59CB" }),
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
837
|
+
"button",
|
|
838
|
+
{
|
|
839
|
+
onClick: () => void run(async () => {
|
|
840
|
+
const p2 = await api("example.create");
|
|
841
|
+
go("editor", p2.id);
|
|
842
|
+
}),
|
|
843
|
+
children: "\u8F7D\u5165\u53EF\u5220\u9664\u7684\u793A\u4F8B"
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u7D20\u6750\u6574\u7406\u4E0E\u5F85\u786E\u8BA4\u4E8B\u9879" }),
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u5F85\u5904\u7406\u7D20\u6750" }),
|
|
852
|
+
data.materials.filter(
|
|
853
|
+
(m) => !m.deleted && !data.projects.some(
|
|
854
|
+
(p2) => p2.materialIds.includes(m.id)
|
|
855
|
+
)
|
|
856
|
+
).slice(0, 5).map((m) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "row", children: [
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: m.title }),
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => go("materials"), children: "\u6574\u7406" })
|
|
859
|
+
] }, m.id))
|
|
860
|
+
] }),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u5F85\u4F5C\u8005\u786E\u8BA4" }),
|
|
863
|
+
data.projects.flatMap(
|
|
864
|
+
(p2) => p2.questions.map((q, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "row", children: [
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: q }),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => go("editor", p2.id), children: p2.name })
|
|
867
|
+
] }, p2.id + i))
|
|
868
|
+
)
|
|
869
|
+
] })
|
|
870
|
+
] })
|
|
871
|
+
] }),
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u5DF2\u5F52\u6863\u9879\u76EE\uFF08\u53EF\u6062\u590D\uFF09" }),
|
|
874
|
+
data.projects.filter((p2) => p2.archived).map((p2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "row", children: [
|
|
875
|
+
p2.name,
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
877
|
+
"button",
|
|
878
|
+
{
|
|
879
|
+
onClick: () => run(
|
|
880
|
+
() => api("project.update", {
|
|
881
|
+
id: p2.id,
|
|
882
|
+
revision: p2.revision,
|
|
883
|
+
project: { ...p2, archived: false }
|
|
884
|
+
})
|
|
885
|
+
),
|
|
886
|
+
children: "\u6062\u590D\u9879\u76EE"
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
] }, p2.id))
|
|
890
|
+
] }),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Tasks, { tasks: data.tasks, run })
|
|
892
|
+
] }),
|
|
893
|
+
page === "materials" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Materials, { data, pid, setPid, run }),
|
|
894
|
+
page === "topics" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Topics, { data, run, open: (id) => go("editor", id) }),
|
|
895
|
+
page === "editor" && (p ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
896
|
+
Editor,
|
|
897
|
+
{
|
|
898
|
+
initialPlatform,
|
|
899
|
+
p,
|
|
900
|
+
data,
|
|
901
|
+
run,
|
|
902
|
+
reload,
|
|
903
|
+
beforeLeave,
|
|
904
|
+
message: setMessage,
|
|
905
|
+
exportPage: () => go("exports"),
|
|
906
|
+
switchScope
|
|
907
|
+
},
|
|
908
|
+
p.id
|
|
909
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Choose, { data, choose: (id) => go("editor", id) })),
|
|
910
|
+
page === "exports" && (p ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Exports, { p, run, data }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Choose, { data, choose: (id) => go("exports", id) })),
|
|
911
|
+
page === "settings" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
912
|
+
SettingsPage,
|
|
913
|
+
{
|
|
914
|
+
data,
|
|
915
|
+
caps,
|
|
916
|
+
run,
|
|
917
|
+
switchScope
|
|
918
|
+
}
|
|
919
|
+
)
|
|
920
|
+
] }, scope.accountId + scope.platform),
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("footer", { children: "\u672C\u5730\u4F18\u5148 \xB7 dsh 0.2.2-rc.1 \xB7 \u53D1\u5E03\u524D\u7531\u4F5C\u8005\u7EC8\u5BA1" })
|
|
922
|
+
] });
|
|
923
|
+
}
|
|
924
|
+
function Choose({
|
|
925
|
+
data,
|
|
926
|
+
choose
|
|
927
|
+
}) {
|
|
928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "empty", children: [
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u9009\u62E9\u4E00\u4E2A\u5185\u5BB9\u9879\u76EE" }),
|
|
930
|
+
data.projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => choose(p.id), children: p.name }, p.id)),
|
|
931
|
+
!data.projects.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u5148\u65B0\u5EFA\u4E00\u4E2A\u5185\u5BB9\u9879\u76EE\u3002" })
|
|
932
|
+
] });
|
|
933
|
+
}
|
|
934
|
+
function Tasks({
|
|
935
|
+
tasks,
|
|
936
|
+
run
|
|
937
|
+
}) {
|
|
938
|
+
const api = useStudioApi();
|
|
939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "tasks", children: [
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u4EFB\u52A1\u8BB0\u5F55" }),
|
|
941
|
+
!tasks.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u8FD0\u884C\u4E00\u4E2A\u521B\u4F5C\u6B65\u9AA4\u540E\uFF0C\u8FD9\u91CC\u4F1A\u4FDD\u7559\u8F93\u5165\u3001\u8FDB\u5EA6\u548C\u7ED3\u679C\u3002" }),
|
|
942
|
+
tasks.slice(0, 30).map((t) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("summary", { children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "badge", children: {
|
|
945
|
+
queued: "\u6392\u961F",
|
|
946
|
+
running: "\u6267\u884C\u4E2D",
|
|
947
|
+
completed: "\u5B8C\u6210",
|
|
948
|
+
failed: "\u5931\u8D25",
|
|
949
|
+
cancelled: "\u5DF2\u53D6\u6D88",
|
|
950
|
+
interrupted: "\u5DF2\u4E2D\u65AD"
|
|
951
|
+
}[t.status] }),
|
|
952
|
+
" ",
|
|
953
|
+
steps[t.step]?.label || t.step,
|
|
954
|
+
" \xB7 ",
|
|
955
|
+
t.phase,
|
|
956
|
+
" ",
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: date(t.createdAt) })
|
|
958
|
+
] }),
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { children: [
|
|
960
|
+
"\u5DF2\u5B8C\u6210\uFF1A",
|
|
961
|
+
t.completed.join(" \u2192 ")
|
|
962
|
+
] }),
|
|
963
|
+
t.error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "alert", children: t.error }),
|
|
964
|
+
Boolean(t.usage) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { children: [
|
|
965
|
+
"\u5BBF\u4E3B\u5B9E\u9645\u7528\u91CF\uFF1A",
|
|
966
|
+
JSON.stringify(t.usage),
|
|
967
|
+
"\uFF1B\u8D39\u7528\u672A\u63D0\u4F9B\u3002"
|
|
968
|
+
] }),
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "actions", children: ["queued", "running"].includes(t.status) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
970
|
+
"button",
|
|
971
|
+
{
|
|
972
|
+
onClick: () => run(() => api("task.cancel", { id: t.id })),
|
|
973
|
+
children: "\u53D6\u6D88\u4EFB\u52A1"
|
|
974
|
+
}
|
|
975
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
onClick: () => run(() => api("task.retry", { id: t.id })),
|
|
979
|
+
children: "\u91CD\u8DD1\u6B64\u6B65\u9AA4\uFF08\u4F7F\u7528\u5F53\u524D\u7A3F\u4EF6\uFF09"
|
|
980
|
+
}
|
|
981
|
+
) }),
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u8F93\u5165\u4E0E\u4E2D\u95F4\u4EA7\u7269" }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: JSON.stringify(t.input, null, 2) }),
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: t.partial }),
|
|
986
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: JSON.stringify(t.result, null, 2) })
|
|
987
|
+
] })
|
|
988
|
+
] }, t.id))
|
|
989
|
+
] });
|
|
990
|
+
}
|
|
991
|
+
function Materials({
|
|
992
|
+
data,
|
|
993
|
+
pid,
|
|
994
|
+
setPid,
|
|
995
|
+
run
|
|
996
|
+
}) {
|
|
997
|
+
const api = useStudioApi();
|
|
998
|
+
const [q, Q] = (0, import_react3.useState)(""), [type, T] = (0, import_react3.useState)(""), [tag, G] = (0, import_react3.useState)(""), [grid, Grid] = (0, import_react3.useState)(false), [deleted, D] = (0, import_react3.useState)(false), [selected, S] = (0, import_react3.useState)([]), [edit, E] = (0, import_react3.useState)(), [text, Text] = (0, import_react3.useState)(""), [url, Url] = (0, import_react3.useState)(""), [title, Title] = (0, import_react3.useState)(""), [projectFilter, PF] = (0, import_react3.useState)("");
|
|
999
|
+
const importFiles = (files) => run(async () => {
|
|
1000
|
+
for (const file of Array.from(files)) {
|
|
1001
|
+
if (file.size > 20 * 1024 * 1024)
|
|
1002
|
+
throw Error(file.name + " \u8D85\u8FC7 20 MB");
|
|
1003
|
+
const image = /\.(png|jpe?g|gif|webp)$/i.test(file.name);
|
|
1004
|
+
if (!image && !/\.(md|txt)$/i.test(file.name))
|
|
1005
|
+
throw Error("\u4EC5\u652F\u6301 Markdown\u3001TXT\u3001PNG\u3001JPEG\u3001WebP\u3001GIF");
|
|
1006
|
+
await api("material.import", {
|
|
1007
|
+
title: file.name,
|
|
1008
|
+
filename: file.name,
|
|
1009
|
+
source: file.name,
|
|
1010
|
+
type: image ? "image" : "text",
|
|
1011
|
+
...image ? { base64: await base64(file), category: "\u5176\u4ED6" } : { text: await file.text(), base64: await base64(file) }
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
const rows = data.materials.filter(
|
|
1016
|
+
(m) => m.deleted === deleted && (!type || m.type === type) && (!tag || m.tags.includes(tag)) && (!projectFilter || data.projects.find((p) => p.id === projectFilter)?.materialIds.includes(m.id)) && [m.title, m.text, m.summary, m.ocr, m.collection, ...m.tags].join(" ").toLowerCase().includes(q.toLowerCase())
|
|
1017
|
+
);
|
|
1018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "section-title", children: [
|
|
1020
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u7D20\u6750\u5E93" }),
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u539F\u59CB\u6750\u6599\u72EC\u7ACB\u4FDD\u7559\u3002\u6574\u7406\u548C\u8BC6\u522B\u7ED3\u679C\u53EF\u4EE5\u4FEE\u6539\u3002" })
|
|
1023
|
+
] }),
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => Grid(!grid), children: grid ? "\u5217\u8868\u89C6\u56FE" : "\u56FE\u7247\u7F51\u683C" })
|
|
1025
|
+
] }),
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { open: !data.materials.length, className: "import", children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u63A5\u6536\u65B0\u7D20\u6750 \xB7 \u6587\u5B57\u3001\u94FE\u63A5\u4E0E\u56FE\u7247" }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1029
|
+
"div",
|
|
1030
|
+
{
|
|
1031
|
+
onDragOver: (e) => e.preventDefault(),
|
|
1032
|
+
onDrop: (e) => {
|
|
1033
|
+
e.preventDefault();
|
|
1034
|
+
importFiles(e.dataTransfer.files);
|
|
1035
|
+
},
|
|
1036
|
+
className: "drop",
|
|
1037
|
+
children: [
|
|
1038
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: "\u62D6\u5165\u6587\u4EF6\uFF0C\u6216\u9009\u62E9\u6279\u91CF\u5BFC\u5165" }),
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1040
|
+
"input",
|
|
1041
|
+
{
|
|
1042
|
+
"aria-label": "\u5BFC\u5165\u7D20\u6750\u6587\u4EF6",
|
|
1043
|
+
type: "file",
|
|
1044
|
+
multiple: true,
|
|
1045
|
+
accept: ".md,.txt,.png,.jpg,.jpeg,.gif,.webp",
|
|
1046
|
+
onChange: (e) => {
|
|
1047
|
+
if (e.target.files) importFiles(e.target.files);
|
|
1048
|
+
e.target.value = "";
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u6BCF\u4E2A\u6587\u4EF6\u4E0D\u8D85\u8FC7 20 MB\uFF1BPDF / DOCX \u6682\u4E0D\u652F\u6301\u3002" })
|
|
1053
|
+
]
|
|
1054
|
+
}
|
|
1055
|
+
),
|
|
1056
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Field, { label: "\u7D20\u6750\u6807\u9898", value: title, onChange: Title }),
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1060
|
+
Field,
|
|
1061
|
+
{
|
|
1062
|
+
label: "\u7C98\u8D34\u6587\u5B57 / Markdown",
|
|
1063
|
+
value: text,
|
|
1064
|
+
onChange: Text,
|
|
1065
|
+
multi: true
|
|
1066
|
+
}
|
|
1067
|
+
),
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1069
|
+
"button",
|
|
1070
|
+
{
|
|
1071
|
+
onClick: () => run(async () => {
|
|
1072
|
+
await api("material.import", {
|
|
1073
|
+
title: title || "\u6587\u5B57\u7B14\u8BB0",
|
|
1074
|
+
text
|
|
1075
|
+
});
|
|
1076
|
+
Text("");
|
|
1077
|
+
Title("");
|
|
1078
|
+
}),
|
|
1079
|
+
children: "\u4FDD\u5B58\u539F\u6587"
|
|
1080
|
+
}
|
|
1081
|
+
)
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Field, { label: "\u516C\u5F00\u7F51\u9875 URL", value: url, onChange: Url }),
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1086
|
+
"button",
|
|
1087
|
+
{
|
|
1088
|
+
onClick: () => run(async () => {
|
|
1089
|
+
await api("url.read", { url, title });
|
|
1090
|
+
Url("");
|
|
1091
|
+
}),
|
|
1092
|
+
children: "\u901A\u8FC7\u5BBF\u4E3B\u8BFB\u53D6\u7F51\u9875"
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1096
|
+
"button",
|
|
1097
|
+
{
|
|
1098
|
+
onClick: () => run(
|
|
1099
|
+
() => api("material.import", {
|
|
1100
|
+
title: title || url,
|
|
1101
|
+
text: url,
|
|
1102
|
+
type: "url",
|
|
1103
|
+
source: url
|
|
1104
|
+
})
|
|
1105
|
+
),
|
|
1106
|
+
children: "\u4EC5\u4FDD\u5B58\u94FE\u63A5"
|
|
1107
|
+
}
|
|
1108
|
+
),
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u7F51\u9875\u8BFB\u53D6\u4F7F\u7528 dsh \u5DF2\u914D\u7F6E\u7684 provider\uFF0C\u5931\u8D25\u65F6\u53EF\u4EE5\u4EC5\u4FDD\u5B58\u94FE\u63A5\u3002" })
|
|
1110
|
+
] })
|
|
1111
|
+
] })
|
|
1112
|
+
] }),
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "filters", children: [
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1115
|
+
"input",
|
|
1116
|
+
{
|
|
1117
|
+
"aria-label": "\u641C\u7D22\u7D20\u6750",
|
|
1118
|
+
placeholder: "\u641C\u7D22\u5168\u6587\u3001OCR\u3001\u6807\u7B7E\u3001\u96C6\u5408\u2026",
|
|
1119
|
+
value: q,
|
|
1120
|
+
onChange: (e) => Q(e.target.value)
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1124
|
+
"select",
|
|
1125
|
+
{
|
|
1126
|
+
"aria-label": "\u7C7B\u578B\u7B5B\u9009",
|
|
1127
|
+
value: type,
|
|
1128
|
+
onChange: (e) => T(e.target.value),
|
|
1129
|
+
children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u6240\u6709\u7C7B\u578B" }),
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "text", children: "\u6587\u5B57" }),
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "image", children: "\u56FE\u7247" }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "url", children: "\u94FE\u63A5" })
|
|
1134
|
+
]
|
|
1135
|
+
}
|
|
1136
|
+
),
|
|
1137
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1138
|
+
"select",
|
|
1139
|
+
{
|
|
1140
|
+
"aria-label": "\u6807\u7B7E\u7B5B\u9009",
|
|
1141
|
+
value: tag,
|
|
1142
|
+
onChange: (e) => G(e.target.value),
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u6240\u6709\u6807\u7B7E" }),
|
|
1145
|
+
[...new Set(data.materials.flatMap((m) => m.tags))].map((t) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { children: t }, t))
|
|
1146
|
+
]
|
|
1147
|
+
}
|
|
1148
|
+
),
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1150
|
+
"select",
|
|
1151
|
+
{
|
|
1152
|
+
"aria-label": "\u9879\u76EE\u7B5B\u9009",
|
|
1153
|
+
value: projectFilter,
|
|
1154
|
+
onChange: (e) => PF(e.target.value),
|
|
1155
|
+
children: [
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u6240\u6709\u9879\u76EE" }),
|
|
1157
|
+
data.projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: p.id, children: p.name }, p.id))
|
|
1158
|
+
]
|
|
1159
|
+
}
|
|
1160
|
+
),
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { children: [
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1163
|
+
"input",
|
|
1164
|
+
{
|
|
1165
|
+
type: "checkbox",
|
|
1166
|
+
checked: deleted,
|
|
1167
|
+
onChange: (e) => D(e.target.checked)
|
|
1168
|
+
}
|
|
1169
|
+
),
|
|
1170
|
+
" ",
|
|
1171
|
+
"\u56DE\u6536\u7AD9"
|
|
1172
|
+
] })
|
|
1173
|
+
] }),
|
|
1174
|
+
selected.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "batch", children: [
|
|
1175
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
1176
|
+
"\u5DF2\u9009 ",
|
|
1177
|
+
selected.length,
|
|
1178
|
+
" \u9879"
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1181
|
+
"button",
|
|
1182
|
+
{
|
|
1183
|
+
onClick: () => run(async () => {
|
|
1184
|
+
const tags = prompt("\u6279\u91CF\u6DFB\u52A0\u6807\u7B7E\uFF0C\u4EE5\u9017\u53F7\u5206\u9694");
|
|
1185
|
+
if (tags)
|
|
1186
|
+
await api("material.tags", {
|
|
1187
|
+
ids: selected,
|
|
1188
|
+
tags: tags.split(/[,,]/).filter(Boolean)
|
|
1189
|
+
});
|
|
1190
|
+
}),
|
|
1191
|
+
children: "\u6279\u91CF\u6807\u7B7E"
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1195
|
+
"select",
|
|
1196
|
+
{
|
|
1197
|
+
"aria-label": "\u5173\u8054\u9879\u76EE",
|
|
1198
|
+
value: pid,
|
|
1199
|
+
onChange: (e) => setPid(e.target.value),
|
|
1200
|
+
children: [
|
|
1201
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u9009\u62E9\u9879\u76EE" }),
|
|
1202
|
+
data.projects.map((p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: p.id, children: p.name }, p.id))
|
|
1203
|
+
]
|
|
1204
|
+
}
|
|
1205
|
+
),
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1207
|
+
"button",
|
|
1208
|
+
{
|
|
1209
|
+
onClick: () => run(async () => {
|
|
1210
|
+
const p = data.projects.find((p2) => p2.id === pid);
|
|
1211
|
+
if (!p) throw Error("\u8BF7\u5148\u9009\u62E9\u9879\u76EE");
|
|
1212
|
+
await api("project.update", {
|
|
1213
|
+
id: p.id,
|
|
1214
|
+
revision: p.revision,
|
|
1215
|
+
project: {
|
|
1216
|
+
...p,
|
|
1217
|
+
materialIds: [.../* @__PURE__ */ new Set([...p.materialIds, ...selected])]
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
S([]);
|
|
1221
|
+
}),
|
|
1222
|
+
children: "\u5173\u8054\u6240\u9009\u7D20\u6750"
|
|
1223
|
+
}
|
|
1224
|
+
)
|
|
1225
|
+
] }),
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: grid ? "material-grid" : "material-list", children: rows.map((m) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("article", { children: [
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1228
|
+
"input",
|
|
1229
|
+
{
|
|
1230
|
+
"aria-label": "\u9009\u62E9 " + m.title,
|
|
1231
|
+
type: "checkbox",
|
|
1232
|
+
checked: selected.includes(m.id),
|
|
1233
|
+
onChange: (e) => S(
|
|
1234
|
+
e.target.checked ? [...selected, m.id] : selected.filter((x) => x !== m.id)
|
|
1235
|
+
)
|
|
1236
|
+
}
|
|
1237
|
+
),
|
|
1238
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { className: "material-open", onClick: () => E(m), children: [
|
|
1239
|
+
m.type === "image" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1240
|
+
"img",
|
|
1241
|
+
{
|
|
1242
|
+
loading: "lazy",
|
|
1243
|
+
src: api.url("/content-studio-api/asset/" + m.id),
|
|
1244
|
+
alt: m.title
|
|
1245
|
+
}
|
|
1246
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "file-icon", children: m.type === "url" ? "LINK" : "TXT" }),
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: m.title }),
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: m.summary || m.text.slice(0, 100) || m.category }),
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
1251
|
+
m.origin,
|
|
1252
|
+
" \xB7 ",
|
|
1253
|
+
m.tags.join(" / "),
|
|
1254
|
+
" \xB7 ",
|
|
1255
|
+
m.collection
|
|
1256
|
+
] })
|
|
1257
|
+
] })
|
|
1258
|
+
] })
|
|
1259
|
+
] }, m.id)) }),
|
|
1260
|
+
!rows.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "empty", children: "\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u7D20\u6750\u3002" }),
|
|
1261
|
+
edit && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "modal-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1262
|
+
"section",
|
|
1263
|
+
{
|
|
1264
|
+
className: "modal",
|
|
1265
|
+
role: "dialog",
|
|
1266
|
+
"aria-modal": "true",
|
|
1267
|
+
"aria-label": "\u7D20\u6750\u8BE6\u60C5",
|
|
1268
|
+
children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "section-title", children: [
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u7D20\u6750\u8BE6\u60C5" }),
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => E(void 0), children: "\u5173\u95ED" })
|
|
1272
|
+
] }),
|
|
1273
|
+
edit.type === "image" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1274
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1275
|
+
"a",
|
|
1276
|
+
{
|
|
1277
|
+
href: api.url("/content-studio-api/asset/" + edit.id),
|
|
1278
|
+
target: "_blank",
|
|
1279
|
+
rel: "noreferrer",
|
|
1280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1281
|
+
"img",
|
|
1282
|
+
{
|
|
1283
|
+
className: "preview-image",
|
|
1284
|
+
src: api.url("/content-studio-api/asset/" + edit.id),
|
|
1285
|
+
alt: edit.title
|
|
1286
|
+
}
|
|
1287
|
+
)
|
|
1288
|
+
}
|
|
1289
|
+
),
|
|
1290
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
1291
|
+
edit.width,
|
|
1292
|
+
" \xD7 ",
|
|
1293
|
+
edit.height,
|
|
1294
|
+
" \xB7 \u70B9\u51FB\u67E5\u770B\u539F\u56FE"
|
|
1295
|
+
] })
|
|
1296
|
+
] }),
|
|
1297
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1298
|
+
Field,
|
|
1299
|
+
{
|
|
1300
|
+
label: "\u6807\u9898",
|
|
1301
|
+
value: edit.title,
|
|
1302
|
+
onChange: (v) => E({ ...edit, title: v })
|
|
1303
|
+
}
|
|
1304
|
+
),
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1307
|
+
Select,
|
|
1308
|
+
{
|
|
1309
|
+
label: "\u6765\u6E90\u6027\u8D28",
|
|
1310
|
+
value: edit.origin,
|
|
1311
|
+
items: origins,
|
|
1312
|
+
onChange: (v) => E({ ...edit, origin: v })
|
|
1313
|
+
}
|
|
1314
|
+
),
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1316
|
+
Select,
|
|
1317
|
+
{
|
|
1318
|
+
label: "\u5206\u7C7B",
|
|
1319
|
+
value: edit.category,
|
|
1320
|
+
items: [
|
|
1321
|
+
.../* @__PURE__ */ new Set([
|
|
1322
|
+
edit.category,
|
|
1323
|
+
...edit.type === "image" ? imageCategories : textCategories
|
|
1324
|
+
])
|
|
1325
|
+
],
|
|
1326
|
+
onChange: (v) => E({ ...edit, category: v })
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1329
|
+
] }),
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1331
|
+
Field,
|
|
1332
|
+
{
|
|
1333
|
+
label: "\u6574\u7406\u6458\u8981",
|
|
1334
|
+
value: edit.summary,
|
|
1335
|
+
multi: true,
|
|
1336
|
+
onChange: (v) => E({ ...edit, summary: v })
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1340
|
+
Field,
|
|
1341
|
+
{
|
|
1342
|
+
label: "\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",
|
|
1343
|
+
value: edit.tags.join(","),
|
|
1344
|
+
onChange: (v) => E({ ...edit, tags: v.split(/[,,]/) })
|
|
1345
|
+
}
|
|
1346
|
+
),
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1348
|
+
Field,
|
|
1349
|
+
{
|
|
1350
|
+
label: "\u96C6\u5408",
|
|
1351
|
+
value: edit.collection,
|
|
1352
|
+
onChange: (v) => E({ ...edit, collection: v })
|
|
1353
|
+
}
|
|
1354
|
+
),
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1356
|
+
Field,
|
|
1357
|
+
{
|
|
1358
|
+
label: "\u6765\u6E90\u94FE\u63A5 / \u6587\u4EF6",
|
|
1359
|
+
value: edit.source,
|
|
1360
|
+
onChange: (v) => E({ ...edit, source: v })
|
|
1361
|
+
}
|
|
1362
|
+
),
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1365
|
+
Field,
|
|
1366
|
+
{
|
|
1367
|
+
label: "\u4F5C\u8005",
|
|
1368
|
+
value: edit.author,
|
|
1369
|
+
onChange: (v) => E({ ...edit, author: v })
|
|
1370
|
+
}
|
|
1371
|
+
),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1373
|
+
Field,
|
|
1374
|
+
{
|
|
1375
|
+
label: "\u53D1\u5E03\u65E5\u671F",
|
|
1376
|
+
value: edit.publishedAt,
|
|
1377
|
+
onChange: (v) => E({ ...edit, publishedAt: v })
|
|
1378
|
+
}
|
|
1379
|
+
)
|
|
1380
|
+
] }),
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1382
|
+
Field,
|
|
1383
|
+
{
|
|
1384
|
+
label: "\u7248\u6743 / \u4F7F\u7528\u6388\u6743",
|
|
1385
|
+
value: edit.rights,
|
|
1386
|
+
onChange: (v) => E({ ...edit, rights: v })
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1390
|
+
Field,
|
|
1391
|
+
{
|
|
1392
|
+
label: "\u5907\u6CE8",
|
|
1393
|
+
value: edit.notes,
|
|
1394
|
+
multi: true,
|
|
1395
|
+
onChange: (v) => E({ ...edit, notes: v })
|
|
1396
|
+
}
|
|
1397
|
+
),
|
|
1398
|
+
edit.type === "image" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1400
|
+
Field,
|
|
1401
|
+
{
|
|
1402
|
+
label: "OCR / \u56FE\u7247\u8BF4\u660E\uFF08\u53EF\u7F16\u8F91\uFF0C\u672A\u6838\u5B9E\uFF09",
|
|
1403
|
+
value: edit.ocr,
|
|
1404
|
+
onChange: (v) => E({
|
|
1405
|
+
...edit,
|
|
1406
|
+
ocr: v,
|
|
1407
|
+
ocrSource: "\u4F5C\u8005\u624B\u52A8\u7F16\u8F91 " + (/* @__PURE__ */ new Date()).toISOString()
|
|
1408
|
+
}),
|
|
1409
|
+
multi: true
|
|
1410
|
+
}
|
|
1411
|
+
),
|
|
1412
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: edit.ocrSource }),
|
|
1413
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1414
|
+
"button",
|
|
1415
|
+
{
|
|
1416
|
+
onClick: () => run(async () => {
|
|
1417
|
+
if (!pid) throw Error("\u5148\u5728\u6279\u91CF\u64CD\u4F5C\u533A\u9009\u62E9\u5173\u8054\u9879\u76EE");
|
|
1418
|
+
await api("task.start", {
|
|
1419
|
+
projectId: pid,
|
|
1420
|
+
platform: api.scope.platform,
|
|
1421
|
+
step: "ocr",
|
|
1422
|
+
materialId: edit.id,
|
|
1423
|
+
instruction: "\u8BC6\u522B\u56FE\u7247\u6587\u5B57\u4E0E\u5185\u5BB9\uFF0C\u5728 replacement \u8FD4\u56DE\uFF1B\u4E0D\u731C\u6D4B\u4E0D\u53EF\u8FA8\u8BA4\u6587\u5B57\u3002"
|
|
1424
|
+
});
|
|
1425
|
+
}),
|
|
1426
|
+
children: "\u901A\u8FC7\u5BBF\u4E3B\u89C6\u89C9\u6A21\u578B\u8BC6\u522B"
|
|
1427
|
+
}
|
|
1428
|
+
)
|
|
1429
|
+
] }),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u539F\u59CB\u6750\u6599 / \u91C7\u96C6\u8BB0\u5F55" }),
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: edit.text }),
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: date(edit.createdAt) }),
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: edit.sources.join("\n") })
|
|
1435
|
+
] }),
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { children: [
|
|
1437
|
+
"\u5173\u8054\u6587\u7AE0\uFF1A",
|
|
1438
|
+
data.projects.filter((p) => p.materialIds.includes(edit.id)).map((p) => p.name).join("\u3001") || "\u6682\u65E0"
|
|
1439
|
+
] }),
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1442
|
+
"button",
|
|
1443
|
+
{
|
|
1444
|
+
className: "primary",
|
|
1445
|
+
onClick: () => run(async () => {
|
|
1446
|
+
await api("material.update", {
|
|
1447
|
+
id: edit.id,
|
|
1448
|
+
material: edit
|
|
1449
|
+
});
|
|
1450
|
+
E(void 0);
|
|
1451
|
+
}),
|
|
1452
|
+
children: "\u4FDD\u5B58\u6574\u7406\u7ED3\u679C"
|
|
1453
|
+
}
|
|
1454
|
+
),
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1456
|
+
"button",
|
|
1457
|
+
{
|
|
1458
|
+
onClick: () => run(async () => {
|
|
1459
|
+
await api("material.update", {
|
|
1460
|
+
id: edit.id,
|
|
1461
|
+
material: { deleted: !edit.deleted }
|
|
1462
|
+
});
|
|
1463
|
+
E(void 0);
|
|
1464
|
+
}),
|
|
1465
|
+
children: edit.deleted ? "\u6062\u590D\u7D20\u6750" : "\u79FB\u5165\u56DE\u6536\u7AD9"
|
|
1466
|
+
}
|
|
1467
|
+
)
|
|
1468
|
+
] })
|
|
1469
|
+
]
|
|
1470
|
+
}
|
|
1471
|
+
) })
|
|
1472
|
+
] });
|
|
1473
|
+
}
|
|
1474
|
+
function Topics({
|
|
1475
|
+
data,
|
|
1476
|
+
run,
|
|
1477
|
+
open
|
|
1478
|
+
}) {
|
|
1479
|
+
const api = useStudioApi();
|
|
1480
|
+
const [q, Q] = (0, import_react3.useState)(""), [fav, F] = (0, import_react3.useState)(false), [idea, I] = (0, import_react3.useState)(""), [editing, E] = (0, import_react3.useState)();
|
|
1481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u9009\u9898\u5E93" }),
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u5148\u627E\u503C\u5F97\u56DE\u7B54\u7684\u95EE\u9898\uFF0C\u518D\u51B3\u5B9A\u5199\u4EC0\u4E48\u3002\u516C\u5F00\u641C\u7D22\u7ED3\u679C\u5747\u4E3A\u5019\u9009\u9898\u6750\uFF0C\u672A\u63D0\u4F9B\u53EF\u9760\u70ED\u5EA6\u65F6\u4E0D\u79F0\u4E3A\u70ED\u70B9\u3002" }),
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u4ECE\u60F3\u6CD5\u6216\u7D20\u6750\u5F00\u59CB" }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Field, { label: "\u4F60\u7684\u60F3\u6CD5", value: idea, multi: true, onChange: I }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1489
|
+
"button",
|
|
1490
|
+
{
|
|
1491
|
+
onClick: () => run(async () => {
|
|
1492
|
+
await api("topic.save", {
|
|
1493
|
+
title: idea,
|
|
1494
|
+
reason: "\u4F5C\u8005\u4E3B\u52A8\u8BB0\u5F55\u7684\u60F3\u6CD5"
|
|
1495
|
+
});
|
|
1496
|
+
I("");
|
|
1497
|
+
}),
|
|
1498
|
+
children: "\u4FDD\u5B58\u9009\u9898"
|
|
1499
|
+
}
|
|
1500
|
+
),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u5173\u8054\u7D20\u6750\u540E\uFF0C\u5728\u5185\u5BB9\u7F16\u8F91\u9875\u8FD0\u884C\u300C\u63D0\u70BC\u9009\u9898\u300D\uFF0C\u4F1A\u4FDD\u5B58\u53EF\u7F16\u8F91\u7684\u63A8\u8350\u7406\u7531\u3002" })
|
|
1502
|
+
] }),
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u53D1\u73B0\u516C\u5F00\u5019\u9009\u9898\u6750" }),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Field, { label: "\u67E5\u8BE2\u4E3B\u9898\uFF08\u53EF\u52A0\u65E5\u671F\u8303\u56F4\uFF09", value: q, onChange: Q }),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1507
|
+
"button",
|
|
1508
|
+
{
|
|
1509
|
+
onClick: () => run(() => api("discover", { query: q || data.settings.domains })),
|
|
1510
|
+
children: "\u4E3B\u52A8\u641C\u7D22 / \u5237\u65B0"
|
|
1511
|
+
}
|
|
1512
|
+
),
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u901A\u8FC7\u5BBF\u4E3B\u641C\u7D22\u670D\u52A1\uFF1B\u4E0D\u9ED8\u8BA4\u91C7\u96C6\uFF0C\u4E0D\u586B\u5145\u6A21\u62DF\u7ED3\u679C\u3002\u65E7\u4E8B\u4EF6\u4E0D\u4F1A\u81EA\u52A8\u6807\u6210\u8FD1\u671F\u3002" })
|
|
1514
|
+
] })
|
|
1515
|
+
] }),
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "filters", children: [
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1518
|
+
"input",
|
|
1519
|
+
{
|
|
1520
|
+
"aria-label": "\u7B5B\u9009\u9009\u9898",
|
|
1521
|
+
value: q,
|
|
1522
|
+
onChange: (e) => Q(e.target.value),
|
|
1523
|
+
placeholder: "\u7B5B\u9009\u4E3B\u9898\u6216\u7406\u7531"
|
|
1524
|
+
}
|
|
1525
|
+
),
|
|
1526
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { children: [
|
|
1527
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1528
|
+
"input",
|
|
1529
|
+
{
|
|
1530
|
+
type: "checkbox",
|
|
1531
|
+
checked: fav,
|
|
1532
|
+
onChange: (e) => F(e.target.checked)
|
|
1533
|
+
}
|
|
1534
|
+
),
|
|
1535
|
+
" ",
|
|
1536
|
+
"\u4EC5\u6536\u85CF"
|
|
1537
|
+
] })
|
|
1538
|
+
] }),
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "project-grid", children: data.topics.filter(
|
|
1540
|
+
(t) => (!fav || t.favorite) && (!q || (t.title + t.reason).includes(q))
|
|
1541
|
+
).map((t) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("article", { className: "panel", children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "badge", children: t.timeliness }),
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: t.title }),
|
|
1544
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t.reason }),
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dl", { children: [
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u8BFB\u8005 / \u95EE\u9898" }),
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dd", { children: [
|
|
1548
|
+
t.reader,
|
|
1549
|
+
" / ",
|
|
1550
|
+
t.question || "\u5F85\u660E\u786E"
|
|
1551
|
+
] }),
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u5EFA\u8BAE\u89D2\u5EA6" }),
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: t.angle }),
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u51C6\u5907\u7A0B\u5EA6" }),
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dd", { children: [
|
|
1556
|
+
t.materialIds.length,
|
|
1557
|
+
" \u4EFD\u6750\u6599 \xB7 ",
|
|
1558
|
+
t.cost,
|
|
1559
|
+
" \xB7 \u7F3A\u53E3\uFF1A",
|
|
1560
|
+
t.gaps
|
|
1561
|
+
] }),
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u9002\u5408\u5E73\u53F0" }),
|
|
1563
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: t.platforms }),
|
|
1564
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u6765\u6E90" }),
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: /^https?:/.test(t.source) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: t.source, target: "_blank", rel: "noreferrer", children: "\u67E5\u770B\u6765\u6E90" }) : t.source }),
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u91C7\u96C6 / \u4E8B\u4EF6\u65F6\u95F4" }),
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dd", { children: [
|
|
1568
|
+
date(t.collectedAt),
|
|
1569
|
+
" / ",
|
|
1570
|
+
t.eventAt
|
|
1571
|
+
] }),
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: "\u70ED\u5EA6\u4F9D\u636E" }),
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: t.heat })
|
|
1574
|
+
] }),
|
|
1575
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
1576
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1577
|
+
"button",
|
|
1578
|
+
{
|
|
1579
|
+
onClick: () => run(async () => {
|
|
1580
|
+
const p = await api("topic.project", {
|
|
1581
|
+
id: t.id
|
|
1582
|
+
});
|
|
1583
|
+
open(p.id);
|
|
1584
|
+
}),
|
|
1585
|
+
children: t.projectId ? "\u7EE7\u7EED\u9879\u76EE" : "\u8F6C\u4E3A\u9879\u76EE"
|
|
1586
|
+
}
|
|
1587
|
+
),
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => E(t), children: "\u7F16\u8F91" }),
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1590
|
+
"button",
|
|
1591
|
+
{
|
|
1592
|
+
onClick: () => run(
|
|
1593
|
+
() => api("topic.save", { ...t, favorite: !t.favorite })
|
|
1594
|
+
),
|
|
1595
|
+
children: t.favorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF"
|
|
1596
|
+
}
|
|
1597
|
+
)
|
|
1598
|
+
] })
|
|
1599
|
+
] }, t.id)) }),
|
|
1600
|
+
!data.topics.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "empty", children: "\u9009\u9898\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u8BB0\u5F55\u60F3\u6CD5\uFF0C\u6216\u4E3B\u52A8\u641C\u7D22\u4E00\u4E2A\u4E3B\u9898\u3002" }),
|
|
1601
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "modal-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "modal", children: [
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u7F16\u8F91\u9009\u9898" }),
|
|
1603
|
+
[
|
|
1604
|
+
"title",
|
|
1605
|
+
"reader",
|
|
1606
|
+
"question",
|
|
1607
|
+
"angle",
|
|
1608
|
+
"reason",
|
|
1609
|
+
"gaps",
|
|
1610
|
+
"platforms",
|
|
1611
|
+
"timeliness",
|
|
1612
|
+
"cost",
|
|
1613
|
+
"eventAt"
|
|
1614
|
+
].map((key, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1615
|
+
Field,
|
|
1616
|
+
{
|
|
1617
|
+
label: [
|
|
1618
|
+
"\u4E3B\u9898",
|
|
1619
|
+
"\u8BFB\u8005",
|
|
1620
|
+
"\u8BFB\u8005\u95EE\u9898",
|
|
1621
|
+
"\u5EFA\u8BAE\u89D2\u5EA6",
|
|
1622
|
+
"\u63A8\u8350\u7406\u7531",
|
|
1623
|
+
"\u8BC1\u636E\u7F3A\u53E3",
|
|
1624
|
+
"\u9002\u5408\u5E73\u53F0",
|
|
1625
|
+
"\u65F6\u6548\u6027",
|
|
1626
|
+
"\u51C6\u5907\u6210\u672C",
|
|
1627
|
+
"\u4E8B\u4EF6\u65F6\u95F4"
|
|
1628
|
+
][i],
|
|
1629
|
+
value: editing[key],
|
|
1630
|
+
onChange: (v) => E({ ...editing, [key]: v }),
|
|
1631
|
+
multi: ["reason", "gaps"].includes(key)
|
|
1632
|
+
},
|
|
1633
|
+
key
|
|
1634
|
+
)),
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1636
|
+
"button",
|
|
1637
|
+
{
|
|
1638
|
+
onClick: () => run(async () => {
|
|
1639
|
+
await api("topic.save", editing);
|
|
1640
|
+
E(void 0);
|
|
1641
|
+
}),
|
|
1642
|
+
children: "\u4FDD\u5B58\u9009\u9898"
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => E(void 0), children: "\u5173\u95ED" })
|
|
1646
|
+
] }) })
|
|
1647
|
+
] });
|
|
1648
|
+
}
|
|
1649
|
+
function Editor({
|
|
1650
|
+
initialPlatform,
|
|
1651
|
+
p,
|
|
1652
|
+
data,
|
|
1653
|
+
run,
|
|
1654
|
+
reload,
|
|
1655
|
+
beforeLeave,
|
|
1656
|
+
message,
|
|
1657
|
+
exportPage,
|
|
1658
|
+
switchScope
|
|
1659
|
+
}) {
|
|
1660
|
+
const api = useStudioApi();
|
|
1661
|
+
const platform = data.scope.platform;
|
|
1662
|
+
const [version, V] = (0, import_react3.useState)(), [doc, D] = (0, import_react3.useState)(), [versions, VS] = (0, import_react3.useState)([]), [status, Status] = (0, import_react3.useState)("\u8BFB\u53D6\u4E2D"), [step, S] = (0, import_react3.useState)("brief"), [instruction, I] = (0, import_react3.useState)(""), [compare, C] = (0, import_react3.useState)(), [plan, Plan] = (0, import_react3.useState)(p), [sel, Sel] = (0, import_react3.useState)(), [tab, Tab] = (0, import_react3.useState)("\u7B80\u62A5");
|
|
1663
|
+
const editRef = (0, import_react3.useRef)(null), docRef = (0, import_react3.useRef)(), versionRef = (0, import_react3.useRef)(), dirty = (0, import_react3.useRef)(false), saving = (0, import_react3.useRef)(Promise.resolve()), editCount = (0, import_react3.useRef)(0);
|
|
1664
|
+
const projectTasks = data.tasks.filter((t) => t.projectId === p.id);
|
|
1665
|
+
const pending = projectTasks.some(active);
|
|
1666
|
+
const platformRef = (0, import_react3.useRef)(platform);
|
|
1667
|
+
platformRef.current = platform;
|
|
1668
|
+
const load = async () => {
|
|
1669
|
+
const r = await api(
|
|
1670
|
+
"document.read",
|
|
1671
|
+
{ projectId: p.id, platform }
|
|
1672
|
+
);
|
|
1673
|
+
if (platformRef.current !== platform) return;
|
|
1674
|
+
VS(r.versions);
|
|
1675
|
+
if (!dirty.current) {
|
|
1676
|
+
D(r.current.doc);
|
|
1677
|
+
docRef.current = r.current.doc;
|
|
1678
|
+
V(r.current);
|
|
1679
|
+
versionRef.current = r.current;
|
|
1680
|
+
Status("\u5DF2\u4FDD\u5B58\u5230\u672C\u673A");
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
const flush = () => {
|
|
1684
|
+
saving.current = saving.current.catch(() => {
|
|
1685
|
+
}).then(async () => {
|
|
1686
|
+
if (!dirty.current || !docRef.current || !versionRef.current) return;
|
|
1687
|
+
const n = editCount.current;
|
|
1688
|
+
Status("\u4FDD\u5B58\u4E2D\u2026");
|
|
1689
|
+
try {
|
|
1690
|
+
const r = await api("document.save", {
|
|
1691
|
+
projectId: p.id,
|
|
1692
|
+
platform,
|
|
1693
|
+
doc: docRef.current,
|
|
1694
|
+
baseId: versionRef.current.id
|
|
1695
|
+
});
|
|
1696
|
+
if (r.candidate) {
|
|
1697
|
+
Status("\u53D1\u751F\u51B2\u7A81\uFF1A\u5DF2\u4FDD\u5B58\u4E3A\u5019\u9009\u7248\u672C");
|
|
1698
|
+
if (n === editCount.current) dirty.current = false;
|
|
1699
|
+
message(
|
|
1700
|
+
"\u53E6\u4E00\u7A97\u53E3\u5DF2\u66F4\u65B0\u6B63\u6587\u3002\u4F60\u7684\u7F16\u8F91\u5DF2\u4FDD\u5B58\u4E3A\u5019\u9009\u7248\u672C\uFF0C\u8BF7\u6BD4\u8F83\u540E\u6062\u590D\u3002"
|
|
1701
|
+
);
|
|
1702
|
+
VS((v) => [r, ...v]);
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
V(r);
|
|
1706
|
+
versionRef.current = r;
|
|
1707
|
+
if (n === editCount.current) dirty.current = false;
|
|
1708
|
+
Status(dirty.current ? "\u7B49\u5F85\u4FDD\u5B58\u2026" : "\u5DF2\u4FDD\u5B58\u5230\u672C\u673A");
|
|
1709
|
+
} catch (e) {
|
|
1710
|
+
Status("\u4FDD\u5B58\u5931\u8D25\uFF0C\u5185\u5BB9\u4ECD\u5728\u7F16\u8F91\u5668");
|
|
1711
|
+
throw e;
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
return saving.current;
|
|
1715
|
+
};
|
|
1716
|
+
(0, import_react3.useEffect)(() => {
|
|
1717
|
+
beforeLeave.current = flush;
|
|
1718
|
+
return () => {
|
|
1719
|
+
beforeLeave.current = async () => {
|
|
1720
|
+
};
|
|
1721
|
+
};
|
|
1722
|
+
});
|
|
1723
|
+
(0, import_react3.useEffect)(() => {
|
|
1724
|
+
void load().catch((e) => Status(e.message));
|
|
1725
|
+
const timer = setInterval(() => void load().catch(() => {
|
|
1726
|
+
}), 2500);
|
|
1727
|
+
return () => clearInterval(timer);
|
|
1728
|
+
}, [platform]);
|
|
1729
|
+
(0, import_react3.useEffect)(() => {
|
|
1730
|
+
Plan(p);
|
|
1731
|
+
}, [p.revision]);
|
|
1732
|
+
(0, import_react3.useEffect)(() => {
|
|
1733
|
+
if (!doc) return;
|
|
1734
|
+
const timer = setTimeout(
|
|
1735
|
+
() => void flush().catch((e) => message(e.message)),
|
|
1736
|
+
800
|
|
1737
|
+
);
|
|
1738
|
+
return () => clearTimeout(timer);
|
|
1739
|
+
}, [doc]);
|
|
1740
|
+
(0, import_react3.useEffect)(() => {
|
|
1741
|
+
const handler = (e) => {
|
|
1742
|
+
if (dirty.current) {
|
|
1743
|
+
e.preventDefault();
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
window.addEventListener("beforeunload", handler);
|
|
1747
|
+
return () => window.removeEventListener("beforeunload", handler);
|
|
1748
|
+
}, []);
|
|
1749
|
+
const change = (next) => {
|
|
1750
|
+
D(next);
|
|
1751
|
+
docRef.current = next;
|
|
1752
|
+
dirty.current = true;
|
|
1753
|
+
editCount.current++;
|
|
1754
|
+
Status("\u7B49\u5F85\u4FDD\u5B58\u2026");
|
|
1755
|
+
};
|
|
1756
|
+
const savePlan = async () => {
|
|
1757
|
+
const latest = await api("snapshot");
|
|
1758
|
+
const current = latest.projects.find((x) => x.id === p.id);
|
|
1759
|
+
if (current.revision !== p.revision)
|
|
1760
|
+
throw Error("\u9879\u76EE\u5185\u5BB9\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u5237\u65B0\u540E\u7F16\u8F91\u7B80\u62A5");
|
|
1761
|
+
await api("project.update", {
|
|
1762
|
+
id: p.id,
|
|
1763
|
+
revision: p.revision,
|
|
1764
|
+
project: plan
|
|
1765
|
+
});
|
|
1766
|
+
};
|
|
1767
|
+
const start = async (s, plat = platform) => {
|
|
1768
|
+
await flush();
|
|
1769
|
+
if (s === "selection" && !sel?.text)
|
|
1770
|
+
throw Error("\u8BF7\u5148\u5728\u6B63\u6587\u4E2D\u9009\u4E2D\u8981\u6539\u5199\u7684\u8303\u56F4");
|
|
1771
|
+
return api("task.start", {
|
|
1772
|
+
projectId: p.id,
|
|
1773
|
+
platform: plat,
|
|
1774
|
+
step: s,
|
|
1775
|
+
instruction,
|
|
1776
|
+
selection: s === "selection" ? { ...sel, baseId: versionRef.current?.id } : void 0
|
|
1777
|
+
});
|
|
1778
|
+
};
|
|
1779
|
+
const complete = async () => {
|
|
1780
|
+
await flush();
|
|
1781
|
+
await savePlan();
|
|
1782
|
+
await api("task.start", {
|
|
1783
|
+
projectId: p.id,
|
|
1784
|
+
platform,
|
|
1785
|
+
step: "compose",
|
|
1786
|
+
instruction
|
|
1787
|
+
});
|
|
1788
|
+
};
|
|
1789
|
+
const chat = async (text, adapt) => {
|
|
1790
|
+
await flush();
|
|
1791
|
+
await api("task.start", {
|
|
1792
|
+
projectId: p.id,
|
|
1793
|
+
platform,
|
|
1794
|
+
step: adapt ? "adapt" : sel?.text ? "selection" : "chat",
|
|
1795
|
+
instruction: text,
|
|
1796
|
+
proposal: true,
|
|
1797
|
+
selection: !adapt && sel?.text ? { ...sel, baseId: versionRef.current?.id } : void 0
|
|
1798
|
+
});
|
|
1799
|
+
Sel(void 0);
|
|
1800
|
+
await reload();
|
|
1801
|
+
};
|
|
1802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "section-title", children: [
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
1805
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "eyebrow", children: [
|
|
1806
|
+
"\u5185\u5BB9\u9879\u76EE / ",
|
|
1807
|
+
p.stage
|
|
1808
|
+
] }),
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: p.name })
|
|
1810
|
+
] }),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "save-state", role: "status", children: status }),
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => run(flush), children: "\u7ACB\u5373\u4FDD\u5B58" }),
|
|
1814
|
+
version?.note === "\u91C7\u7528 AI \u4FEE\u6539" && version.baseId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1815
|
+
"button",
|
|
1816
|
+
{
|
|
1817
|
+
onClick: () => run(async () => {
|
|
1818
|
+
await flush();
|
|
1819
|
+
if (versionRef.current?.id !== version.id)
|
|
1820
|
+
throw Error("\u91C7\u7528\u540E\u5DF2\u6709\u65B0\u7F16\u8F91\uFF0C\u8BF7\u5728\u7248\u672C\u9875\u6BD4\u8F83\u540E\u6062\u590D");
|
|
1821
|
+
await api("version.restore", {
|
|
1822
|
+
id: version.baseId,
|
|
1823
|
+
expected: version.id
|
|
1824
|
+
});
|
|
1825
|
+
await load();
|
|
1826
|
+
}),
|
|
1827
|
+
children: "\u64A4\u9500\u4E0A\u6B21\u91C7\u7528"
|
|
1828
|
+
}
|
|
1829
|
+
),
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: exportPage, children: "\u9884\u89C8\u4E0E\u5BFC\u51FA \u2192" })
|
|
1831
|
+
] })
|
|
1832
|
+
] }),
|
|
1833
|
+
p.stale.includes(platform) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "notice", children: [
|
|
1834
|
+
"\u5173\u8054\u7D20\u6750\u6216\u4E8B\u5B9E\u5DF2\u4FEE\u6539\uFF0C\u8BF7\u590D\u6838\u5F53\u524D\u7A3F\u4EF6\u3002",
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1836
|
+
"button",
|
|
1837
|
+
{
|
|
1838
|
+
onClick: () => run(async () => {
|
|
1839
|
+
const fresh = await api("snapshot");
|
|
1840
|
+
const current = fresh.projects.find((x) => x.id === p.id);
|
|
1841
|
+
await api("project.reviewed", {
|
|
1842
|
+
id: p.id,
|
|
1843
|
+
platform,
|
|
1844
|
+
revision: current.revision
|
|
1845
|
+
});
|
|
1846
|
+
}),
|
|
1847
|
+
children: "\u5DF2\u590D\u6838\u5F53\u524D\u5E73\u53F0"
|
|
1848
|
+
}
|
|
1849
|
+
)
|
|
1850
|
+
] }),
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GenerationProgress, { tasks: projectTasks, run }),
|
|
1852
|
+
p.outline && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { className: "outline-preview", children: [
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u67E5\u770B AI \u63D0\u7EB2" }),
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: p.outline })
|
|
1855
|
+
] }),
|
|
1856
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "editor-grid", children: [
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "paper", children: [
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "paper-toolbar", children: [
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: platform === "wechat" ? "\u516C\u4F17\u53F7" : "\u5C0F\u7EA2\u4E66\u957F\u6587" }),
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1862
|
+
"button",
|
|
1863
|
+
{
|
|
1864
|
+
disabled: pending,
|
|
1865
|
+
onClick: () => run(async () => {
|
|
1866
|
+
await flush();
|
|
1867
|
+
const result = await api("project.copy", {
|
|
1868
|
+
id: p.id,
|
|
1869
|
+
platform: platform === "wechat" ? "xiaohongshu" : "wechat"
|
|
1870
|
+
});
|
|
1871
|
+
switchScope(result.scope);
|
|
1872
|
+
}),
|
|
1873
|
+
children: [
|
|
1874
|
+
"\u590D\u5236\u5230",
|
|
1875
|
+
platform === "wechat" ? "\u5C0F\u7EA2\u4E66" : "\u516C\u4F17\u53F7"
|
|
1876
|
+
]
|
|
1877
|
+
}
|
|
1878
|
+
)
|
|
1879
|
+
] }),
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
1881
|
+
doc?.body.length || 0,
|
|
1882
|
+
" \u5B57\u7B26"
|
|
1883
|
+
] })
|
|
1884
|
+
] }),
|
|
1885
|
+
doc && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1887
|
+
"input",
|
|
1888
|
+
{
|
|
1889
|
+
"aria-label": "\u7A3F\u4EF6\u6807\u9898",
|
|
1890
|
+
className: "document-title",
|
|
1891
|
+
placeholder: "\u5199\u4E0B\u4E00\u4E2A\u503C\u5F97\u5151\u73B0\u7684\u6807\u9898",
|
|
1892
|
+
value: doc.title,
|
|
1893
|
+
onChange: (e) => change({ ...doc, title: e.target.value })
|
|
1894
|
+
}
|
|
1895
|
+
),
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1897
|
+
Field,
|
|
1898
|
+
{
|
|
1899
|
+
label: "\u6458\u8981",
|
|
1900
|
+
value: doc.summary,
|
|
1901
|
+
onChange: (v) => change({ ...doc, summary: v })
|
|
1902
|
+
}
|
|
1903
|
+
),
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1905
|
+
"textarea",
|
|
1906
|
+
{
|
|
1907
|
+
"aria-label": "\u6B63\u6587\u7F16\u8F91\u5668",
|
|
1908
|
+
ref: editRef,
|
|
1909
|
+
className: "body-editor",
|
|
1910
|
+
spellCheck: false,
|
|
1911
|
+
placeholder: "\u4ECE\u8FD9\u91CC\u5F00\u59CB\u5199\u4F5C\uFF0C\u6216\u5728\u53F3\u4FA7\u8FD0\u884C\u4E00\u4E2A\u521B\u4F5C\u6B65\u9AA4\u3002\u652F\u6301 Markdown\u3002",
|
|
1912
|
+
value: doc.body,
|
|
1913
|
+
onChange: (e) => change({ ...doc, body: e.target.value }),
|
|
1914
|
+
onSelect: (e) => {
|
|
1915
|
+
const t = e.currentTarget;
|
|
1916
|
+
Sel({
|
|
1917
|
+
start: t.selectionStart,
|
|
1918
|
+
end: t.selectionEnd,
|
|
1919
|
+
text: t.value.slice(t.selectionStart, t.selectionEnd)
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
),
|
|
1924
|
+
sel?.text && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "selection-hint", children: [
|
|
1925
|
+
"\u5DF2\u9009 ",
|
|
1926
|
+
sel.text.length,
|
|
1927
|
+
" ",
|
|
1928
|
+
"\u5B57\u7B26\u3002\u9009\u62E9\u53F3\u4FA7\u300C\u9009\u6BB5\u6539\u5199\u300D\u4EC5\u4FEE\u6539\u6B64\u8303\u56F4\u3002"
|
|
1929
|
+
] }),
|
|
1930
|
+
platform === "xiaohongshu" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u7B14\u8BB0\u6B63\u6587\u3001\u6807\u7B7E\u3001\u5C01\u9762\u4E0E\u5206\u9875\u7A3F" }),
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1933
|
+
Field,
|
|
1934
|
+
{
|
|
1935
|
+
label: "\u7B14\u8BB0\u6B63\u6587\uFF08\u72EC\u7ACB\u4E8E\u957F\u6587\uFF09",
|
|
1936
|
+
value: doc.noteBody,
|
|
1937
|
+
multi: true,
|
|
1938
|
+
onChange: (v) => change({ ...doc, noteBody: v })
|
|
1939
|
+
}
|
|
1940
|
+
),
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1942
|
+
Field,
|
|
1943
|
+
{
|
|
1944
|
+
label: "\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",
|
|
1945
|
+
value: doc.tags.join(","),
|
|
1946
|
+
onChange: (v) => change({ ...doc, tags: v.split(/[,,]/) })
|
|
1947
|
+
}
|
|
1948
|
+
),
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1950
|
+
Field,
|
|
1951
|
+
{
|
|
1952
|
+
label: "\u5C01\u9762\u6587\u5B57",
|
|
1953
|
+
value: doc.cover,
|
|
1954
|
+
onChange: (v) => change({ ...doc, cover: v })
|
|
1955
|
+
}
|
|
1956
|
+
),
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1958
|
+
Field,
|
|
1959
|
+
{
|
|
1960
|
+
label: "\u53EF\u9009\u5206\u9875\u7A3F\uFF08\u4EE5 --- \u5206\u9694\uFF09",
|
|
1961
|
+
value: doc.pages.join("\n---\n"),
|
|
1962
|
+
multi: true,
|
|
1963
|
+
onChange: (v) => change({ ...doc, pages: v.split(/\n---\n/) })
|
|
1964
|
+
}
|
|
1965
|
+
),
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "muted", children: [
|
|
1967
|
+
data.settings.xhsRules,
|
|
1968
|
+
" \u6838\u9A8C\u65F6\u95F4\uFF1A",
|
|
1969
|
+
data.settings.rulesVerifiedAt
|
|
1970
|
+
] })
|
|
1971
|
+
] })
|
|
1972
|
+
] })
|
|
1973
|
+
] }),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("aside", { className: "editor-aside", children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1976
|
+
EditConversation,
|
|
1977
|
+
{
|
|
1978
|
+
tasks: projectTasks,
|
|
1979
|
+
platform,
|
|
1980
|
+
selection: sel?.text,
|
|
1981
|
+
pending,
|
|
1982
|
+
submit: chat,
|
|
1983
|
+
compare: C
|
|
1984
|
+
}
|
|
1985
|
+
),
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { className: "panel advanced-ai", children: [
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u66F4\u591A AI \u64CD\u4F5C" }),
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u672C\u6B21\u64CD\u4F5C" }),
|
|
1990
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("select", { value: step, onChange: (e) => S(e.target.value), children: Object.entries(steps).filter(([key]) => !["ocr", "compose", "chat"].includes(key)).map(([key, s]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: key, children: s.label }, key)) })
|
|
1991
|
+
] }),
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1993
|
+
Field,
|
|
1994
|
+
{
|
|
1995
|
+
label: "\u672C\u6B21\u53CD\u9988 / \u8981\u6C42\uFF08\u4EC5\u7528\u4E8E\u5F53\u524D\u6587\u7AE0\uFF09",
|
|
1996
|
+
value: instruction,
|
|
1997
|
+
multi: true,
|
|
1998
|
+
onChange: I
|
|
1999
|
+
}
|
|
2000
|
+
),
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2002
|
+
"button",
|
|
2003
|
+
{
|
|
2004
|
+
className: "primary",
|
|
2005
|
+
disabled: pending,
|
|
2006
|
+
onClick: () => run(() => start(step)),
|
|
2007
|
+
children: [
|
|
2008
|
+
"\u6267\u884C",
|
|
2009
|
+
steps[step].label
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
),
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u8FDE\u7EED\u751F\u6210" }),
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u4E3A\u5F53\u524D\u5E73\u53F0\u4F9D\u6B21\u5F62\u6210\u7B80\u62A5\u3001\u63D0\u7EB2\u3001\u5019\u9009\u7A3F\u4E0E\u5BA1\u9605\u610F\u89C1\u3002\u540E\u53F0\u6301\u7EED\u8FD0\u884C\uFF0C\u53EF\u5728\u9876\u90E8\u505C\u6B62\u3002" }),
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { disabled: pending, onClick: () => run(complete), children: pending ? "\u6B63\u5728\u6267\u884C\u2026" : "\u91CD\u65B0\u751F\u6210\u5F53\u524D\u5E73\u53F0\u521D\u7A3F" })
|
|
2017
|
+
] })
|
|
2018
|
+
] }),
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tabs", children: ["\u7B80\u62A5", "\u7D20\u6750", "\u8BC1\u636E", "\u914D\u56FE", "\u7248\u672C", "\u590D\u76D8"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2020
|
+
"button",
|
|
2021
|
+
{
|
|
2022
|
+
className: tab === t ? "active" : "",
|
|
2023
|
+
onClick: () => Tab(t),
|
|
2024
|
+
children: t
|
|
2025
|
+
},
|
|
2026
|
+
t
|
|
2027
|
+
)) }),
|
|
2028
|
+
tab === "\u7B80\u62A5" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2030
|
+
Field,
|
|
2031
|
+
{
|
|
2032
|
+
label: "\u9879\u76EE\u540D\u79F0",
|
|
2033
|
+
value: plan.name,
|
|
2034
|
+
onChange: (v) => Plan({ ...plan, name: v })
|
|
2035
|
+
}
|
|
2036
|
+
),
|
|
2037
|
+
[
|
|
2038
|
+
"reader",
|
|
2039
|
+
"theme",
|
|
2040
|
+
"question",
|
|
2041
|
+
"stance",
|
|
2042
|
+
"goal",
|
|
2043
|
+
"brief",
|
|
2044
|
+
"outline"
|
|
2045
|
+
].map((k, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2046
|
+
Field,
|
|
2047
|
+
{
|
|
2048
|
+
label: [
|
|
2049
|
+
"\u8BFB\u8005",
|
|
2050
|
+
"\u4E3B\u9898",
|
|
2051
|
+
"\u6838\u5FC3\u95EE\u9898",
|
|
2052
|
+
"\u4F5C\u8005\u7ACB\u573A",
|
|
2053
|
+
"\u5185\u5BB9\u76EE\u6807",
|
|
2054
|
+
"\u7F16\u8F91\u7B80\u62A5",
|
|
2055
|
+
"\u63D0\u7EB2"
|
|
2056
|
+
][i],
|
|
2057
|
+
value: plan[k],
|
|
2058
|
+
multi: ["brief", "outline"].includes(k),
|
|
2059
|
+
onChange: (v) => Plan({ ...plan, [k]: v })
|
|
2060
|
+
},
|
|
2061
|
+
k
|
|
2062
|
+
)),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => run(savePlan), children: "\u4FDD\u5B58\u9879\u76EE\u4E0E\u63D0\u7EB2" }),
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u9879\u76EE\u7BA1\u7406" }),
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2067
|
+
"button",
|
|
2068
|
+
{
|
|
2069
|
+
onClick: () => run(
|
|
2070
|
+
() => api("project.update", {
|
|
2071
|
+
id: p.id,
|
|
2072
|
+
revision: p.revision,
|
|
2073
|
+
project: { ...p, archived: !p.archived }
|
|
2074
|
+
})
|
|
2075
|
+
),
|
|
2076
|
+
children: p.archived ? "\u6062\u590D\u9879\u76EE" : "\u5F52\u6863\u9879\u76EE\uFF08\u4FDD\u7559\u5185\u5BB9\uFF09"
|
|
2077
|
+
}
|
|
2078
|
+
)
|
|
2079
|
+
] }),
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u7F16\u8F91\u610F\u89C1" }),
|
|
2081
|
+
p.comments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: s }, i)),
|
|
2082
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u5F85\u786E\u8BA4\u4E8B\u9879" }),
|
|
2083
|
+
p.questions.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "check", children: [
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2085
|
+
"input",
|
|
2086
|
+
{
|
|
2087
|
+
type: "checkbox",
|
|
2088
|
+
onChange: () => run(
|
|
2089
|
+
() => api("project.update", {
|
|
2090
|
+
id: p.id,
|
|
2091
|
+
revision: p.revision,
|
|
2092
|
+
project: {
|
|
2093
|
+
...p,
|
|
2094
|
+
questions: p.questions.filter((_, j) => i !== j)
|
|
2095
|
+
}
|
|
2096
|
+
})
|
|
2097
|
+
)
|
|
2098
|
+
}
|
|
2099
|
+
),
|
|
2100
|
+
s
|
|
2101
|
+
] }, i))
|
|
2102
|
+
] }),
|
|
2103
|
+
tab === "\u7D20\u6750" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u5173\u8054\u7D20\u6750" }),
|
|
2105
|
+
data.materials.filter((m) => !m.deleted).map((m) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "check", children: [
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2107
|
+
"input",
|
|
2108
|
+
{
|
|
2109
|
+
type: "checkbox",
|
|
2110
|
+
checked: p.materialIds.includes(m.id),
|
|
2111
|
+
onChange: (e) => run(
|
|
2112
|
+
() => api("project.update", {
|
|
2113
|
+
id: p.id,
|
|
2114
|
+
revision: p.revision,
|
|
2115
|
+
project: {
|
|
2116
|
+
...p,
|
|
2117
|
+
materialIds: e.target.checked ? [...p.materialIds, m.id] : p.materialIds.filter((id) => id !== m.id)
|
|
2118
|
+
}
|
|
2119
|
+
})
|
|
2120
|
+
)
|
|
2121
|
+
}
|
|
2122
|
+
),
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: m.title }),
|
|
2125
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
2126
|
+
m.origin,
|
|
2127
|
+
" \xB7 ",
|
|
2128
|
+
m.summary || m.text.slice(0, 100)
|
|
2129
|
+
] })
|
|
2130
|
+
] })
|
|
2131
|
+
] }, m.id))
|
|
2132
|
+
] }),
|
|
2133
|
+
tab === "\u8BC1\u636E" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u4E8B\u5B9E\u4E0E\u6765\u6E90" }),
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u8BC6\u522B\u4E0E\u641C\u7D22\u7ED3\u679C\u9ED8\u8BA4\u5F85\u6838\u5B9E\uFF0C\u52FE\u9009\u610F\u5473\u7740\u4F5C\u8005\u5DF2\u7ECF\u6838\u5BF9\u539F\u59CB\u8BC1\u636E\u3002" }),
|
|
2136
|
+
p.facts.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fact", children: [
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: f.claim }),
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("blockquote", { children: f.excerpt }),
|
|
2139
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
2140
|
+
f.kind,
|
|
2141
|
+
" \xB7",
|
|
2142
|
+
" ",
|
|
2143
|
+
data.materials.find((m) => m.id === f.materialId)?.title || "\u672A\u5173\u8054\u7D20\u6750"
|
|
2144
|
+
] }),
|
|
2145
|
+
f.materialId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2146
|
+
"a",
|
|
2147
|
+
{
|
|
2148
|
+
href: api.url(
|
|
2149
|
+
"/content-studio-api/asset/" + encodeURIComponent(f.materialId)
|
|
2150
|
+
),
|
|
2151
|
+
target: "_blank",
|
|
2152
|
+
rel: "noreferrer",
|
|
2153
|
+
children: "\u67E5\u770B\u6765\u6E90\u7D20\u6750\u539F\u6587"
|
|
2154
|
+
}
|
|
2155
|
+
),
|
|
2156
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2157
|
+
"select",
|
|
2158
|
+
{
|
|
2159
|
+
"aria-label": "\u6838\u9A8C\u72B6\u6001",
|
|
2160
|
+
value: f.status,
|
|
2161
|
+
onChange: (e) => run(
|
|
2162
|
+
() => api("project.update", {
|
|
2163
|
+
id: p.id,
|
|
2164
|
+
revision: p.revision,
|
|
2165
|
+
project: {
|
|
2166
|
+
...p,
|
|
2167
|
+
facts: p.facts.map(
|
|
2168
|
+
(x, j) => j === i ? { ...x, status: e.target.value } : x
|
|
2169
|
+
)
|
|
2170
|
+
}
|
|
2171
|
+
})
|
|
2172
|
+
),
|
|
2173
|
+
children: ["\u5F85\u6838\u5B9E", "\u5DF2\u6838\u5B9E", "\u4F5C\u8005\u786E\u8BA4"].map((s) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { children: s }, s))
|
|
2174
|
+
}
|
|
2175
|
+
)
|
|
2176
|
+
] }, f.id)),
|
|
2177
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2178
|
+
JsonEditor,
|
|
2179
|
+
{
|
|
2180
|
+
label: "\u65B0\u589E / \u7F16\u8F91\u8BC1\u636E\u7247\u6BB5",
|
|
2181
|
+
value: p.facts,
|
|
2182
|
+
save: (facts) => run(
|
|
2183
|
+
() => api("project.update", {
|
|
2184
|
+
id: p.id,
|
|
2185
|
+
revision: p.revision,
|
|
2186
|
+
project: { ...p, facts }
|
|
2187
|
+
})
|
|
2188
|
+
)
|
|
2189
|
+
}
|
|
2190
|
+
)
|
|
2191
|
+
] }),
|
|
2192
|
+
tab === "\u914D\u56FE" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u56FE\u7247\u4E0E\u7AE0\u8282" }),
|
|
2194
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2195
|
+
"select",
|
|
2196
|
+
{
|
|
2197
|
+
"aria-label": "\u9009\u62E9\u914D\u56FE\u7D20\u6750",
|
|
2198
|
+
defaultValue: "",
|
|
2199
|
+
onChange: (e) => {
|
|
2200
|
+
if (e.target.value)
|
|
2201
|
+
run(
|
|
2202
|
+
() => api("project.update", {
|
|
2203
|
+
id: p.id,
|
|
2204
|
+
revision: p.revision,
|
|
2205
|
+
project: {
|
|
2206
|
+
...p,
|
|
2207
|
+
images: [
|
|
2208
|
+
...p.images,
|
|
2209
|
+
{
|
|
2210
|
+
materialId: e.target.value,
|
|
2211
|
+
caption: "",
|
|
2212
|
+
alt: "",
|
|
2213
|
+
placement: "\u6587\u672B",
|
|
2214
|
+
prompt: ""
|
|
2215
|
+
}
|
|
2216
|
+
]
|
|
2217
|
+
}
|
|
2218
|
+
})
|
|
2219
|
+
);
|
|
2220
|
+
e.target.value = "";
|
|
2221
|
+
},
|
|
2222
|
+
children: [
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u4ECE\u7D20\u6750\u5E93\u6DFB\u52A0\u56FE\u7247" }),
|
|
2224
|
+
data.materials.filter((m) => m.type === "image" && !m.deleted).map((m) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: m.id, children: m.title }, m.id))
|
|
2225
|
+
]
|
|
2226
|
+
}
|
|
2227
|
+
),
|
|
2228
|
+
plan.images.map((img, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fact", children: [
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2230
|
+
"img",
|
|
2231
|
+
{
|
|
2232
|
+
className: "thumb",
|
|
2233
|
+
src: api.url("/content-studio-api/asset/" + img.materialId),
|
|
2234
|
+
alt: img.alt
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
["caption", "alt", "placement", "prompt"].map(
|
|
2238
|
+
(k, j) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2239
|
+
Field,
|
|
2240
|
+
{
|
|
2241
|
+
label: [
|
|
2242
|
+
"\u56FE\u7247\u8BF4\u660E",
|
|
2243
|
+
"\u66FF\u4EE3\u6587\u672C",
|
|
2244
|
+
"\u5BF9\u5E94\u7AE0\u8282 / \u4F4D\u7F6E",
|
|
2245
|
+
"\u65B0\u56FE\u7B80\u62A5 / \u63D0\u793A\u8BCD"
|
|
2246
|
+
][j],
|
|
2247
|
+
value: img[k],
|
|
2248
|
+
onChange: (v) => Plan({
|
|
2249
|
+
...plan,
|
|
2250
|
+
images: plan.images.map(
|
|
2251
|
+
(x, n) => n === i ? { ...x, [k]: v } : x
|
|
2252
|
+
)
|
|
2253
|
+
})
|
|
2254
|
+
},
|
|
2255
|
+
k
|
|
2256
|
+
)
|
|
2257
|
+
),
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2259
|
+
"button",
|
|
2260
|
+
{
|
|
2261
|
+
disabled: i === 0,
|
|
2262
|
+
onClick: () => {
|
|
2263
|
+
const imgs = [...plan.images];
|
|
2264
|
+
[imgs[i - 1], imgs[i]] = [imgs[i], imgs[i - 1]];
|
|
2265
|
+
Plan({ ...plan, images: imgs });
|
|
2266
|
+
},
|
|
2267
|
+
children: "\u4E0A\u79FB"
|
|
2268
|
+
}
|
|
2269
|
+
),
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2271
|
+
"button",
|
|
2272
|
+
{
|
|
2273
|
+
onClick: () => Plan({
|
|
2274
|
+
...plan,
|
|
2275
|
+
images: plan.images.filter((_, n) => n !== i)
|
|
2276
|
+
}),
|
|
2277
|
+
children: "\u79FB\u9664\u5173\u8054"
|
|
2278
|
+
}
|
|
2279
|
+
)
|
|
2280
|
+
] }, i)),
|
|
2281
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => run(savePlan), children: "\u4FDD\u5B58\u914D\u56FE\u987A\u5E8F\u4E0E\u8BF4\u660E" }),
|
|
2282
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u5BFC\u51FA\u56FE\u7247\u6309\u6B64\u987A\u5E8F\u9644\u5728\u6B63\u6587\u672B\u5C3E\uFF1B\u7AE0\u8282\u4F4D\u7F6E\u4FDD\u5B58\u5728\u914D\u56FE\u6E05\u5355\u4F9B\u53D1\u5E03\u65F6\u6392\u7248\u3002\u65B0\u56FE\u7531\u300C\u56FE\u7247\u7B80\u62A5\u300D\u751F\u6210\u63D0\u793A\u8BCD\uFF0C\u6682\u65E0\u5DF2\u6838\u9A8C\u7684\u56FE\u50CF\u751F\u6210\u670D\u52A1\u3002" })
|
|
2283
|
+
] }),
|
|
2284
|
+
tab === "\u7248\u672C" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u7248\u672C\u5386\u53F2" }),
|
|
2286
|
+
versions.map((v) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { className: "version", onClick: () => C(v), children: [
|
|
2287
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
|
2288
|
+
v.candidate ? "\u5019\u9009 \xB7 " : "",
|
|
2289
|
+
v.note
|
|
2290
|
+
] }),
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("small", { children: [
|
|
2292
|
+
date(v.createdAt),
|
|
2293
|
+
version?.id === v.id ? " \xB7 \u5F53\u524D" : ""
|
|
2294
|
+
] })
|
|
2295
|
+
] }, v.id))
|
|
2296
|
+
] }),
|
|
2297
|
+
tab === "\u590D\u76D8" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u8BA1\u5212\u4E0E\u53D1\u5E03\u8BB0\u5F55" }),
|
|
2299
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2300
|
+
Field,
|
|
2301
|
+
{
|
|
2302
|
+
label: "\u8BA1\u5212\u53D1\u5E03\u65F6\u95F4",
|
|
2303
|
+
value: plan.schedule,
|
|
2304
|
+
onChange: (v) => Plan({ ...plan, schedule: v }),
|
|
2305
|
+
type: "datetime-local"
|
|
2306
|
+
}
|
|
2307
|
+
),
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2309
|
+
Select,
|
|
2310
|
+
{
|
|
2311
|
+
label: "\u7F16\u8F91\u9636\u6BB5",
|
|
2312
|
+
value: plan.stage,
|
|
2313
|
+
items: ["\u8349\u7A3F", "\u5F85\u7EC8\u5BA1", "\u5DF2\u786E\u8BA4", "\u5DF2\u5BFC\u51FA", "\u5DF2\u53D1\u5E03\u8BB0\u5F55"],
|
|
2314
|
+
onChange: (v) => Plan({ ...plan, stage: v })
|
|
2315
|
+
}
|
|
2316
|
+
),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => run(savePlan), children: "\u4FDD\u5B58\u9636\u6BB5\u4E0E\u8BA1\u5212" }),
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2319
|
+
"button",
|
|
2320
|
+
{
|
|
2321
|
+
onClick: () => run(async () => {
|
|
2322
|
+
const url = prompt("\u5DF2\u53D1\u5E03\u94FE\u63A5");
|
|
2323
|
+
if (!url) return;
|
|
2324
|
+
await api("project.update", {
|
|
2325
|
+
id: p.id,
|
|
2326
|
+
revision: p.revision,
|
|
2327
|
+
project: {
|
|
2328
|
+
...p,
|
|
2329
|
+
stage: "\u5DF2\u53D1\u5E03\u8BB0\u5F55",
|
|
2330
|
+
publications: [
|
|
2331
|
+
...p.publications,
|
|
2332
|
+
{
|
|
2333
|
+
platform,
|
|
2334
|
+
versionId: version?.id,
|
|
2335
|
+
url,
|
|
2336
|
+
time: (/* @__PURE__ */ new Date()).toISOString()
|
|
2337
|
+
}
|
|
2338
|
+
]
|
|
2339
|
+
}
|
|
2340
|
+
});
|
|
2341
|
+
}),
|
|
2342
|
+
children: "\u8BB0\u5F55\u4EBA\u5DE5\u53D1\u5E03\u94FE\u63A5"
|
|
2343
|
+
}
|
|
2344
|
+
),
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2346
|
+
JsonEditor,
|
|
2347
|
+
{
|
|
2348
|
+
label: "\u53D1\u5E03\u8BB0\u5F55",
|
|
2349
|
+
value: p.publications,
|
|
2350
|
+
save: (publications) => run(
|
|
2351
|
+
() => api("project.update", {
|
|
2352
|
+
id: p.id,
|
|
2353
|
+
revision: p.revision,
|
|
2354
|
+
project: { ...p, publications }
|
|
2355
|
+
})
|
|
2356
|
+
)
|
|
2357
|
+
}
|
|
2358
|
+
),
|
|
2359
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2360
|
+
"button",
|
|
2361
|
+
{
|
|
2362
|
+
onClick: () => run(
|
|
2363
|
+
() => api("project.update", {
|
|
2364
|
+
id: p.id,
|
|
2365
|
+
revision: p.revision,
|
|
2366
|
+
project: {
|
|
2367
|
+
...p,
|
|
2368
|
+
reviews: [
|
|
2369
|
+
...p.reviews,
|
|
2370
|
+
{
|
|
2371
|
+
time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2372
|
+
source: "\u624B\u52A8\u8BB0\u5F55",
|
|
2373
|
+
versionId: version?.id,
|
|
2374
|
+
views: null,
|
|
2375
|
+
likes: null,
|
|
2376
|
+
saves: null,
|
|
2377
|
+
comments: null,
|
|
2378
|
+
followers: null,
|
|
2379
|
+
notes: ""
|
|
2380
|
+
}
|
|
2381
|
+
]
|
|
2382
|
+
}
|
|
2383
|
+
})
|
|
2384
|
+
),
|
|
2385
|
+
children: "\u6DFB\u52A0\u4E00\u6B21\u590D\u76D8\u8BB0\u5F55"
|
|
2386
|
+
}
|
|
2387
|
+
),
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2389
|
+
JsonEditor,
|
|
2390
|
+
{
|
|
2391
|
+
label: "\u6307\u6807\u5F55\u5165 / \u5BFC\u5165 JSON",
|
|
2392
|
+
value: p.reviews,
|
|
2393
|
+
save: (reviews) => run(
|
|
2394
|
+
() => api("project.update", {
|
|
2395
|
+
id: p.id,
|
|
2396
|
+
revision: p.revision,
|
|
2397
|
+
project: { ...p, reviews }
|
|
2398
|
+
})
|
|
2399
|
+
)
|
|
2400
|
+
}
|
|
2401
|
+
),
|
|
2402
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "null \u4E3A\u672A\u63D0\u4F9B\uFF1B0 \u4E3A\u5B9E\u9645\u96F6\u3002\u53EF\u8FD0\u884C\u300C\u53D1\u5E03\u590D\u76D8\u300D\u63D0\u51FA\u4E0B\u4E00\u7BC7\u5EFA\u8BAE\uFF0C\u4E0D\u63A8\u65AD\u56E0\u679C\u6216\u4FDD\u8BC1\u589E\u957F\u3002" })
|
|
2403
|
+
] })
|
|
2404
|
+
] })
|
|
2405
|
+
] }),
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Tasks, { tasks: data.tasks.filter((t) => t.projectId === p.id), run }),
|
|
2407
|
+
compare && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "modal-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "modal wide", role: "dialog", "aria-label": "\u7248\u672C\u6BD4\u8F83", children: [
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "section-title", children: [
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u7248\u672C\u6BD4\u8F83" }),
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => C(void 0), children: "\u5173\u95ED" })
|
|
2411
|
+
] }),
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u5F53\u524D\u7A3F\u4EF6" }),
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: doc?.title + "\n\n" + doc?.body })
|
|
2416
|
+
] }),
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h3", { children: [
|
|
2419
|
+
compare.candidate ? "\u5019\u9009\u7A3F\u4EF6" : "\u5386\u53F2\u7248\u672C",
|
|
2420
|
+
" \xB7",
|
|
2421
|
+
" ",
|
|
2422
|
+
date(compare.createdAt)
|
|
2423
|
+
] }),
|
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { children: compare.doc.title + "\n\n" + compare.doc.body })
|
|
2425
|
+
] })
|
|
2426
|
+
] }),
|
|
2427
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2428
|
+
"button",
|
|
2429
|
+
{
|
|
2430
|
+
className: "primary",
|
|
2431
|
+
onClick: () => run(async () => {
|
|
2432
|
+
await flush();
|
|
2433
|
+
if (compare.candidate && compare.baseId !== versionRef.current?.id) {
|
|
2434
|
+
message(
|
|
2435
|
+
"\u6B63\u6587\u5728\u751F\u6210\u5EFA\u8BAE\u540E\u5DF2\u6709\u53D8\u5316\uFF0C\u8BF7\u9010\u6BB5\u590D\u5236\u9700\u8981\u7684\u4FEE\u6539\uFF0C\u907F\u514D\u8986\u76D6\u65B0\u5185\u5BB9\u3002"
|
|
2436
|
+
);
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
await api("version.restore", {
|
|
2440
|
+
id: compare.id,
|
|
2441
|
+
expected: versionRef.current?.id
|
|
2442
|
+
});
|
|
2443
|
+
C(void 0);
|
|
2444
|
+
await load();
|
|
2445
|
+
}),
|
|
2446
|
+
children: compare.candidate ? "\u91C7\u7528\u6B64\u4FEE\u6539\uFF08\u4FDD\u7559\u539F\u7A3F\uFF09" : "\u6062\u590D\u6B64\u7248\u672C\uFF08\u4FDD\u7559\u5F53\u524D\u7248\u672C\uFF09"
|
|
2447
|
+
}
|
|
2448
|
+
),
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u53EF\u5C06\u53F3\u4FA7\u9700\u8981\u7684\u6BB5\u843D\u590D\u5236\u5230\u6B63\u6587\u8FDB\u884C\u4EBA\u5DE5\u5408\u5E76\u3002" })
|
|
2450
|
+
] }) })
|
|
2451
|
+
] });
|
|
2452
|
+
}
|
|
2453
|
+
function Exports({
|
|
2454
|
+
p,
|
|
2455
|
+
run,
|
|
2456
|
+
data
|
|
2457
|
+
}) {
|
|
2458
|
+
const api = useStudioApi();
|
|
2459
|
+
const [view, V] = (0, import_react3.useState)(), [format, F] = (0, import_react3.useState)(
|
|
2460
|
+
data.scope.platform === "wechat" ? "\u516C\u4F17\u53F7 HTML" : "Markdown"
|
|
2461
|
+
), [download, D] = (0, import_react3.useState)("");
|
|
2462
|
+
(0, import_react3.useEffect)(() => {
|
|
2463
|
+
void api("export.preview", { projectId: p.id }).then(V);
|
|
2464
|
+
}, [
|
|
2465
|
+
p.id,
|
|
2466
|
+
p.revision,
|
|
2467
|
+
data.tasks.filter((t) => t.status === "completed").length
|
|
2468
|
+
]);
|
|
2469
|
+
const saveFile = (name, text, mime) => {
|
|
2470
|
+
const url = URL.createObjectURL(new Blob([text], { type: mime }));
|
|
2471
|
+
const a = document.createElement("a");
|
|
2472
|
+
a.href = url;
|
|
2473
|
+
a.download = name;
|
|
2474
|
+
a.click();
|
|
2475
|
+
setTimeout(() => URL.revokeObjectURL(url), 3e3);
|
|
2476
|
+
};
|
|
2477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h2", { children: [
|
|
2479
|
+
"\u9884\u89C8\u4E0E\u5BFC\u51FA \xB7 ",
|
|
2480
|
+
p.name
|
|
2481
|
+
] }),
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u9884\u89C8\u4E0E\u5BFC\u51FA\u4F7F\u7528\u540C\u4E00\u751F\u6210\u51FD\u6570\u3002\u6838\u9A8C\u8BB0\u5F55\u72EC\u7ACB\u4FDD\u5B58\uFF1B\u5BFC\u51FA\u4E0D\u4EE3\u8868\u53D1\u5E03\u3002" }),
|
|
2483
|
+
view && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2485
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u53D1\u5E03\u524D\u68C0\u67E5" }),
|
|
2486
|
+
view.warnings.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { children: view.warnings.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: w }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u672A\u53D1\u73B0\u8BB0\u5F55\u4E2D\u7684\u5F85\u786E\u8BA4\u9879\uFF0C\u4ECD\u9700\u4F5C\u8005\u7EC8\u5BA1\u3002" }),
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { children: [
|
|
2488
|
+
"\u5F53\u524D\u5E73\u53F0\u89C4\u5219\u6838\u9A8C\uFF1A",
|
|
2489
|
+
data.settings.rulesVerifiedAt
|
|
2490
|
+
] }),
|
|
2491
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2492
|
+
"button",
|
|
2493
|
+
{
|
|
2494
|
+
className: "primary",
|
|
2495
|
+
onClick: () => run(async () => {
|
|
2496
|
+
const r = await api("export.create", {
|
|
2497
|
+
projectId: p.id
|
|
2498
|
+
});
|
|
2499
|
+
D(api.url("/content-studio-api/download/" + r.id));
|
|
2500
|
+
}),
|
|
2501
|
+
children: "\u751F\u6210\u5B8C\u6574 ZIP / \u9879\u76EE\u5907\u4EFD"
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
download && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: "download", href: download, children: "\u4E0B\u8F7D\u9879\u76EE ZIP" }),
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { children: [
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: "\u5355\u72EC\u4E0B\u8F7D\u53D1\u5E03\u6587\u4EF6" }),
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2509
|
+
"button",
|
|
2510
|
+
{
|
|
2511
|
+
onClick: () => saveFile(
|
|
2512
|
+
data.scope.platform + ".md",
|
|
2513
|
+
view.markdown,
|
|
2514
|
+
"text/markdown"
|
|
2515
|
+
),
|
|
2516
|
+
children: "Markdown"
|
|
2517
|
+
}
|
|
2518
|
+
),
|
|
2519
|
+
data.scope.platform === "wechat" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2520
|
+
"button",
|
|
2521
|
+
{
|
|
2522
|
+
onClick: () => saveFile("wechat.html", view.html, "text/html"),
|
|
2523
|
+
children: "\u516C\u4F17\u53F7 HTML"
|
|
2524
|
+
}
|
|
2525
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2526
|
+
"button",
|
|
2527
|
+
{
|
|
2528
|
+
onClick: () => saveFile("xiaohongshu.txt", view.plain, "text/plain"),
|
|
2529
|
+
children: "\u5C0F\u7EA2\u4E66\u7EAF\u6587\u672C"
|
|
2530
|
+
}
|
|
2531
|
+
)
|
|
2532
|
+
] }),
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u56FE\u7247\u3001\u914D\u56FE\u6E05\u5355\u3001\u72EC\u7ACB\u7F16\u8F91\u8BB0\u5F55\u53CA\u6765\u6E90\u6E05\u5355\u5305\u542B\u5728 ZIP \u4E2D\u3002" })
|
|
2534
|
+
] }),
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u771F\u5B9E\u53D1\u5E03\u6B65\u9AA4" }),
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("ol", { children: [
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: "\u4E0B\u8F7D\u5E76\u89E3\u538B ZIP\u3002" }),
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: "\u516C\u4F17\u53F7\uFF1A\u6D4F\u89C8\u5668\u6253\u5F00 HTML\uFF0C\u590D\u5236\u6B63\u6587\u5230\u5E73\u53F0\u7F16\u8F91\u5668\uFF1B\u56FE\u7247\u9700\u4ECE images \u76EE\u5F55\u9010\u4E00\u4E0A\u4F20\u5E76\u6309\u914D\u56FE\u6E05\u5355\u5B9A\u4F4D\u3002" }),
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: "\u5C0F\u7EA2\u4E66\uFF1A\u4F7F\u7528\u7EAF\u6587\u672C\u7A3F / \u957F\u6587 Markdown\uFF0C\u4EBA\u5DE5\u6838\u5BF9\u957F\u5EA6\u4E0E\u5206\u9875\u9650\u5236\u3002" }),
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: "\u5728\u5E73\u53F0\u9884\u89C8\u5E76\u7EC8\u5BA1\uFF0C\u518D\u624B\u52A8\u53D1\u5E03\u3002\u5728\u5185\u5BB9\u7F16\u8F91\u9875\u8BB0\u5F55\u94FE\u63A5\u3002" })
|
|
2541
|
+
] }),
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u5C1A\u672A\u5728\u771F\u5B9E\u516C\u4F17\u53F7 / \u5C0F\u7EA2\u4E66\u7F16\u8F91\u5668\u4E2D\u9A8C\u8BC1\u7C98\u8D34\u6548\u679C\uFF1B\u672C\u5730\u56FE\u7247\u4E0D\u4F1A\u968F\u590D\u5236\u81EA\u52A8\u4E0A\u4F20\u3002" }),
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u5BFC\u51FA\u8BB0\u5F55" }),
|
|
2544
|
+
data.exports.filter((e) => e.projectId === p.id).map((e) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: api.url("/content-studio-api/download/" + e.id), children: [
|
|
2545
|
+
date(e.createdAt),
|
|
2546
|
+
" \xB7 \u5DF2\u5BFC\u51FA\uFF0C\u672A\u81EA\u52A8\u53D1\u5E03"
|
|
2547
|
+
] }) }, e.id))
|
|
2548
|
+
] }),
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { children: [
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2551
|
+
Select,
|
|
2552
|
+
{
|
|
2553
|
+
label: "\u9884\u89C8\u683C\u5F0F",
|
|
2554
|
+
value: format,
|
|
2555
|
+
items: data.scope.platform === "wechat" ? ["\u516C\u4F17\u53F7 HTML", "Markdown"] : ["Markdown", "\u5C0F\u7EA2\u4E66\u7EAF\u6587\u672C"],
|
|
2556
|
+
onChange: F
|
|
2557
|
+
}
|
|
2558
|
+
),
|
|
2559
|
+
format === "\u516C\u4F17\u53F7 HTML" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2560
|
+
"iframe",
|
|
2561
|
+
{
|
|
2562
|
+
className: "export-preview",
|
|
2563
|
+
title: "\u516C\u4F17\u53F7\u5BFC\u51FA\u9884\u89C8",
|
|
2564
|
+
sandbox: "",
|
|
2565
|
+
srcDoc: view.html.replace(
|
|
2566
|
+
/images\/([a-f0-9]+\.[a-z]+)/g,
|
|
2567
|
+
(_match, file) => api.url(
|
|
2568
|
+
"/content-studio-api/asset/" + (view.images.find((i) => i.material.file === file)?.material.id || "")
|
|
2569
|
+
)
|
|
2570
|
+
)
|
|
2571
|
+
}
|
|
2572
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "export-text", children: format === "Markdown" ? view.markdown : view.plain })
|
|
2573
|
+
] })
|
|
2574
|
+
] }) })
|
|
2575
|
+
] });
|
|
2576
|
+
}
|
|
2577
|
+
function SettingsPage({
|
|
2578
|
+
data,
|
|
2579
|
+
caps,
|
|
2580
|
+
run,
|
|
2581
|
+
switchScope
|
|
2582
|
+
}) {
|
|
2583
|
+
const api = useStudioApi();
|
|
2584
|
+
const [s, S] = (0, import_react3.useState)(data.settings);
|
|
2585
|
+
const [account, setAccount] = (0, import_react3.useState)(data.account);
|
|
2586
|
+
const [newAccount, setNewAccount] = (0, import_react3.useState)({
|
|
2587
|
+
name: "",
|
|
2588
|
+
description: "",
|
|
2589
|
+
positioning: ""
|
|
2590
|
+
});
|
|
2591
|
+
const [adding, setAdding] = (0, import_react3.useState)(false);
|
|
2592
|
+
const [saved, setSaved] = (0, import_react3.useState)("");
|
|
2593
|
+
const platformName2 = data.scope.platform === "wechat" ? "\u516C\u4F17\u53F7" : "\u5C0F\u7EA2\u4E66";
|
|
2594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: "\u8D26\u53F7\u4E0E\u5E73\u53F0\u8BBE\u7F6E" }),
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "muted", children: [
|
|
2597
|
+
"\u5F53\u524D\u5DE5\u4F5C\u533A\uFF1A",
|
|
2598
|
+
data.account.name,
|
|
2599
|
+
" \xB7 ",
|
|
2600
|
+
platformName2,
|
|
2601
|
+
"\u3002\u8D44\u6599\u4FDD\u5B58\u540E\u7528\u4E8E\u540E\u7EED\u521B\u4F5C\uFF1B\u6A21\u578B\u51ED\u636E\u7531 dsh \u7BA1\u7406\u3002"
|
|
2602
|
+
] }),
|
|
2603
|
+
saved && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "notice", role: "status", children: saved }),
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel account-settings", children: [
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "section-title", children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u8D26\u53F7\u8D44\u6599" }),
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { onClick: () => setAdding(!adding), "aria-expanded": adding, children: "\u65B0\u589E\u8D26\u53F7" })
|
|
2608
|
+
] }),
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u8D26\u53F7\u5B9A\u4F4D\u5728\u8BE5\u8D26\u53F7\u7684\u5404\u5E73\u53F0\u521B\u4F5C\u4E2D\u751F\u6548\u3002\u5E73\u53F0\u7684\u53D7\u4F17\u3001\u8BED\u6C14\u3001\u6837\u6587\u548C\u89C4\u5219\u5728\u4E0B\u65B9\u5206\u522B\u8BBE\u7F6E\u3002" }),
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2611
|
+
"form",
|
|
2612
|
+
{
|
|
2613
|
+
onSubmit: (e) => {
|
|
2614
|
+
e.preventDefault();
|
|
2615
|
+
run(async () => {
|
|
2616
|
+
const updated = await api("account.update", {
|
|
2617
|
+
id: account.id,
|
|
2618
|
+
account
|
|
2619
|
+
});
|
|
2620
|
+
setAccount(updated);
|
|
2621
|
+
setSaved("\u8D26\u53F7\u8D44\u6599\u5DF2\u4FDD\u5B58");
|
|
2622
|
+
});
|
|
2623
|
+
},
|
|
2624
|
+
children: [
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8D26\u53F7\u540D\u79F0" }),
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2628
|
+
"input",
|
|
2629
|
+
{
|
|
2630
|
+
required: true,
|
|
2631
|
+
maxLength: 80,
|
|
2632
|
+
value: account.name,
|
|
2633
|
+
onChange: (e) => setAccount({ ...account, name: e.target.value })
|
|
2634
|
+
}
|
|
2635
|
+
)
|
|
2636
|
+
] }),
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2638
|
+
Field,
|
|
2639
|
+
{
|
|
2640
|
+
label: "\u8D26\u53F7\u7B80\u4ECB",
|
|
2641
|
+
value: account.description,
|
|
2642
|
+
multi: true,
|
|
2643
|
+
onChange: (v) => setAccount({ ...account, description: v })
|
|
2644
|
+
}
|
|
2645
|
+
),
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2647
|
+
Field,
|
|
2648
|
+
{
|
|
2649
|
+
label: "\u8D26\u53F7\u5B9A\u4F4D\u4E0E\u7279\u8272",
|
|
2650
|
+
value: account.positioning,
|
|
2651
|
+
multi: true,
|
|
2652
|
+
onChange: (v) => setAccount({ ...account, positioning: v })
|
|
2653
|
+
}
|
|
2654
|
+
),
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "muted", children: [
|
|
2656
|
+
"\u8D26\u53F7 ID\uFF1A",
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { children: account.id }),
|
|
2658
|
+
account.id === "default" ? " \xB7 \u5185\u7F6E\u9ED8\u8BA4\u8D26\u53F7" : ""
|
|
2659
|
+
] }),
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "primary", type: "submit", children: "\u4FDD\u5B58\u8D26\u53F7\u8D44\u6599" })
|
|
2661
|
+
]
|
|
2662
|
+
}
|
|
2663
|
+
),
|
|
2664
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2665
|
+
"form",
|
|
2666
|
+
{
|
|
2667
|
+
className: "new-account",
|
|
2668
|
+
onSubmit: (e) => {
|
|
2669
|
+
e.preventDefault();
|
|
2670
|
+
run(async () => {
|
|
2671
|
+
const created = await api(
|
|
2672
|
+
"account.create",
|
|
2673
|
+
newAccount
|
|
2674
|
+
);
|
|
2675
|
+
switchScope({ ...data.scope, accountId: created.id });
|
|
2676
|
+
});
|
|
2677
|
+
},
|
|
2678
|
+
children: [
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u65B0\u589E\u72EC\u7ACB\u8D26\u53F7" }),
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u65B0\u8D26\u53F7\u4ECE\u7A7A\u767D\u7D20\u6750\u3001\u9879\u76EE\u548C\u9009\u9898\u5F00\u59CB\uFF0C\u6BCF\u4E2A\u5E73\u53F0\u4F7F\u7528\u72EC\u7ACB\u504F\u597D\u3002" }),
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u65B0\u8D26\u53F7\u540D\u79F0" }),
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2684
|
+
"input",
|
|
2685
|
+
{
|
|
2686
|
+
autoFocus: true,
|
|
2687
|
+
required: true,
|
|
2688
|
+
maxLength: 80,
|
|
2689
|
+
value: newAccount.name,
|
|
2690
|
+
onChange: (e) => setNewAccount({ ...newAccount, name: e.target.value })
|
|
2691
|
+
}
|
|
2692
|
+
)
|
|
2693
|
+
] }),
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2695
|
+
Field,
|
|
2696
|
+
{
|
|
2697
|
+
label: "\u65B0\u8D26\u53F7\u7B80\u4ECB",
|
|
2698
|
+
value: newAccount.description,
|
|
2699
|
+
multi: true,
|
|
2700
|
+
onChange: (v) => setNewAccount({ ...newAccount, description: v })
|
|
2701
|
+
}
|
|
2702
|
+
),
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2704
|
+
Field,
|
|
2705
|
+
{
|
|
2706
|
+
label: "\u65B0\u8D26\u53F7\u5B9A\u4F4D\u4E0E\u7279\u8272",
|
|
2707
|
+
value: newAccount.positioning,
|
|
2708
|
+
multi: true,
|
|
2709
|
+
onChange: (v) => setNewAccount({ ...newAccount, positioning: v })
|
|
2710
|
+
}
|
|
2711
|
+
),
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "actions", children: [
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2714
|
+
"button",
|
|
2715
|
+
{
|
|
2716
|
+
className: "primary",
|
|
2717
|
+
type: "submit",
|
|
2718
|
+
disabled: !newAccount.name.trim(),
|
|
2719
|
+
children: "\u521B\u5EFA\u5E76\u5207\u6362\u8D26\u53F7"
|
|
2720
|
+
}
|
|
2721
|
+
),
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setAdding(false), children: "\u53D6\u6D88" })
|
|
2723
|
+
] })
|
|
2724
|
+
]
|
|
2725
|
+
}
|
|
2726
|
+
)
|
|
2727
|
+
] }),
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "two", children: [
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2730
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h3", { children: [
|
|
2731
|
+
platformName2,
|
|
2732
|
+
" \xB7 \u521B\u4F5C\u7279\u8272"
|
|
2733
|
+
] }),
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2735
|
+
Field,
|
|
2736
|
+
{
|
|
2737
|
+
label: "\u5F53\u524D\u5E73\u53F0\u5B9A\u4F4D",
|
|
2738
|
+
value: s.positioning,
|
|
2739
|
+
multi: true,
|
|
2740
|
+
onChange: (v) => S({ ...s, positioning: v })
|
|
2741
|
+
}
|
|
2742
|
+
),
|
|
2743
|
+
[
|
|
2744
|
+
"domains",
|
|
2745
|
+
"reader",
|
|
2746
|
+
"tone",
|
|
2747
|
+
"banned",
|
|
2748
|
+
"structure",
|
|
2749
|
+
"samples"
|
|
2750
|
+
].map((key, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2751
|
+
Field,
|
|
2752
|
+
{
|
|
2753
|
+
label: [
|
|
2754
|
+
"\u5185\u5BB9\u9886\u57DF",
|
|
2755
|
+
"\u76EE\u6807\u8BFB\u8005",
|
|
2756
|
+
"\u8BED\u6C14",
|
|
2757
|
+
"\u7981\u7528\u8868\u8FBE\u4E0E\u8FB9\u754C",
|
|
2758
|
+
"\u7ED3\u6784\u504F\u597D",
|
|
2759
|
+
"\u53C2\u8003\u6837\u6587\uFF08\u53EF\u5220\u9664\uFF09"
|
|
2760
|
+
][i],
|
|
2761
|
+
value: s[key],
|
|
2762
|
+
multi: ["samples", "banned"].includes(key),
|
|
2763
|
+
onChange: (v) => S({ ...s, [key]: v })
|
|
2764
|
+
},
|
|
2765
|
+
key
|
|
2766
|
+
)),
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2768
|
+
"button",
|
|
2769
|
+
{
|
|
2770
|
+
onClick: () => S({ ...s, samples: "", tone: "", banned: "", structure: "" }),
|
|
2771
|
+
children: "\u6E05\u7A7A\u98CE\u683C\u8D44\u6599\uFF08\u4FDD\u5B58\u540E\u751F\u6548\uFF09"
|
|
2772
|
+
}
|
|
2773
|
+
),
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u5E73\u53F0\u6A21\u677F" }),
|
|
2775
|
+
data.scope.platform === "wechat" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2776
|
+
Field,
|
|
2777
|
+
{
|
|
2778
|
+
label: "\u516C\u4F17\u53F7\u957F\u5EA6\u76EE\u6807",
|
|
2779
|
+
value: s.wechatLength,
|
|
2780
|
+
onChange: (v) => S({ ...s, wechatLength: v })
|
|
2781
|
+
}
|
|
2782
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2783
|
+
Field,
|
|
2784
|
+
{
|
|
2785
|
+
label: "\u5C0F\u7EA2\u4E66\u53D1\u5E03\u89C4\u5219",
|
|
2786
|
+
value: s.xhsRules,
|
|
2787
|
+
multi: true,
|
|
2788
|
+
onChange: (v) => S({ ...s, xhsRules: v })
|
|
2789
|
+
}
|
|
2790
|
+
),
|
|
2791
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2792
|
+
Field,
|
|
2793
|
+
{
|
|
2794
|
+
label: "\u89C4\u5219\u4EBA\u5DE5\u6838\u9A8C\u65E5\u671F",
|
|
2795
|
+
value: s.rulesVerifiedAt,
|
|
2796
|
+
onChange: (v) => S({ ...s, rulesVerifiedAt: v })
|
|
2797
|
+
}
|
|
2798
|
+
),
|
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2800
|
+
"button",
|
|
2801
|
+
{
|
|
2802
|
+
className: "primary",
|
|
2803
|
+
onClick: () => run(async () => {
|
|
2804
|
+
await api("settings.save", s);
|
|
2805
|
+
setSaved(platformName2 + "\u957F\u671F\u504F\u597D\u4E0E\u914D\u7F6E\u5DF2\u4FDD\u5B58");
|
|
2806
|
+
}),
|
|
2807
|
+
children: "\u4FDD\u5B58\u957F\u671F\u504F\u597D\u4E0E\u914D\u7F6E"
|
|
2808
|
+
}
|
|
2809
|
+
)
|
|
2810
|
+
] }),
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "panel", children: [
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u5BBF\u4E3B\u6A21\u578B\u4E0E\u80FD\u529B" }),
|
|
2813
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5DF2\u53D1\u73B0\u7684\u5BBF\u4E3B\u6A21\u578B" }),
|
|
2815
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2816
|
+
"select",
|
|
2817
|
+
{
|
|
2818
|
+
value: s.provider + "|" + s.model,
|
|
2819
|
+
onChange: (e) => {
|
|
2820
|
+
const [provider, model] = e.target.value.split("|");
|
|
2821
|
+
S({ ...s, provider, model });
|
|
2822
|
+
},
|
|
2823
|
+
children: [
|
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: s.provider + "|" + s.model, children: [
|
|
2825
|
+
s.provider,
|
|
2826
|
+
" / ",
|
|
2827
|
+
s.model
|
|
2828
|
+
] }),
|
|
2829
|
+
caps?.models.filter((m) => m.provider !== s.provider || m.id !== s.model).map((m) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2830
|
+
"option",
|
|
2831
|
+
{
|
|
2832
|
+
value: m.provider + "|" + m.id,
|
|
2833
|
+
children: [
|
|
2834
|
+
m.name,
|
|
2835
|
+
" \xB7 ",
|
|
2836
|
+
m.provider,
|
|
2837
|
+
" ",
|
|
2838
|
+
m.inputModalities?.includes("image") ? "\uFF08\u652F\u6301\u56FE\u7247\uFF09" : ""
|
|
2839
|
+
]
|
|
2840
|
+
},
|
|
2841
|
+
m.provider + m.id
|
|
2842
|
+
))
|
|
2843
|
+
]
|
|
2844
|
+
}
|
|
2845
|
+
)
|
|
2846
|
+
] }),
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2848
|
+
Field,
|
|
2849
|
+
{
|
|
2850
|
+
label: "Provider \u8DEF\u7531",
|
|
2851
|
+
value: s.provider,
|
|
2852
|
+
onChange: (v) => S({ ...s, provider: v })
|
|
2853
|
+
}
|
|
2854
|
+
),
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2856
|
+
Field,
|
|
2857
|
+
{
|
|
2858
|
+
label: "\u6A21\u578B ID",
|
|
2859
|
+
value: s.model,
|
|
2860
|
+
onChange: (v) => S({ ...s, model: v })
|
|
2861
|
+
}
|
|
2862
|
+
),
|
|
2863
|
+
caps && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dl", { children: ["text", "search", "ocr", "imageGeneration"].map(
|
|
2864
|
+
(k, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react3.default.Fragment, { children: [
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: [
|
|
2866
|
+
"\u6587\u5B57\u751F\u6210",
|
|
2867
|
+
"\u641C\u7D22 / \u7F51\u9875",
|
|
2868
|
+
"OCR / \u56FE\u7247\u7406\u89E3",
|
|
2869
|
+
"\u56FE\u7247\u751F\u6210"
|
|
2870
|
+
][i] }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: caps[k] })
|
|
2872
|
+
] }, k)
|
|
2873
|
+
) }),
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u9884\u7B97\u4E0E\u9650\u5236" }),
|
|
2875
|
+
["maxTokens", "maxInputChars", "maxDailyCalls"].map(
|
|
2876
|
+
(key, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2877
|
+
Field,
|
|
2878
|
+
{
|
|
2879
|
+
label: [
|
|
2880
|
+
"\u5355\u6B21\u6700\u5927\u8F93\u51FA token",
|
|
2881
|
+
"\u6BCF\u6B65\u6750\u6599\u8F93\u5165\u5B57\u7B26\u9884\u7B97",
|
|
2882
|
+
"\u6BCF\u65E5\u6700\u591A\u6A21\u578B\u4EFB\u52A1\u6570"
|
|
2883
|
+
][i],
|
|
2884
|
+
value: String(s[key]),
|
|
2885
|
+
type: "number",
|
|
2886
|
+
onChange: (v) => S({ ...s, [key]: Number(v) })
|
|
2887
|
+
},
|
|
2888
|
+
key
|
|
2889
|
+
)
|
|
2890
|
+
),
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u6700\u591A\u4E24\u4E2A\u5E76\u884C\u4EFB\u52A1\uFF1B\u5355\u6B21\u8D85\u65F6\u4E94\u5206\u949F\uFF0C\u4E0D\u81EA\u52A8\u91CD\u8BD5\u3002\u4EFB\u52A1\u4E2D\u663E\u793A\u5BBF\u4E3B\u5B9E\u9645 token\uFF0C\u7528\u91CF\u7F3A\u5931\u65F6\u4E0D\u4F30\u9020\u8D39\u7528\u3002" }),
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: "\u6570\u636E\u7BA1\u7406" }),
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u5F53\u524D\u8D26\u53F7\u548C\u5E73\u53F0\u5206\u522B\u4FDD\u5B58\u4EE5\u4E0B\u6570\u636E\uFF0C\u5207\u6362\u5DE5\u4F5C\u533A\u540E\u4E92\u4E0D\u53EF\u89C1\uFF1A" }),
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("ul", { className: "data-inventory", children: [
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
2896
|
+
"\u7D20\u6750\u3001\u539F\u59CB\u6587\u4EF6\u3001\u56FE\u7247\u4E0E OCR\uFF1A",
|
|
2897
|
+
data.materials.length,
|
|
2898
|
+
" \u4EFD\uFF08\u542B\u56DE\u6536\u7AD9\uFF09"
|
|
2899
|
+
] }),
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
2901
|
+
"\u9009\u9898\u4E0E\u6536\u85CF\uFF1A",
|
|
2902
|
+
data.topics.length,
|
|
2903
|
+
" \u6761"
|
|
2904
|
+
] }),
|
|
2905
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
2906
|
+
"\u9879\u76EE\u3001\u7B80\u62A5\u3001\u63D0\u7EB2\u3001\u4E8B\u5B9E\u3001\u914D\u56FE\u53CA\u53D1\u5E03\u590D\u76D8\uFF1A",
|
|
2907
|
+
data.projects.length,
|
|
2908
|
+
" \u4E2A"
|
|
2909
|
+
] }),
|
|
2910
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
2911
|
+
"\u7A3F\u4EF6\u3001\u5386\u53F2\u7248\u672C\u4E0E\u5019\u9009\u4FEE\u6539\uFF1A",
|
|
2912
|
+
data.inventory.version || 0,
|
|
2913
|
+
" \u4E2A\u7248\u672C"
|
|
2914
|
+
] }),
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
2916
|
+
"AI \u4EFB\u52A1\u3001\u8F93\u5165\u3001\u5BF9\u8BDD\u3001\u8F93\u51FA\u53CA\u7528\u91CF\uFF1A",
|
|
2917
|
+
data.tasks.length,
|
|
2918
|
+
" \u6761"
|
|
2919
|
+
] }),
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
2921
|
+
"\u5BFC\u51FA\u6587\u4EF6\u4E0E\u5907\u4EFD\u6062\u590D\u8BB0\u5F55\uFF1A",
|
|
2922
|
+
data.exports.length,
|
|
2923
|
+
" \u4E2A\u5BFC\u51FA\u3001",
|
|
2924
|
+
data.inventory.restore || 0,
|
|
2925
|
+
" \u6B21\u6062\u590D"
|
|
2926
|
+
] }),
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: "\u5E73\u53F0\u98CE\u683C\u3001\u6837\u6587\u3001\u89C4\u5219\u3001\u6A21\u578B\u9009\u62E9\u4E0E\u8C03\u7528\u9884\u7B97" })
|
|
2928
|
+
] }),
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { children: caps?.dataDir || "\u6B63\u5728\u8BFB\u53D6\u76EE\u5F55\u2026" }),
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u5DE5\u4F5C\u76EE\u5F55\u901A\u8FC7\u63D2\u4EF6\u914D\u7F6E dataDir \u8BBE\u7F6E\u3002\u505C\u6B62\u5BBF\u4E3B\u540E\u590D\u5236\u6574\u4E2A\u76EE\u5F55\u518D\u6539\u914D\u7F6E\uFF0C\u907F\u514D\u8FD0\u884C\u65F6\u642C\u8FC1\u9020\u6210\u4E22\u5931\u3002\u5378\u8F7D\u63D2\u4EF6\u4FDD\u7559\u6B64\u76EE\u5F55\u3002" }),
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "field", children: [
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
2933
|
+
"\u6062\u590D\u9879\u76EE ZIP\uFF08\u5BFC\u5165\u5F53\u524D\u8D26\u53F7\u7684",
|
|
2934
|
+
platformName2,
|
|
2935
|
+
"\u5DE5\u4F5C\u533A\uFF09"
|
|
2936
|
+
] }),
|
|
2937
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2938
|
+
"input",
|
|
2939
|
+
{
|
|
2940
|
+
"aria-label": "\u6062\u590D\u9879\u76EE\u5907\u4EFD",
|
|
2941
|
+
type: "file",
|
|
2942
|
+
accept: ".zip",
|
|
2943
|
+
onChange: (e) => {
|
|
2944
|
+
const file = e.target.files?.[0];
|
|
2945
|
+
if (file)
|
|
2946
|
+
run(async () => {
|
|
2947
|
+
if (file.size > 100 * 1024 * 1024)
|
|
2948
|
+
throw Error("\u5907\u4EFD\u8D85\u8FC7 100 MB");
|
|
2949
|
+
await api("backup.restore", { base64: await base64(file) });
|
|
2950
|
+
});
|
|
2951
|
+
e.target.value = "";
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
)
|
|
2955
|
+
] }),
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "muted", children: "\u9879\u76EE\u9875\u5BFC\u51FA ZIP \u5373\u53EF\u5907\u4EFD\u3002\u4F5C\u8005\u504F\u597D\u4E0D\u968F\u9879\u76EE\u5907\u4EFD\u5BFC\u51FA\uFF1B\u5B8C\u6574\u5907\u4EFD\u9700\u505C\u673A\u590D\u5236\u6574\u4E2A\u6570\u636E\u76EE\u5F55\u3002" })
|
|
2957
|
+
] })
|
|
2958
|
+
] })
|
|
2959
|
+
] });
|
|
2960
|
+
}
|
|
2961
|
+
var inject = ["slots"];
|
|
2962
|
+
function apply(ctx) {
|
|
2963
|
+
ctx.slots.inject(
|
|
2964
|
+
"main",
|
|
2965
|
+
() => ctx.slots.register({ name: "main", key: "content-studio" }, App)
|
|
2966
|
+
);
|
|
2967
|
+
ctx.slots.inject(
|
|
2968
|
+
"sidebar.panellist",
|
|
2969
|
+
() => ctx.slots.register(
|
|
2970
|
+
{
|
|
2971
|
+
name: "sidebar.panellist",
|
|
2972
|
+
id: "content-studio",
|
|
2973
|
+
label: "\u5185\u5BB9\u5DE5\u4F5C\u53F0",
|
|
2974
|
+
order: 20
|
|
2975
|
+
},
|
|
2976
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2977
|
+
"svg",
|
|
2978
|
+
{
|
|
2979
|
+
width: "20",
|
|
2980
|
+
height: "20",
|
|
2981
|
+
viewBox: "0 0 24 24",
|
|
2982
|
+
fill: "none",
|
|
2983
|
+
stroke: "currentColor",
|
|
2984
|
+
strokeWidth: "1.5",
|
|
2985
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M5 3h11l3 3v15H5zM9 9h6M9 13h6M9 17h4" })
|
|
2986
|
+
}
|
|
2987
|
+
)
|
|
2988
|
+
)
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
return module.exports;}});
|