@dsh-agentic-roleplay/core 0.3.4 → 0.3.6
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/lib/authoring.js +5 -3
- package/lib/client.js +3260 -493
- package/lib/client.js.map +1 -1
- package/lib/{deliver-CpZOxBX5.js → deliver-BBgciEEK.js} +3 -2
- package/lib/doctor.js +3 -3
- package/lib/{gallery-CtFDL22W.js → gallery-DIEgETzU.js} +2 -2
- package/lib/generator-DJ48HxPI.js +145 -0
- package/lib/{hooks-KTCR3fNJ.js → hooks-DkwFGtNH.js} +3 -3
- package/lib/images.js +4 -3
- package/lib/index.js +889 -52
- package/lib/language-BgyxtB2h.js +38 -0
- package/lib/{generator-B6FxlKOV.js → library-9JB9zw5a.js} +2 -143
- package/lib/{language-DWVwi1R7.js → load-CVwJjIJ5.js} +11 -45
- package/lib/lorebook-author-tools-Bj31z1cu.js +619 -0
- package/lib/lorebook-authoring.js +67 -0
- package/lib/orchestration.js +22 -14
- package/lib/pack-jail-2XztyYAX.js +1980 -0
- package/lib/{packs-BYjrAen6.js → packs-xHRCcGdb.js} +3 -29
- package/lib/{presenter-agent-CiEVKcjJ.js → presenter-agent-DnNEG_Mn.js} +4 -3
- package/lib/preset-D0FMSeZ9.js +59 -0
- package/lib/preset-author-tools-BxycmoAr.js +276 -0
- package/lib/preset-authoring.js +53 -0
- package/lib/presets-gkBWAiVb.js +374 -0
- package/lib/{reflection-waxFg1x-.js → reflection-q0UpwXlx.js} +130 -8
- package/lib/{pack-jail-CybSNzxr.js → tools-Dy1fgP6B.js} +454 -2303
- package/package.json +4 -2
- package/prompts/en/import/lorebook.md +7 -0
- package/prompts/en/lorebook/persona.md +1 -0
- package/prompts/en/lorebook/procedure.md +1 -0
- package/prompts/en/lorebook/welcome.md +1 -0
- package/prompts/en/preset/persona.md +1 -0
- package/prompts/en/preset/procedure.md +1 -0
- package/prompts/en/preset/welcome.md +1 -0
- package/prompts/zh/import/lorebook.md +7 -0
- package/prompts/zh/lorebook/persona.md +1 -0
- package/prompts/zh/lorebook/procedure.md +1 -0
- package/prompts/zh/lorebook/welcome.md +1 -0
- package/prompts/zh/preset/persona.md +1 -0
- package/prompts/zh/preset/procedure.md +1 -0
- package/prompts/zh/preset/welcome.md +1 -0
package/lib/client.js
CHANGED
|
@@ -26,19 +26,19 @@ window.__ModuleLoader__.load({
|
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/panel/PageTabs.module.css.mjs
|
|
29
|
-
const css$
|
|
30
|
-
const key$
|
|
31
|
-
let tag$
|
|
32
|
-
if (tag$
|
|
33
|
-
tag$
|
|
34
|
-
tag$
|
|
35
|
-
tag$
|
|
36
|
-
document.head.appendChild(tag$
|
|
37
|
-
}
|
|
38
|
-
tag$
|
|
29
|
+
const css$30 = ".rp_Poldga_tabs{scrollbar-width:none;gap:24px;margin-bottom:-1px;display:flex;overflow-x:auto}.rp_Poldga_tabs::-webkit-scrollbar{display:none}.rp_Poldga_tab{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;background:0 0;border:0;margin:0;padding:8px 0;font-size:13px;line-height:20px;box-shadow:inset 0 -2px #0000}.rp_Poldga_tab:hover{color:var(--dsw-alias-label-primary)}.rp_Poldga_tab[aria-selected=true]{color:var(--dsw-alias-state-business-primary);font-weight:500;box-shadow:inset 0 -2px}.rp_Poldga_tab:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px;border-radius:var(--dsw-radius-xs)}";
|
|
30
|
+
const key$30 = "src/client/panel/PageTabs.module.css";
|
|
31
|
+
let tag$30 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$30) + "]");
|
|
32
|
+
if (tag$30 === null) {
|
|
33
|
+
tag$30 = document.createElement("style");
|
|
34
|
+
tag$30.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
35
|
+
tag$30.dataset.pluginCss = key$30;
|
|
36
|
+
document.head.appendChild(tag$30);
|
|
37
|
+
}
|
|
38
|
+
tag$30.textContent = css$30;
|
|
39
39
|
var PageTabs_module_css_default = {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"tab": "rp_Poldga_tab",
|
|
41
|
+
"tabs": "rp_Poldga_tabs"
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/client/panel/PageTabs.tsx
|
|
@@ -82,21 +82,21 @@ window.__ModuleLoader__.load({
|
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/panel/RoleplayPanel.module.css.mjs
|
|
85
|
-
const css$
|
|
86
|
-
const key$
|
|
87
|
-
let tag$
|
|
88
|
-
if (tag$
|
|
89
|
-
tag$
|
|
90
|
-
tag$
|
|
91
|
-
tag$
|
|
92
|
-
document.head.appendChild(tag$
|
|
93
|
-
}
|
|
94
|
-
tag$
|
|
85
|
+
const css$29 = ".rp_ua5gBa_panel{min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;flex:1 1 0;display:flex}.rp_ua5gBa_header{border-bottom:.5px solid var(--dsw-alias-border-l2);flex:none;padding:12px 24px 0}.rp_ua5gBa_title{margin:0 0 4px;font-size:14px;font-weight:500;line-height:22px}.rp_ua5gBa_body{flex-direction:column;flex:1 1 0;min-height:0;padding:12px 24px 16px;display:flex}@media (width<=640px){.rp_ua5gBa_header,.rp_ua5gBa_body{padding-inline:16px}}";
|
|
86
|
+
const key$29 = "src/client/panel/RoleplayPanel.module.css";
|
|
87
|
+
let tag$29 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$29) + "]");
|
|
88
|
+
if (tag$29 === null) {
|
|
89
|
+
tag$29 = document.createElement("style");
|
|
90
|
+
tag$29.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
91
|
+
tag$29.dataset.pluginCss = key$29;
|
|
92
|
+
document.head.appendChild(tag$29);
|
|
93
|
+
}
|
|
94
|
+
tag$29.textContent = css$29;
|
|
95
95
|
var RoleplayPanel_module_css_default = {
|
|
96
|
-
"
|
|
97
|
-
"title": "rp_ua5gBa_title",
|
|
96
|
+
"header": "rp_ua5gBa_header",
|
|
98
97
|
"body": "rp_ua5gBa_body",
|
|
99
|
-
"
|
|
98
|
+
"panel": "rp_ua5gBa_panel",
|
|
99
|
+
"title": "rp_ua5gBa_title"
|
|
100
100
|
};
|
|
101
101
|
//#endregion
|
|
102
102
|
//#region src/client/panel/RoleplayPanel.tsx
|
|
@@ -143,7 +143,7 @@ window.__ModuleLoader__.load({
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/client/panel/locales.ts
|
|
146
|
-
const dictionaries$
|
|
146
|
+
const dictionaries$18 = {
|
|
147
147
|
en: {
|
|
148
148
|
label: "Role Play",
|
|
149
149
|
heading: "DSH Agentic Role Play",
|
|
@@ -200,11 +200,11 @@ window.__ModuleLoader__.load({
|
|
|
200
200
|
}
|
|
201
201
|
//#endregion
|
|
202
202
|
//#region src/client/panel/index.ts
|
|
203
|
-
const NAMESPACE$
|
|
203
|
+
const NAMESPACE$13 = "roleplay.panel";
|
|
204
204
|
/** Adds the Role Play entry to the sidebar and the main panel it opens. */
|
|
205
205
|
function registerPanel(ctx) {
|
|
206
|
-
const t = ctx.locale.bind(NAMESPACE$
|
|
207
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$
|
|
206
|
+
const t = ctx.locale.bind(NAMESPACE$13);
|
|
207
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$13, dictionaries$18), "roleplay: panel dictionaries");
|
|
208
208
|
const pages = createPagesSource(ctx);
|
|
209
209
|
ctx.effect(() => pages.start(), "roleplay: page list");
|
|
210
210
|
const handle = createPanelStore();
|
|
@@ -216,7 +216,7 @@ window.__ModuleLoader__.load({
|
|
|
216
216
|
ctx.slots.inject("main", () => ctx.slots.register({
|
|
217
217
|
name: "main",
|
|
218
218
|
key: PANEL_ID,
|
|
219
|
-
locale: NAMESPACE$
|
|
219
|
+
locale: NAMESPACE$13,
|
|
220
220
|
store,
|
|
221
221
|
inject: () => ({ hooks: { pages: pages.store } }),
|
|
222
222
|
children: { "roleplay.page": {
|
|
@@ -229,7 +229,7 @@ window.__ModuleLoader__.load({
|
|
|
229
229
|
id: PANEL_ID,
|
|
230
230
|
order: 5,
|
|
231
231
|
label: () => t("label"),
|
|
232
|
-
locale: NAMESPACE$
|
|
232
|
+
locale: NAMESPACE$13
|
|
233
233
|
}, PanelIcon));
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
@@ -311,13 +311,29 @@ window.__ModuleLoader__.load({
|
|
|
311
311
|
body: JSON.stringify(request)
|
|
312
312
|
}));
|
|
313
313
|
}
|
|
314
|
+
async function convertLorebook(request) {
|
|
315
|
+
return await answer$3(await fetch(`${API_PREFIX}/catalogue/convert/lorebook`, {
|
|
316
|
+
method: "POST",
|
|
317
|
+
credentials: "same-origin",
|
|
318
|
+
headers: { "content-type": "application/json" },
|
|
319
|
+
body: JSON.stringify(request)
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
async function convertPreset(request) {
|
|
323
|
+
return await answer$3(await fetch(`${API_PREFIX}/catalogue/convert/preset`, {
|
|
324
|
+
method: "POST",
|
|
325
|
+
credentials: "same-origin",
|
|
326
|
+
headers: { "content-type": "application/json" },
|
|
327
|
+
body: JSON.stringify(request)
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
314
330
|
/** The address a catalogue serves a release's archive from. */
|
|
315
331
|
function downloadUrl(baseUrl, versionId) {
|
|
316
332
|
return `${baseUrl.trim().replace(/\/+$/, "")}/versions/${encodeURIComponent(versionId)}/download`;
|
|
317
333
|
}
|
|
318
334
|
//#endregion
|
|
319
335
|
//#region src/client/pages/catalogue/catalogue-controller.ts
|
|
320
|
-
const messageOf$
|
|
336
|
+
const messageOf$11 = (error) => error instanceof Error ? error.message : String(error);
|
|
321
337
|
/** The configured catalogues as the host sees them, read again whenever the settings change. */
|
|
322
338
|
var CatalogueController = class {
|
|
323
339
|
openChat;
|
|
@@ -358,7 +374,7 @@ window.__ModuleLoader__.load({
|
|
|
358
374
|
} catch (error) {
|
|
359
375
|
if (this.abort.signal.aborted) return;
|
|
360
376
|
this.store.update((draft) => {
|
|
361
|
-
draft.error = messageOf$
|
|
377
|
+
draft.error = messageOf$11(error);
|
|
362
378
|
if (draft.status === "loading") draft.status = "failed";
|
|
363
379
|
});
|
|
364
380
|
}
|
|
@@ -369,49 +385,49 @@ window.__ModuleLoader__.load({
|
|
|
369
385
|
};
|
|
370
386
|
//#endregion
|
|
371
387
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/catalogue/CataloguePage.module.css.mjs
|
|
372
|
-
const css$
|
|
373
|
-
const key$
|
|
374
|
-
let tag$
|
|
375
|
-
if (tag$
|
|
376
|
-
tag$
|
|
377
|
-
tag$
|
|
378
|
-
tag$
|
|
379
|
-
document.head.appendChild(tag$
|
|
388
|
+
const css$28 = ".rp_qK1u-G_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_qK1u-G_toolbar{flex-wrap:wrap;flex:none;align-items:center;gap:8px;min-height:32px;display:flex}.rp_qK1u-G_spacer{flex:auto}.rp_qK1u-G_select,.rp_qK1u-G_search{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);height:32px;font:inherit;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);padding:0 8px;font-size:12px}.rp_qK1u-G_search{min-width:200px}.rp_qK1u-G_select:focus-visible,.rp_qK1u-G_search:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}.rp_qK1u-G_status{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}.rp_qK1u-G_notice{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_qK1u-G_viewport{flex:1 1 0;min-height:0;padding:4px;overflow-y:auto}.rp_qK1u-G_grid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_qK1u-G_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);min-width:0;font:inherit;text-align:left;color:inherit;background:var(--dsw-alias-settings-card-fill);cursor:pointer;flex-direction:column;padding:0;transition:border-color .12s;display:flex;overflow:hidden}.rp_qK1u-G_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_qK1u-G_card:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_qK1u-G_cover{aspect-ratio:4/3;background:var(--dsw-alias-bg-layer-3)}.rp_qK1u-G_image{object-fit:cover;width:100%;height:100%;display:block}.rp_qK1u-G_placeholder{color:#ffffffd9;background:linear-gradient(145deg, hsl(var(--rp-hue) 38% 46%), hsl(calc(var(--rp-hue) + 35) 38% 32%));user-select:none;justify-content:center;align-items:center;width:100%;height:100%;font-size:36px;font-weight:500;display:flex}.rp_qK1u-G_body{flex-direction:column;gap:4px;padding:8px 10px 10px;display:flex}.rp_qK1u-G_name{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;overflow:hidden}.rp_qK1u-G_meta{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_qK1u-G_tags{flex-wrap:wrap;gap:4px;display:flex}.rp_qK1u-G_more{justify-content:center;padding:12px 0;display:flex}.rp_qK1u-G_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 24px;font-size:13px}.rp_qK1u-G_form{flex-direction:column;gap:8px;display:flex}.rp_qK1u-G_field{flex-direction:column;gap:4px;display:flex}.rp_qK1u-G_label{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_qK1u-G_detail{flex-direction:column;gap:8px;font-size:13px;display:flex}.rp_qK1u-G_description{white-space:pre-wrap;max-height:240px;color:var(--dsw-alias-label-secondary);margin:0;overflow-y:auto}.rp_qK1u-G_success{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_qK1u-G_kinds{border-bottom:1px solid var(--dsw-alias-border-l2);flex:none;gap:16px;display:flex}.rp_qK1u-G_kind{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;margin-bottom:-1px;padding:4px 0 6px;font-size:13px}.rp_qK1u-G_kind[aria-selected=true]{border-bottom-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);font-weight:500}.rp_qK1u-G_kind:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.rp_qK1u-G_updates{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;flex:none;align-items:center;gap:4px 8px;margin:0;padding:0;font-size:12px;list-style:none;display:flex}.rp_qK1u-G_update{border:.5px solid var(--dsw-alias-state-business-primary);border-radius:var(--dsw-radius-sm);font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;background:0 0;padding:2px 8px}.rp_qK1u-G_warning{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-secondary);flex-direction:column;gap:8px;padding:8px 12px;font-size:12px;display:flex}.rp_qK1u-G_warning p{margin:0}.rp_qK1u-G_changes{font-family:var(--dsw-font-mono,monospace);color:var(--dsw-alias-label-tertiary);margin:0;padding-left:16px;font-size:11px}.rp_qK1u-G_actions{flex-wrap:wrap;gap:8px;display:flex}";
|
|
389
|
+
const key$28 = "src/client/pages/catalogue/CataloguePage.module.css";
|
|
390
|
+
let tag$28 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$28) + "]");
|
|
391
|
+
if (tag$28 === null) {
|
|
392
|
+
tag$28 = document.createElement("style");
|
|
393
|
+
tag$28.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
394
|
+
tag$28.dataset.pluginCss = key$28;
|
|
395
|
+
document.head.appendChild(tag$28);
|
|
380
396
|
}
|
|
381
|
-
tag$
|
|
397
|
+
tag$28.textContent = css$28;
|
|
382
398
|
var CataloguePage_module_css_default = {
|
|
383
|
-
"
|
|
384
|
-
"message": "rp_qK1u-G_message",
|
|
385
|
-
"actions": "rp_qK1u-G_actions",
|
|
386
|
-
"warning": "rp_qK1u-G_warning",
|
|
387
|
-
"grid": "rp_qK1u-G_grid",
|
|
399
|
+
"placeholder": "rp_qK1u-G_placeholder",
|
|
388
400
|
"toolbar": "rp_qK1u-G_toolbar",
|
|
401
|
+
"meta": "rp_qK1u-G_meta",
|
|
389
402
|
"more": "rp_qK1u-G_more",
|
|
403
|
+
"form": "rp_qK1u-G_form",
|
|
404
|
+
"grid": "rp_qK1u-G_grid",
|
|
390
405
|
"card": "rp_qK1u-G_card",
|
|
391
|
-
"notice": "rp_qK1u-G_notice",
|
|
392
|
-
"update": "rp_qK1u-G_update",
|
|
393
|
-
"viewport": "rp_qK1u-G_viewport",
|
|
394
|
-
"page": "rp_qK1u-G_page",
|
|
395
|
-
"meta": "rp_qK1u-G_meta",
|
|
396
|
-
"detail": "rp_qK1u-G_detail",
|
|
397
|
-
"label": "rp_qK1u-G_label",
|
|
398
406
|
"image": "rp_qK1u-G_image",
|
|
399
|
-
"form": "rp_qK1u-G_form",
|
|
400
407
|
"updates": "rp_qK1u-G_updates",
|
|
401
|
-
"
|
|
408
|
+
"cover": "rp_qK1u-G_cover",
|
|
409
|
+
"warning": "rp_qK1u-G_warning",
|
|
402
410
|
"field": "rp_qK1u-G_field",
|
|
403
|
-
"
|
|
404
|
-
"spacer": "rp_qK1u-G_spacer",
|
|
405
|
-
"status": "rp_qK1u-G_status",
|
|
406
|
-
"changes": "rp_qK1u-G_changes",
|
|
411
|
+
"tags": "rp_qK1u-G_tags",
|
|
407
412
|
"search": "rp_qK1u-G_search",
|
|
408
|
-
"cover": "rp_qK1u-G_cover",
|
|
409
|
-
"name": "rp_qK1u-G_name",
|
|
410
|
-
"placeholder": "rp_qK1u-G_placeholder",
|
|
411
|
-
"select": "rp_qK1u-G_select",
|
|
412
413
|
"body": "rp_qK1u-G_body",
|
|
414
|
+
"name": "rp_qK1u-G_name",
|
|
415
|
+
"description": "rp_qK1u-G_description",
|
|
416
|
+
"kind": "rp_qK1u-G_kind",
|
|
417
|
+
"spacer": "rp_qK1u-G_spacer",
|
|
418
|
+
"kinds": "rp_qK1u-G_kinds",
|
|
413
419
|
"success": "rp_qK1u-G_success",
|
|
414
|
-
"
|
|
420
|
+
"changes": "rp_qK1u-G_changes",
|
|
421
|
+
"label": "rp_qK1u-G_label",
|
|
422
|
+
"viewport": "rp_qK1u-G_viewport",
|
|
423
|
+
"select": "rp_qK1u-G_select",
|
|
424
|
+
"detail": "rp_qK1u-G_detail",
|
|
425
|
+
"status": "rp_qK1u-G_status",
|
|
426
|
+
"update": "rp_qK1u-G_update",
|
|
427
|
+
"page": "rp_qK1u-G_page",
|
|
428
|
+
"actions": "rp_qK1u-G_actions",
|
|
429
|
+
"notice": "rp_qK1u-G_notice",
|
|
430
|
+
"message": "rp_qK1u-G_message"
|
|
415
431
|
};
|
|
416
432
|
//#endregion
|
|
417
433
|
//#region src/client/pages/catalogue/ImportUrlDialog.tsx
|
|
@@ -485,7 +501,7 @@ window.__ModuleLoader__.load({
|
|
|
485
501
|
const date = new Date(iso);
|
|
486
502
|
return Number.isNaN(date.getTime()) ? iso : date.toLocaleDateString();
|
|
487
503
|
};
|
|
488
|
-
const messageOf$
|
|
504
|
+
const messageOf$10 = (problem) => problem instanceof Error ? problem.message : String(problem);
|
|
489
505
|
/** One entry of a catalogue: what it says about itself, its releases, and installing, updating or converting one of them. */
|
|
490
506
|
function WorldDialog({ t, source, id, name, kind, onClose, onChanged, openChat }) {
|
|
491
507
|
const [detail, setDetail] = (0, react.useState)();
|
|
@@ -502,7 +518,7 @@ window.__ModuleLoader__.load({
|
|
|
502
518
|
setDetail(loaded);
|
|
503
519
|
setVersionId(loaded.versions[0]?.id ?? "");
|
|
504
520
|
}, (problem) => {
|
|
505
|
-
if (!abort.signal.aborted) setError(messageOf$
|
|
521
|
+
if (!abort.signal.aborted) setError(messageOf$10(problem));
|
|
506
522
|
});
|
|
507
523
|
return () => {
|
|
508
524
|
abort.abort();
|
|
@@ -539,7 +555,7 @@ window.__ModuleLoader__.load({
|
|
|
539
555
|
}, (problem) => {
|
|
540
556
|
setBusy(void 0);
|
|
541
557
|
if (problem instanceof InstallConflict && problem.reason !== "exists") setConflict(problem);
|
|
542
|
-
else setFailure(t("installFailed", { message: messageOf$
|
|
558
|
+
else setFailure(t("installFailed", { message: messageOf$10(problem) }));
|
|
543
559
|
});
|
|
544
560
|
};
|
|
545
561
|
const runConvert = () => {
|
|
@@ -557,7 +573,7 @@ window.__ModuleLoader__.load({
|
|
|
557
573
|
openChat(result.chatSessionId);
|
|
558
574
|
onClose();
|
|
559
575
|
} catch (problem) {
|
|
560
|
-
setFailure(t("convertFailed", { message: messageOf$
|
|
576
|
+
setFailure(t("convertFailed", { message: messageOf$10(problem) }));
|
|
561
577
|
}
|
|
562
578
|
else setStarted({
|
|
563
579
|
...result,
|
|
@@ -565,11 +581,65 @@ window.__ModuleLoader__.load({
|
|
|
565
581
|
});
|
|
566
582
|
}, (problem) => {
|
|
567
583
|
setBusy(void 0);
|
|
568
|
-
setFailure(t("convertFailed", { message: messageOf$
|
|
584
|
+
setFailure(t("convertFailed", { message: messageOf$10(problem) }));
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
const runPreset = () => {
|
|
588
|
+
if (version === void 0) return;
|
|
589
|
+
setBusy("preset");
|
|
590
|
+
setFailure(void 0);
|
|
591
|
+
convertPreset({
|
|
592
|
+
source: source.name,
|
|
593
|
+
versionId: version.id,
|
|
594
|
+
title: detail?.name ?? name,
|
|
595
|
+
language: t("language")
|
|
596
|
+
}).then((result) => {
|
|
597
|
+
setBusy(void 0);
|
|
598
|
+
try {
|
|
599
|
+
openChat(result.chatSessionId);
|
|
600
|
+
onClose();
|
|
601
|
+
} catch (problem) {
|
|
602
|
+
setFailure(t("importPresetFailed", { message: messageOf$10(problem) }));
|
|
603
|
+
}
|
|
604
|
+
}, (problem) => {
|
|
605
|
+
setBusy(void 0);
|
|
606
|
+
setFailure(t("importPresetFailed", { message: messageOf$10(problem) }));
|
|
607
|
+
});
|
|
608
|
+
};
|
|
609
|
+
const runLorebook = () => {
|
|
610
|
+
if (version === void 0) return;
|
|
611
|
+
setBusy("lorebook");
|
|
612
|
+
setFailure(void 0);
|
|
613
|
+
convertLorebook({
|
|
614
|
+
source: source.name,
|
|
615
|
+
versionId: version.id,
|
|
616
|
+
title: detail?.name ?? name,
|
|
617
|
+
language: t("language")
|
|
618
|
+
}).then((result) => {
|
|
619
|
+
setBusy(void 0);
|
|
620
|
+
try {
|
|
621
|
+
openChat(result.chatSessionId);
|
|
622
|
+
onClose();
|
|
623
|
+
} catch (problem) {
|
|
624
|
+
setFailure(t("importLorebookFailed", { message: messageOf$10(problem) }));
|
|
625
|
+
}
|
|
626
|
+
}, (problem) => {
|
|
627
|
+
setBusy(void 0);
|
|
628
|
+
setFailure(t("importLorebookFailed", { message: messageOf$10(problem) }));
|
|
569
629
|
});
|
|
570
630
|
};
|
|
571
631
|
const idle = busy === void 0 && done === void 0 && started === void 0 && conflict === void 0;
|
|
572
|
-
const primary = kind === "
|
|
632
|
+
const primary = kind === "lorebook" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
633
|
+
variant: "primary",
|
|
634
|
+
disabled: !idle || version === void 0,
|
|
635
|
+
onClick: runLorebook,
|
|
636
|
+
children: busy === "lorebook" ? t("importingLorebook") : t("importLorebookAction")
|
|
637
|
+
}) : kind === "preset" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
638
|
+
variant: "primary",
|
|
639
|
+
disabled: !idle || version === void 0,
|
|
640
|
+
onClick: runPreset,
|
|
641
|
+
children: busy === "preset" ? t("importingPreset") : t("importPresetAction")
|
|
642
|
+
}) : kind === "card" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
573
643
|
variant: "primary",
|
|
574
644
|
disabled: !idle || version === void 0,
|
|
575
645
|
onClick: runConvert,
|
|
@@ -665,6 +735,14 @@ window.__ModuleLoader__.load({
|
|
|
665
735
|
className: CataloguePage_module_css_default.success,
|
|
666
736
|
children: t("convertNote")
|
|
667
737
|
}),
|
|
738
|
+
kind === "preset" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
739
|
+
className: CataloguePage_module_css_default.success,
|
|
740
|
+
children: t("importPresetNote")
|
|
741
|
+
}),
|
|
742
|
+
kind === "lorebook" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
743
|
+
className: CataloguePage_module_css_default.success,
|
|
744
|
+
children: t("importLorebookNote")
|
|
745
|
+
}),
|
|
668
746
|
kind === "card" && detail.converted !== void 0 && detail.converted.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
669
747
|
className: CataloguePage_module_css_default.success,
|
|
670
748
|
children: t("convertedBefore", { names: detail.converted.map((world) => world.name).join(", ") })
|
|
@@ -740,7 +818,7 @@ window.__ModuleLoader__.load({
|
|
|
740
818
|
openChat(started.chatSessionId);
|
|
741
819
|
onClose();
|
|
742
820
|
} catch (problem) {
|
|
743
|
-
setFailure(t("convertFailed", { message: messageOf$
|
|
821
|
+
setFailure(t("convertFailed", { message: messageOf$10(problem) }));
|
|
744
822
|
}
|
|
745
823
|
},
|
|
746
824
|
children: t("openChat")
|
|
@@ -897,7 +975,7 @@ window.__ModuleLoader__.load({
|
|
|
897
975
|
className: CataloguePage_module_css_default.search,
|
|
898
976
|
type: "search",
|
|
899
977
|
value: search,
|
|
900
|
-
placeholder: kind === "card" ? t("searchCardsPlaceholder") : t("searchPlaceholder"),
|
|
978
|
+
placeholder: kind === "card" ? t("searchCardsPlaceholder") : kind === "preset" ? t("searchPresetsPlaceholder") : kind === "lorebook" ? t("searchLorebooksPlaceholder") : t("searchPlaceholder"),
|
|
901
979
|
"aria-label": t("search"),
|
|
902
980
|
disabled: source === void 0,
|
|
903
981
|
onChange: (event) => {
|
|
@@ -946,7 +1024,12 @@ window.__ModuleLoader__.load({
|
|
|
946
1024
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
947
1025
|
className: CataloguePage_module_css_default.kinds,
|
|
948
1026
|
role: "tablist",
|
|
949
|
-
children: [
|
|
1027
|
+
children: [
|
|
1028
|
+
"world",
|
|
1029
|
+
"card",
|
|
1030
|
+
"preset",
|
|
1031
|
+
"lorebook"
|
|
1032
|
+
].map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
950
1033
|
type: "button",
|
|
951
1034
|
role: "tab",
|
|
952
1035
|
className: CataloguePage_module_css_default.kind,
|
|
@@ -956,7 +1039,7 @@ window.__ModuleLoader__.load({
|
|
|
956
1039
|
setKind(entry);
|
|
957
1040
|
setPage(void 0);
|
|
958
1041
|
},
|
|
959
|
-
children: entry === "world" ? t("kindWorlds") : t("kindCards")
|
|
1042
|
+
children: entry === "world" ? t("kindWorlds") : entry === "card" ? t("kindCards") : entry === "preset" ? t("kindPresets") : t("kindLorebooks")
|
|
960
1043
|
}, entry))
|
|
961
1044
|
}),
|
|
962
1045
|
source !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -1035,7 +1118,7 @@ window.__ModuleLoader__.load({
|
|
|
1035
1118
|
children: t("loading")
|
|
1036
1119
|
}) : page.items.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1037
1120
|
className: CataloguePage_module_css_default.message,
|
|
1038
|
-
children: applied === "" ? kind === "card" ? t("emptyCards") : t("empty") : t("emptySearch", { search: applied })
|
|
1121
|
+
children: applied === "" ? kind === "card" ? t("emptyCards") : kind === "preset" ? t("emptyPresets") : kind === "lorebook" ? t("emptyLorebooks") : t("empty") : t("emptySearch", { search: applied })
|
|
1039
1122
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1040
1123
|
className: CataloguePage_module_css_default.grid,
|
|
1041
1124
|
children: page.items.map((world) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
@@ -1127,7 +1210,7 @@ window.__ModuleLoader__.load({
|
|
|
1127
1210
|
}
|
|
1128
1211
|
//#endregion
|
|
1129
1212
|
//#region src/client/pages/catalogue/locales.ts
|
|
1130
|
-
const dictionaries$
|
|
1213
|
+
const dictionaries$17 = {
|
|
1131
1214
|
en: {
|
|
1132
1215
|
nav: "Catalogue",
|
|
1133
1216
|
loading: "Loading worlds…",
|
|
@@ -1176,6 +1259,20 @@ window.__ModuleLoader__.load({
|
|
|
1176
1259
|
kindCards: "Character cards",
|
|
1177
1260
|
searchCardsPlaceholder: "Search character cards",
|
|
1178
1261
|
emptyCards: "This catalogue has no published character cards for you.",
|
|
1262
|
+
kindLorebooks: "Lorebooks",
|
|
1263
|
+
searchLorebooksPlaceholder: "Search SillyTavern lorebooks",
|
|
1264
|
+
emptyLorebooks: "This catalogue has no published lorebooks for you.",
|
|
1265
|
+
importLorebookAction: "Import as a lorebook",
|
|
1266
|
+
importingLorebook: "Importing…",
|
|
1267
|
+
importLorebookNote: "A SillyTavern lorebook is turned into a new lorebook in your library by the authoring assistant: facts become entries known to everyone unless an entry says otherwise, and instructions to the AI are kept aside, to become a preset only if you agree. Importing it again makes another lorebook.",
|
|
1268
|
+
importLorebookFailed: "Could not import the lorebook: {message}",
|
|
1269
|
+
kindPresets: "Presets",
|
|
1270
|
+
searchPresetsPlaceholder: "Search SillyTavern presets",
|
|
1271
|
+
emptyPresets: "This catalogue has no published presets for you.",
|
|
1272
|
+
importPresetAction: "Import as a preset",
|
|
1273
|
+
importingPreset: "Importing…",
|
|
1274
|
+
importPresetNote: "A SillyTavern preset is turned into a new preset in your library by the authoring assistant, which keeps only what is about how to narrate (not rules, formats or scripts). Importing it again makes another preset.",
|
|
1275
|
+
importPresetFailed: "Could not import the preset: {message}",
|
|
1179
1276
|
update: "Update",
|
|
1180
1277
|
updating: "Updating…",
|
|
1181
1278
|
updated: "Updated \"{name}\" to release {version}.",
|
|
@@ -1252,6 +1349,20 @@ window.__ModuleLoader__.load({
|
|
|
1252
1349
|
kindCards: "角色卡",
|
|
1253
1350
|
searchCardsPlaceholder: "搜索角色卡",
|
|
1254
1351
|
emptyCards: "这个目录里没有对你开放的已发布角色卡。",
|
|
1352
|
+
kindLorebooks: "世界书",
|
|
1353
|
+
searchLorebooksPlaceholder: "搜索酒馆世界书",
|
|
1354
|
+
emptyLorebooks: "这个目录里没有对你开放的已发布世界书。",
|
|
1355
|
+
importLorebookAction: "导入为世界书",
|
|
1356
|
+
importingLorebook: "正在导入…",
|
|
1357
|
+
importLorebookNote: "酒馆世界书由创作助手转换为你的库中的一本新世界书:事实会变成人人皆知的条目(除非条目另有说明),给 AI 的指令会被单独保存,只有你同意才会变成预设。再次导入会生成另一本世界书。",
|
|
1358
|
+
importLorebookFailed: "无法导入世界书:{message}",
|
|
1359
|
+
kindPresets: "预设",
|
|
1360
|
+
searchPresetsPlaceholder: "搜索酒馆预设",
|
|
1361
|
+
emptyPresets: "这个目录里没有对你开放的已发布预设。",
|
|
1362
|
+
importPresetAction: "导入为预设",
|
|
1363
|
+
importingPreset: "正在导入…",
|
|
1364
|
+
importPresetNote: "酒馆预设由创作助手转换为你的库中的一个新预设,只保留关于叙述方式的部分(不含规则、格式或脚本)。再次导入会生成另一个预设。",
|
|
1365
|
+
importPresetFailed: "无法导入预设:{message}",
|
|
1255
1366
|
update: "更新",
|
|
1256
1367
|
updating: "更新中…",
|
|
1257
1368
|
updated: "已将“{name}”更新到版本 {version}。",
|
|
@@ -1283,11 +1394,11 @@ window.__ModuleLoader__.load({
|
|
|
1283
1394
|
};
|
|
1284
1395
|
//#endregion
|
|
1285
1396
|
//#region src/client/pages/catalogue/index.ts
|
|
1286
|
-
const NAMESPACE$
|
|
1397
|
+
const NAMESPACE$12 = "roleplay.catalogue";
|
|
1287
1398
|
/** Adds the Catalogue page to the Role Play panel: worlds of the catalogues set up in the settings. */
|
|
1288
1399
|
function registerCataloguePage(ctx) {
|
|
1289
|
-
const t = ctx.locale.bind(NAMESPACE$
|
|
1290
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$
|
|
1400
|
+
const t = ctx.locale.bind(NAMESPACE$12);
|
|
1401
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$12, dictionaries$17), "roleplay: catalogue dictionaries");
|
|
1291
1402
|
const catalogue = new CatalogueController(createChatOpener(ctx));
|
|
1292
1403
|
ctx.effect(() => () => {
|
|
1293
1404
|
catalogue.dispose();
|
|
@@ -1300,7 +1411,7 @@ window.__ModuleLoader__.load({
|
|
|
1300
1411
|
id: "catalogue",
|
|
1301
1412
|
order: 3,
|
|
1302
1413
|
label: () => t("nav"),
|
|
1303
|
-
locale: NAMESPACE$
|
|
1414
|
+
locale: NAMESPACE$12,
|
|
1304
1415
|
inject: () => catalogue.inject()
|
|
1305
1416
|
}, CataloguePage));
|
|
1306
1417
|
}
|
|
@@ -1362,7 +1473,7 @@ window.__ModuleLoader__.load({
|
|
|
1362
1473
|
}
|
|
1363
1474
|
//#endregion
|
|
1364
1475
|
//#region src/client/pages/avatars/avatars-controller.ts
|
|
1365
|
-
const messageOf$
|
|
1476
|
+
const messageOf$9 = (error) => error instanceof Error ? error.message : String(error);
|
|
1366
1477
|
/** Reads the player avatars from the host and makes and removes them. */
|
|
1367
1478
|
var AvatarsController = class {
|
|
1368
1479
|
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
|
|
@@ -1409,7 +1520,7 @@ window.__ModuleLoader__.load({
|
|
|
1409
1520
|
} catch (error) {
|
|
1410
1521
|
if (this.abort.signal.aborted) return;
|
|
1411
1522
|
this.store.update((draft) => {
|
|
1412
|
-
draft.error = messageOf$
|
|
1523
|
+
draft.error = messageOf$9(error);
|
|
1413
1524
|
if (draft.avatars === void 0) draft.status = "failed";
|
|
1414
1525
|
});
|
|
1415
1526
|
} finally {
|
|
@@ -1817,51 +1928,51 @@ window.__ModuleLoader__.load({
|
|
|
1817
1928
|
const isDirty = (character, draft) => Object.keys(editOf$1(character, draft)).length > 0;
|
|
1818
1929
|
//#endregion
|
|
1819
1930
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/CharactersPanel.module.css.mjs
|
|
1820
|
-
const css$
|
|
1821
|
-
const key$
|
|
1822
|
-
let tag$
|
|
1823
|
-
if (tag$
|
|
1824
|
-
tag$
|
|
1825
|
-
tag$
|
|
1826
|
-
tag$
|
|
1827
|
-
document.head.appendChild(tag$
|
|
1931
|
+
const css$27 = ".rp_5ZMIxq_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex}.rp_5ZMIxq_tabs{border-bottom:.5px solid var(--dsw-alias-border-l2);flex:none;gap:4px;padding:0 24px;display:flex;overflow-x:auto}.rp_5ZMIxq_tab{font:inherit;white-space:nowrap;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-bottom:2px solid #0000;flex:none;margin-bottom:-1px;padding:12px 10px 10px;font-size:13px;line-height:20px}.rp_5ZMIxq_tabOn{color:var(--dsw-alias-state-business-primary);border-bottom-color:var(--dsw-alias-state-business-primary);font-weight:500}.rp_5ZMIxq_body{flex:1 1 0;min-height:0;overflow-y:auto}.rp_5ZMIxq_sheet{box-sizing:border-box;flex-direction:column;gap:20px;max-width:760px;padding:24px 24px 240px;display:flex}.rp_5ZMIxq_head{align-items:flex-start;gap:20px;display:flex}.rp_5ZMIxq_portrait{aspect-ratio:3/4;object-fit:cover;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);width:150px;height:auto;display:block}.rp_5ZMIxq_portraitBox{border-radius:var(--dsw-radius-lg);width:150px;height:200px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;flex:0 0 150px;padding:0;display:block;position:relative}.rp_5ZMIxq_portraitBox:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.rp_5ZMIxq_portraitBox:disabled{cursor:not-allowed}.rp_5ZMIxq_portraitAction{box-sizing:border-box;border-radius:0 0 var(--dsw-radius-lg) var(--dsw-radius-lg);color:#fff;text-align:center;opacity:0;background:#0000009e;padding:7px 6px;font-size:12px;line-height:16px;transition:opacity .12s;position:absolute;bottom:1px;left:1px;right:1px}.rp_5ZMIxq_portraitBox:hover .rp_5ZMIxq_portraitAction,.rp_5ZMIxq_portraitBox:focus-visible .rp_5ZMIxq_portraitAction,.rp_5ZMIxq_portraitBox:disabled .rp_5ZMIxq_portraitAction{opacity:1}.rp_5ZMIxq_portraitError,.rp_5ZMIxq_portraitHint{margin:12px 24px 0;font-size:12px}.rp_5ZMIxq_portraitError{color:var(--dsw-alias-state-danger-primary)}.rp_5ZMIxq_portraitHint{color:var(--dsw-alias-label-secondary)}.rp_5ZMIxq_placeholder{box-sizing:border-box;color:var(--dsw-alias-label-secondary);flex-direction:column;justify-content:center;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_initial{opacity:.6;font-size:48px;font-weight:500;line-height:1}.rp_5ZMIxq_missing{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_5ZMIxq_meta{flex-direction:column;flex:1 1 0;gap:10px;min-width:0;display:flex}.rp_5ZMIxq_section{border-top:.5px solid var(--dsw-alias-border-l4);flex-direction:column;gap:6px;padding-top:16px;display:flex}.rp_5ZMIxq_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:500;line-height:20px}.rp_5ZMIxq_empty{color:var(--dsw-alias-label-tertiary);margin:0;padding:0 24px;font-size:13px}.rp_5ZMIxq_section .rp_5ZMIxq_empty{padding:0}.rp_5ZMIxq_tabsSpace{flex:auto}.rp_5ZMIxq_voiceInline{min-width:220px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.rp_5ZMIxq_bar{border-bottom:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-2);flex:none;justify-content:flex-end;align-items:center;gap:8px;padding:6px 24px;display:flex}.rp_5ZMIxq_barText{color:var(--dsw-alias-label-secondary);margin-right:auto;font-size:12px}.rp_5ZMIxq_nameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:var(--dsw-alias-label-primary);font:inherit;padding:4px 8px;font-size:14px;line-height:22px}.rp_5ZMIxq_row{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_5ZMIxq_grid{grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:10px 12px;display:grid}.rp_5ZMIxq_field{flex-direction:column;gap:4px;min-width:0;display:flex}.rp_5ZMIxq_wide{grid-column:1/-1}.rp_5ZMIxq_label,.rp_5ZMIxq_help{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_5ZMIxq_error{color:var(--dsw-alias-state-error-primary);font-size:12px}.rp_5ZMIxq_select{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:inherit;font:inherit;padding:4px 8px;font-size:13px}.rp_5ZMIxq_area{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:96px;color:inherit;font:inherit;resize:vertical;padding:6px 8px;font-size:13px;line-height:20px}.rp_5ZMIxq_goal{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);flex-direction:column;gap:8px;padding:10px;display:flex}.rp_5ZMIxq_row>.rp_5ZMIxq_select{width:auto;min-width:110px}.rp_5ZMIxq_select:focus-visible,.rp_5ZMIxq_area:focus-visible,.rp_5ZMIxq_nameInput:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}@media (width<=640px){.rp_5ZMIxq_sheet{padding-inline:16px}.rp_5ZMIxq_head{flex-direction:column}.rp_5ZMIxq_portraitBox,.rp_5ZMIxq_portrait{width:120px}.rp_5ZMIxq_portraitBox{flex-basis:120px;height:160px}.rp_5ZMIxq_bar{flex-wrap:wrap;padding-inline:16px}.rp_5ZMIxq_voiceInline{width:100%;min-width:0}}";
|
|
1932
|
+
const key$27 = "src/client/world-editor/CharactersPanel.module.css";
|
|
1933
|
+
let tag$27 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$27) + "]");
|
|
1934
|
+
if (tag$27 === null) {
|
|
1935
|
+
tag$27 = document.createElement("style");
|
|
1936
|
+
tag$27.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
1937
|
+
tag$27.dataset.pluginCss = key$27;
|
|
1938
|
+
document.head.appendChild(tag$27);
|
|
1828
1939
|
}
|
|
1829
|
-
tag$
|
|
1940
|
+
tag$27.textContent = css$27;
|
|
1830
1941
|
var CharactersPanel_module_css_default = {
|
|
1831
|
-
"
|
|
1832
|
-
"
|
|
1833
|
-
"
|
|
1834
|
-
"
|
|
1942
|
+
"grid": "rp_5ZMIxq_grid",
|
|
1943
|
+
"missing": "rp_5ZMIxq_missing",
|
|
1944
|
+
"tabOn": "rp_5ZMIxq_tabOn",
|
|
1945
|
+
"tabs": "rp_5ZMIxq_tabs",
|
|
1835
1946
|
"sectionTitle": "rp_5ZMIxq_sectionTitle",
|
|
1947
|
+
"field": "rp_5ZMIxq_field",
|
|
1948
|
+
"tab": "rp_5ZMIxq_tab",
|
|
1836
1949
|
"initial": "rp_5ZMIxq_initial",
|
|
1837
|
-
"
|
|
1838
|
-
"panel": "rp_5ZMIxq_panel",
|
|
1839
|
-
"grid": "rp_5ZMIxq_grid",
|
|
1950
|
+
"help": "rp_5ZMIxq_help",
|
|
1840
1951
|
"body": "rp_5ZMIxq_body",
|
|
1841
|
-
"
|
|
1842
|
-
"nameInput": "rp_5ZMIxq_nameInput",
|
|
1843
|
-
"tab": "rp_5ZMIxq_tab",
|
|
1844
|
-
"section": "rp_5ZMIxq_section",
|
|
1952
|
+
"empty": "rp_5ZMIxq_empty",
|
|
1845
1953
|
"head": "rp_5ZMIxq_head",
|
|
1846
|
-
"
|
|
1847
|
-
"
|
|
1848
|
-
"
|
|
1849
|
-
"
|
|
1850
|
-
"
|
|
1851
|
-
"tabOn": "rp_5ZMIxq_tabOn",
|
|
1852
|
-
"row": "rp_5ZMIxq_row",
|
|
1954
|
+
"sheet": "rp_5ZMIxq_sheet",
|
|
1955
|
+
"barText": "rp_5ZMIxq_barText",
|
|
1956
|
+
"nameInput": "rp_5ZMIxq_nameInput",
|
|
1957
|
+
"portraitError": "rp_5ZMIxq_portraitError",
|
|
1958
|
+
"wide": "rp_5ZMIxq_wide",
|
|
1853
1959
|
"label": "rp_5ZMIxq_label",
|
|
1960
|
+
"section": "rp_5ZMIxq_section",
|
|
1854
1961
|
"select": "rp_5ZMIxq_select",
|
|
1855
|
-
"
|
|
1962
|
+
"portrait": "rp_5ZMIxq_portrait",
|
|
1856
1963
|
"portraitBox": "rp_5ZMIxq_portraitBox",
|
|
1964
|
+
"row": "rp_5ZMIxq_row",
|
|
1965
|
+
"portraitHint": "rp_5ZMIxq_portraitHint",
|
|
1857
1966
|
"meta": "rp_5ZMIxq_meta",
|
|
1858
|
-
"
|
|
1967
|
+
"goal": "rp_5ZMIxq_goal",
|
|
1968
|
+
"portraitAction": "rp_5ZMIxq_portraitAction",
|
|
1859
1969
|
"voiceInline": "rp_5ZMIxq_voiceInline",
|
|
1860
|
-
"
|
|
1861
|
-
"
|
|
1862
|
-
"
|
|
1863
|
-
"
|
|
1864
|
-
"
|
|
1970
|
+
"area": "rp_5ZMIxq_area",
|
|
1971
|
+
"error": "rp_5ZMIxq_error",
|
|
1972
|
+
"tabsSpace": "rp_5ZMIxq_tabsSpace",
|
|
1973
|
+
"bar": "rp_5ZMIxq_bar",
|
|
1974
|
+
"panel": "rp_5ZMIxq_panel",
|
|
1975
|
+
"placeholder": "rp_5ZMIxq_placeholder"
|
|
1865
1976
|
};
|
|
1866
1977
|
//#endregion
|
|
1867
1978
|
//#region src/client/world-editor/EditorTabs.tsx
|
|
@@ -3310,7 +3421,7 @@ window.__ModuleLoader__.load({
|
|
|
3310
3421
|
}
|
|
3311
3422
|
//#endregion
|
|
3312
3423
|
//#region src/client/world-editor/FactionsPanel.tsx
|
|
3313
|
-
const list$
|
|
3424
|
+
const list$2 = (text) => text.split(",").map((value) => value.trim()).filter(Boolean);
|
|
3314
3425
|
function FactionsPanel({ t, world, source, onChanged, actions }) {
|
|
3315
3426
|
const [chosen, setChosen] = (0, react.useState)();
|
|
3316
3427
|
const [drafts, setDrafts] = (0, react.useState)({});
|
|
@@ -3341,10 +3452,10 @@ window.__ModuleLoader__.load({
|
|
|
3341
3452
|
const save = () => {
|
|
3342
3453
|
const edit = {
|
|
3343
3454
|
name: draft.name,
|
|
3344
|
-
aliases: list$
|
|
3455
|
+
aliases: list$2(draft.aliases),
|
|
3345
3456
|
summary: draft.summary,
|
|
3346
3457
|
description: draft.description,
|
|
3347
|
-
values: list$
|
|
3458
|
+
values: list$2(draft.values),
|
|
3348
3459
|
structure: draft.structure,
|
|
3349
3460
|
state: draft.state
|
|
3350
3461
|
};
|
|
@@ -3574,50 +3685,50 @@ window.__ModuleLoader__.load({
|
|
|
3574
3685
|
}
|
|
3575
3686
|
//#endregion
|
|
3576
3687
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/RelationsPanel.module.css.mjs
|
|
3577
|
-
const css$
|
|
3578
|
-
const key$
|
|
3579
|
-
let tag$
|
|
3580
|
-
if (tag$
|
|
3581
|
-
tag$
|
|
3582
|
-
tag$
|
|
3583
|
-
tag$
|
|
3584
|
-
document.head.appendChild(tag$
|
|
3688
|
+
const css$26 = ".rp_7pEHTW_panel{flex-direction:column;flex:1 1 0;min-height:0;display:flex;position:relative}.rp_7pEHTW_toolbar{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:4px;padding:8px 16px;display:flex}.rp_7pEHTW_filter{border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:4px 10px}.rp_7pEHTW_filterOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2)}.rp_7pEHTW_filter:focus-visible,.rp_7pEHTW_edge:focus-visible,.rp_7pEHTW_graphEdge:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:-2px}.rp_7pEHTW_space{flex:1}.rp_7pEHTW_perspective{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.rp_7pEHTW_perspective select{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);max-width:180px;min-height:32px;color:inherit;padding:4px 8px}.rp_7pEHTW_workspace{flex:1 1 0;grid-template-columns:minmax(220px,34%) minmax(320px,1fr);min-height:0;display:grid}.rp_7pEHTW_list{border-right:.5px solid var(--dsw-alias-border-l3);overflow-y:auto}.rp_7pEHTW_edge{border:0;border-bottom:.5px solid var(--dsw-alias-border-l4);width:100%;min-height:48px;color:inherit;text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:8px 16px;display:flex}.rp_7pEHTW_edgeOn{background:var(--dsw-alias-bg-layer-2)}.rp_7pEHTW_edgeTitle{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.rp_7pEHTW_edgeKind{color:var(--dsw-alias-label-tertiary);font-size:11px}.rp_7pEHTW_empty{color:var(--dsw-alias-label-tertiary);padding:20px}.rp_7pEHTW_inspector{min-width:0;padding:24px 24px 240px;overflow-y:auto}.rp_7pEHTW_head h2{margin:0 0 8px;font-size:17px}.rp_7pEHTW_entities{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:6px;display:flex}.rp_7pEHTW_notice{color:var(--dsw-alias-label-secondary);margin:24px 0}.rp_7pEHTW_form{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:24px;display:grid}.rp_7pEHTW_form label{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:5px;font-size:12px;display:flex}.rp_7pEHTW_form select,.rp_7pEHTW_form textarea{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:32px;color:inherit;font:inherit;padding:6px 8px}.rp_7pEHTW_form textarea{resize:vertical;min-height:96px}.rp_7pEHTW_form select:focus-visible,.rp_7pEHTW_form textarea:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}.rp_7pEHTW_wide{grid-column:1/-1}.rp_7pEHTW_metrics{grid-column:1/-1;grid-template-columns:repeat(4,minmax(90px,1fr));gap:10px;display:grid}.rp_7pEHTW_check{align-self:end;align-items:center;min-height:32px;flex-direction:row!important}.rp_7pEHTW_actions{border-top:.5px solid var(--dsw-alias-border-l4);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;margin-top:28px;padding-top:12px;display:flex}.rp_7pEHTW_status{color:var(--dsw-alias-label-secondary);margin-right:auto}.rp_7pEHTW_error{color:var(--dsw-alias-state-error-primary);margin-right:auto}.rp_7pEHTW_graph{background:radial-gradient(circle, var(--dsw-alias-bg-layer-2), transparent 70%);flex:1 1 0;min-height:360px;position:relative;overflow:hidden}.rp_7pEHTW_graph svg{width:100%;height:100%;min-height:520px}.rp_7pEHTW_graphEdge{cursor:pointer;stroke:var(--dsw-alias-border-l1);stroke-width:2px}.rp_7pEHTW_graphEdge:hover,.rp_7pEHTW_graphEdgeOn{stroke:var(--dsw-alias-state-business-primary);stroke-width:4px}.rp_7pEHTW_node circle{fill:var(--dsw-alias-bg-layer-1);stroke:var(--dsw-alias-border-l1);stroke-width:2px}.rp_7pEHTW_node_character circle{fill:color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_location circle{fill:color-mix(in srgb, #4a9 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_item circle{fill:color-mix(in srgb, #c90 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node_faction circle{fill:color-mix(in srgb, #96c 20%, var(--dsw-alias-bg-layer-1))}.rp_7pEHTW_node text{fill:var(--dsw-alias-label-primary);pointer-events:none;font-size:11px}.rp_7pEHTW_graphInspector{box-sizing:border-box;border-radius:var(--dsw-radius-panel);background:var(--dsw-alias-bg-layer-1);width:min(480px,100% - 40px);max-height:62%;box-shadow:var(--dsw-elevation-panel);border:0;padding:18px;position:absolute;bottom:20px;right:20px;overflow-y:auto}@media (width<=760px){.rp_7pEHTW_workspace{grid-template-columns:1fr}.rp_7pEHTW_list{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l3);max-height:220px}.rp_7pEHTW_inspector{padding-inline:16px}.rp_7pEHTW_form{grid-template-columns:1fr}.rp_7pEHTW_wide,.rp_7pEHTW_metrics{grid-column:1}.rp_7pEHTW_metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.rp_7pEHTW_graphInspector{width:calc(100% - 24px);bottom:12px;right:12px}}@media (pointer:coarse){.rp_7pEHTW_filter{min-height:44px}}";
|
|
3689
|
+
const key$26 = "src/client/world-editor/RelationsPanel.module.css";
|
|
3690
|
+
let tag$26 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$26) + "]");
|
|
3691
|
+
if (tag$26 === null) {
|
|
3692
|
+
tag$26 = document.createElement("style");
|
|
3693
|
+
tag$26.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
3694
|
+
tag$26.dataset.pluginCss = key$26;
|
|
3695
|
+
document.head.appendChild(tag$26);
|
|
3585
3696
|
}
|
|
3586
|
-
tag$
|
|
3697
|
+
tag$26.textContent = css$26;
|
|
3587
3698
|
var RelationsPanel_module_css_default = {
|
|
3588
|
-
"
|
|
3589
|
-
"
|
|
3590
|
-
"
|
|
3699
|
+
"node_location": "rp_7pEHTW_node_location",
|
|
3700
|
+
"notice": "rp_7pEHTW_notice",
|
|
3701
|
+
"error": "rp_7pEHTW_error",
|
|
3702
|
+
"form": "rp_7pEHTW_form",
|
|
3703
|
+
"graph": "rp_7pEHTW_graph",
|
|
3704
|
+
"node_character": "rp_7pEHTW_node_character",
|
|
3591
3705
|
"graphInspector": "rp_7pEHTW_graphInspector",
|
|
3592
|
-
"space": "rp_7pEHTW_space",
|
|
3593
|
-
"actions": "rp_7pEHTW_actions",
|
|
3594
|
-
"graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
|
|
3595
|
-
"edgeTitle": "rp_7pEHTW_edgeTitle",
|
|
3596
3706
|
"entities": "rp_7pEHTW_entities",
|
|
3597
|
-
"inspector": "rp_7pEHTW_inspector",
|
|
3598
|
-
"filterOn": "rp_7pEHTW_filterOn",
|
|
3599
|
-
"error": "rp_7pEHTW_error",
|
|
3600
3707
|
"node_item": "rp_7pEHTW_node_item",
|
|
3601
|
-
"
|
|
3602
|
-
"
|
|
3603
|
-
"perspective": "rp_7pEHTW_perspective",
|
|
3604
|
-
"node": "rp_7pEHTW_node",
|
|
3708
|
+
"space": "rp_7pEHTW_space",
|
|
3709
|
+
"toolbar": "rp_7pEHTW_toolbar",
|
|
3605
3710
|
"edgeKind": "rp_7pEHTW_edgeKind",
|
|
3606
|
-
"list": "rp_7pEHTW_list",
|
|
3607
|
-
"empty": "rp_7pEHTW_empty",
|
|
3608
|
-
"form": "rp_7pEHTW_form",
|
|
3609
3711
|
"node_faction": "rp_7pEHTW_node_faction",
|
|
3610
|
-
"
|
|
3712
|
+
"graphEdge": "rp_7pEHTW_graphEdge",
|
|
3713
|
+
"node": "rp_7pEHTW_node",
|
|
3714
|
+
"filterOn": "rp_7pEHTW_filterOn",
|
|
3715
|
+
"inspector": "rp_7pEHTW_inspector",
|
|
3716
|
+
"edge": "rp_7pEHTW_edge",
|
|
3717
|
+
"perspective": "rp_7pEHTW_perspective",
|
|
3718
|
+
"edgeOn": "rp_7pEHTW_edgeOn",
|
|
3719
|
+
"metrics": "rp_7pEHTW_metrics",
|
|
3720
|
+
"actions": "rp_7pEHTW_actions",
|
|
3721
|
+
"wide": "rp_7pEHTW_wide",
|
|
3722
|
+
"graphEdgeOn": "rp_7pEHTW_graphEdgeOn",
|
|
3723
|
+
"list": "rp_7pEHTW_list",
|
|
3611
3724
|
"workspace": "rp_7pEHTW_workspace",
|
|
3612
|
-
"
|
|
3613
|
-
"head": "rp_7pEHTW_head",
|
|
3725
|
+
"edgeTitle": "rp_7pEHTW_edgeTitle",
|
|
3614
3726
|
"status": "rp_7pEHTW_status",
|
|
3615
|
-
"
|
|
3616
|
-
"
|
|
3617
|
-
"
|
|
3618
|
-
"
|
|
3619
|
-
"
|
|
3620
|
-
"panel": "rp_7pEHTW_panel"
|
|
3727
|
+
"panel": "rp_7pEHTW_panel",
|
|
3728
|
+
"head": "rp_7pEHTW_head",
|
|
3729
|
+
"check": "rp_7pEHTW_check",
|
|
3730
|
+
"filter": "rp_7pEHTW_filter",
|
|
3731
|
+
"empty": "rp_7pEHTW_empty"
|
|
3621
3732
|
};
|
|
3622
3733
|
//#endregion
|
|
3623
3734
|
//#region src/client/world-editor/RelationsPanel.tsx
|
|
@@ -4934,23 +5045,23 @@ window.__ModuleLoader__.load({
|
|
|
4934
5045
|
};
|
|
4935
5046
|
//#endregion
|
|
4936
5047
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/pack-frame/PackFrame.module.css.mjs
|
|
4937
|
-
const css$
|
|
4938
|
-
const key$
|
|
4939
|
-
let tag$
|
|
4940
|
-
if (tag$
|
|
4941
|
-
tag$
|
|
4942
|
-
tag$
|
|
4943
|
-
tag$
|
|
4944
|
-
document.head.appendChild(tag$
|
|
5048
|
+
const css$25 = ".rp_h_sbFq_frame{background:0 0;border:0;width:100%;display:block}.rp_h_sbFq_fill{height:100%;min-height:0}.rp_h_sbFq_message{color:var(--dsw-alias-label-secondary);margin:0;padding:16px 24px;font-size:13px;line-height:20px}.rp_h_sbFq_problems{color:var(--dsw-alias-label-tertiary);margin:8px 0 0;padding-left:18px;font-size:12px}.rp_h_sbFq_hud{box-sizing:border-box;width:min(800px,100%);margin:0 auto 8px;padding:0 16px}.rp_h_sbFq_tab{flex-direction:column;flex:1 1 0;width:100%;min-height:0;display:flex}";
|
|
5049
|
+
const key$25 = "src/client/widgets/pack-frame/PackFrame.module.css";
|
|
5050
|
+
let tag$25 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$25) + "]");
|
|
5051
|
+
if (tag$25 === null) {
|
|
5052
|
+
tag$25 = document.createElement("style");
|
|
5053
|
+
tag$25.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
5054
|
+
tag$25.dataset.pluginCss = key$25;
|
|
5055
|
+
document.head.appendChild(tag$25);
|
|
4945
5056
|
}
|
|
4946
|
-
tag$
|
|
5057
|
+
tag$25.textContent = css$25;
|
|
4947
5058
|
var PackFrame_module_css_default = {
|
|
4948
|
-
"frame": "rp_h_sbFq_frame",
|
|
4949
5059
|
"problems": "rp_h_sbFq_problems",
|
|
4950
5060
|
"hud": "rp_h_sbFq_hud",
|
|
5061
|
+
"frame": "rp_h_sbFq_frame",
|
|
5062
|
+
"message": "rp_h_sbFq_message",
|
|
4951
5063
|
"tab": "rp_h_sbFq_tab",
|
|
4952
|
-
"fill": "rp_h_sbFq_fill"
|
|
4953
|
-
"message": "rp_h_sbFq_message"
|
|
5064
|
+
"fill": "rp_h_sbFq_fill"
|
|
4954
5065
|
};
|
|
4955
5066
|
//#endregion
|
|
4956
5067
|
//#region src/client/widgets/pack-frame/theme.ts
|
|
@@ -5202,24 +5313,24 @@ window.__ModuleLoader__.load({
|
|
|
5202
5313
|
const createPack = async (world, pack, name, signal) => (await read$2(await fetch(`${API_PREFIX}/worlds/interface/pack?${packQuery(world, pack)}`, init("POST", signal, { name })))).problems;
|
|
5203
5314
|
//#endregion
|
|
5204
5315
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/PacksPanel.module.css.mjs
|
|
5205
|
-
const css$
|
|
5206
|
-
const key$
|
|
5207
|
-
let tag$
|
|
5208
|
-
if (tag$
|
|
5209
|
-
tag$
|
|
5210
|
-
tag$
|
|
5211
|
-
tag$
|
|
5212
|
-
document.head.appendChild(tag$
|
|
5316
|
+
const css$24 = ".rp_FLaP7q_controls{flex-wrap:wrap;align-items:center;gap:8px 16px;margin:8px 0;display:flex}.rp_FLaP7q_group{color:var(--dsw-alias-label-tertiary);align-items:center;gap:4px;font-size:12px;display:inline-flex}.rp_FLaP7q_stage{border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);max-width:100%;overflow:hidden}.rp_FLaP7q_stageTall{height:420px}.rp_FLaP7q_log{color:var(--dsw-alias-label-secondary);margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_files{columns:2 220px;margin:4px 0 0;padding-left:16px;font-size:12px}.rp_FLaP7q_note{color:var(--dsw-alias-label-tertiary);font-size:12px}";
|
|
5317
|
+
const key$24 = "src/client/world-editor/PacksPanel.module.css";
|
|
5318
|
+
let tag$24 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$24) + "]");
|
|
5319
|
+
if (tag$24 === null) {
|
|
5320
|
+
tag$24 = document.createElement("style");
|
|
5321
|
+
tag$24.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
5322
|
+
tag$24.dataset.pluginCss = key$24;
|
|
5323
|
+
document.head.appendChild(tag$24);
|
|
5213
5324
|
}
|
|
5214
|
-
tag$
|
|
5325
|
+
tag$24.textContent = css$24;
|
|
5215
5326
|
var PacksPanel_module_css_default = {
|
|
5216
|
-
"note": "rp_FLaP7q_note",
|
|
5217
|
-
"stageTall": "rp_FLaP7q_stageTall",
|
|
5218
|
-
"group": "rp_FLaP7q_group",
|
|
5219
|
-
"files": "rp_FLaP7q_files",
|
|
5220
5327
|
"controls": "rp_FLaP7q_controls",
|
|
5328
|
+
"stageTall": "rp_FLaP7q_stageTall",
|
|
5329
|
+
"note": "rp_FLaP7q_note",
|
|
5221
5330
|
"stage": "rp_FLaP7q_stage",
|
|
5222
|
-
"
|
|
5331
|
+
"group": "rp_FLaP7q_group",
|
|
5332
|
+
"log": "rp_FLaP7q_log",
|
|
5333
|
+
"files": "rp_FLaP7q_files"
|
|
5223
5334
|
};
|
|
5224
5335
|
//#endregion
|
|
5225
5336
|
//#region src/client/world-editor/PacksPanel.tsx
|
|
@@ -6115,8 +6226,187 @@ window.__ModuleLoader__.load({
|
|
|
6115
6226
|
});
|
|
6116
6227
|
}
|
|
6117
6228
|
//#endregion
|
|
6229
|
+
//#region src/client/lorebooks-api.ts
|
|
6230
|
+
async function reply$1(response) {
|
|
6231
|
+
if (!response.ok) {
|
|
6232
|
+
const body = await response.json().catch(() => void 0);
|
|
6233
|
+
throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
|
|
6234
|
+
}
|
|
6235
|
+
return await response.json();
|
|
6236
|
+
}
|
|
6237
|
+
const json$1 = (method, body) => ({
|
|
6238
|
+
method,
|
|
6239
|
+
credentials: "same-origin",
|
|
6240
|
+
headers: { "content-type": "application/json" },
|
|
6241
|
+
body: JSON.stringify(body)
|
|
6242
|
+
});
|
|
6243
|
+
const named = (name) => `name=${encodeURIComponent(name)}`;
|
|
6244
|
+
async function listLorebooks(signal) {
|
|
6245
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks`, {
|
|
6246
|
+
credentials: "same-origin",
|
|
6247
|
+
signal
|
|
6248
|
+
}));
|
|
6249
|
+
}
|
|
6250
|
+
async function readLorebook(name, signal) {
|
|
6251
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks/item?${named(name)}`, {
|
|
6252
|
+
credentials: "same-origin",
|
|
6253
|
+
signal
|
|
6254
|
+
}));
|
|
6255
|
+
}
|
|
6256
|
+
async function createLorebook(request, signal) {
|
|
6257
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks`, {
|
|
6258
|
+
...json$1("POST", request),
|
|
6259
|
+
signal
|
|
6260
|
+
}));
|
|
6261
|
+
}
|
|
6262
|
+
async function updateLorebookInfo(name, change, signal) {
|
|
6263
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks/item?${named(name)}`, {
|
|
6264
|
+
...json$1("PUT", change),
|
|
6265
|
+
signal
|
|
6266
|
+
}));
|
|
6267
|
+
}
|
|
6268
|
+
async function writeLorebookEntry(name, entry, signal) {
|
|
6269
|
+
const { id, ...rest } = entry;
|
|
6270
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks/entry?${named(name)}&id=${encodeURIComponent(id)}`, {
|
|
6271
|
+
...json$1("PUT", rest),
|
|
6272
|
+
signal
|
|
6273
|
+
}));
|
|
6274
|
+
}
|
|
6275
|
+
async function removeLorebookEntry(name, id, signal) {
|
|
6276
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks/entry?${named(name)}&id=${encodeURIComponent(id)}`, {
|
|
6277
|
+
method: "DELETE",
|
|
6278
|
+
credentials: "same-origin",
|
|
6279
|
+
signal
|
|
6280
|
+
}));
|
|
6281
|
+
}
|
|
6282
|
+
async function deleteLorebook(name, signal) {
|
|
6283
|
+
const response = await fetch(`${API_PREFIX}/lorebooks/item?${named(name)}`, {
|
|
6284
|
+
method: "DELETE",
|
|
6285
|
+
credentials: "same-origin",
|
|
6286
|
+
signal
|
|
6287
|
+
});
|
|
6288
|
+
if (!response.ok) await reply$1(response);
|
|
6289
|
+
}
|
|
6290
|
+
/** Opens the authoring chat of a lorebook. */
|
|
6291
|
+
async function authorLorebook(name, language, signal) {
|
|
6292
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks/authoring?${named(name)}`, {
|
|
6293
|
+
...json$1("POST", { language }),
|
|
6294
|
+
signal
|
|
6295
|
+
}));
|
|
6296
|
+
}
|
|
6297
|
+
/** Sends a SillyTavern lorebook to a new library lorebook, whose authoring chat turns it into entries. */
|
|
6298
|
+
async function importLorebook(name, file, language, signal) {
|
|
6299
|
+
return await reply$1(await fetch(`${API_PREFIX}/lorebooks/import?${named(name)}&language=${encodeURIComponent(language)}`, {
|
|
6300
|
+
method: "POST",
|
|
6301
|
+
credentials: "same-origin",
|
|
6302
|
+
headers: { "content-type": "application/json" },
|
|
6303
|
+
body: file,
|
|
6304
|
+
signal
|
|
6305
|
+
}));
|
|
6306
|
+
}
|
|
6307
|
+
//#endregion
|
|
6308
|
+
//#region src/client/presets-api.ts
|
|
6309
|
+
async function reply(response) {
|
|
6310
|
+
if (!response.ok) {
|
|
6311
|
+
const body = await response.json().catch(() => void 0);
|
|
6312
|
+
throw new Error(typeof body?.message === "string" ? body.message : `${response.status} ${response.statusText}`.trim());
|
|
6313
|
+
}
|
|
6314
|
+
return await response.json();
|
|
6315
|
+
}
|
|
6316
|
+
const json = (method, body) => ({
|
|
6317
|
+
method,
|
|
6318
|
+
credentials: "same-origin",
|
|
6319
|
+
headers: { "content-type": "application/json" },
|
|
6320
|
+
body: JSON.stringify(body)
|
|
6321
|
+
});
|
|
6322
|
+
async function listPresets(signal) {
|
|
6323
|
+
return await reply(await fetch(`${API_PREFIX}/presets`, {
|
|
6324
|
+
credentials: "same-origin",
|
|
6325
|
+
signal
|
|
6326
|
+
}));
|
|
6327
|
+
}
|
|
6328
|
+
/** Makes a preset of the prose prompts a world carries. */
|
|
6329
|
+
async function savePresetFromWorld(request, signal) {
|
|
6330
|
+
return await reply(await fetch(`${API_PREFIX}/presets`, {
|
|
6331
|
+
...json("POST", request),
|
|
6332
|
+
signal
|
|
6333
|
+
}));
|
|
6334
|
+
}
|
|
6335
|
+
async function loadPresetStatus(session, signal) {
|
|
6336
|
+
return await reply(await fetch(`${API_PREFIX}/sessions/preset?id=${encodeURIComponent(session)}`, {
|
|
6337
|
+
credentials: "same-origin",
|
|
6338
|
+
signal
|
|
6339
|
+
}));
|
|
6340
|
+
}
|
|
6341
|
+
/** Puts a preset into the chat's story, or takes its preset out when no name is given. */
|
|
6342
|
+
async function applyPreset(session, name, signal) {
|
|
6343
|
+
return await reply(await fetch(`${API_PREFIX}/sessions/preset?id=${encodeURIComponent(session)}`, {
|
|
6344
|
+
...json("POST", name === void 0 ? {} : { name }),
|
|
6345
|
+
signal
|
|
6346
|
+
}));
|
|
6347
|
+
}
|
|
6348
|
+
const empty = async (response) => {
|
|
6349
|
+
if (!response.ok) await reply(response);
|
|
6350
|
+
};
|
|
6351
|
+
async function readPreset(name, signal) {
|
|
6352
|
+
return await reply(await fetch(`${API_PREFIX}/presets/item?name=${encodeURIComponent(name)}`, {
|
|
6353
|
+
credentials: "same-origin",
|
|
6354
|
+
signal
|
|
6355
|
+
}));
|
|
6356
|
+
}
|
|
6357
|
+
/** Makes a preset holding the shipped prose prompts, as a starting point to edit. */
|
|
6358
|
+
async function createPreset(request, signal) {
|
|
6359
|
+
return await reply(await fetch(`${API_PREFIX}/presets`, {
|
|
6360
|
+
...json("POST", request),
|
|
6361
|
+
signal
|
|
6362
|
+
}));
|
|
6363
|
+
}
|
|
6364
|
+
async function updatePresetInfo(name, change, signal) {
|
|
6365
|
+
return await reply(await fetch(`${API_PREFIX}/presets/item?name=${encodeURIComponent(name)}`, {
|
|
6366
|
+
...json("PUT", change),
|
|
6367
|
+
signal
|
|
6368
|
+
}));
|
|
6369
|
+
}
|
|
6370
|
+
async function writePresetPrompt(name, language, id, text, signal) {
|
|
6371
|
+
return await reply(await fetch(`${API_PREFIX}/presets/prompt?name=${encodeURIComponent(name)}&language=${encodeURIComponent(language)}&id=${encodeURIComponent(id)}`, {
|
|
6372
|
+
...json("PUT", { text }),
|
|
6373
|
+
signal
|
|
6374
|
+
}));
|
|
6375
|
+
}
|
|
6376
|
+
async function removePresetPrompt(name, language, id, signal) {
|
|
6377
|
+
return await reply(await fetch(`${API_PREFIX}/presets/prompt?name=${encodeURIComponent(name)}&language=${encodeURIComponent(language)}&id=${encodeURIComponent(id)}`, {
|
|
6378
|
+
method: "DELETE",
|
|
6379
|
+
credentials: "same-origin",
|
|
6380
|
+
signal
|
|
6381
|
+
}));
|
|
6382
|
+
}
|
|
6383
|
+
async function deletePreset(name, signal) {
|
|
6384
|
+
await empty(await fetch(`${API_PREFIX}/presets/item?name=${encodeURIComponent(name)}`, {
|
|
6385
|
+
method: "DELETE",
|
|
6386
|
+
credentials: "same-origin",
|
|
6387
|
+
signal
|
|
6388
|
+
}));
|
|
6389
|
+
}
|
|
6390
|
+
/** Opens the authoring chat of a preset. */
|
|
6391
|
+
async function authorPreset(name, language, signal) {
|
|
6392
|
+
return await reply(await fetch(`${API_PREFIX}/presets/authoring?name=${encodeURIComponent(name)}`, {
|
|
6393
|
+
...json("POST", { language }),
|
|
6394
|
+
signal
|
|
6395
|
+
}));
|
|
6396
|
+
}
|
|
6397
|
+
/** Sends a SillyTavern preset to a new library preset, whose authoring chat turns it into prompts. */
|
|
6398
|
+
async function importPreset(name, file, language, signal) {
|
|
6399
|
+
return await reply(await fetch(`${API_PREFIX}/presets/import?name=${encodeURIComponent(name)}&language=${encodeURIComponent(language)}`, {
|
|
6400
|
+
method: "POST",
|
|
6401
|
+
credentials: "same-origin",
|
|
6402
|
+
headers: { "content-type": "application/json" },
|
|
6403
|
+
body: file,
|
|
6404
|
+
signal
|
|
6405
|
+
}));
|
|
6406
|
+
}
|
|
6407
|
+
//#endregion
|
|
6118
6408
|
//#region src/client/world-editor/InfoPanel.tsx
|
|
6119
|
-
const draftOf$
|
|
6409
|
+
const draftOf$4 = (info) => ({
|
|
6120
6410
|
name: info.name,
|
|
6121
6411
|
description: info.description,
|
|
6122
6412
|
tags: info.tags.join(", "),
|
|
@@ -6127,6 +6417,8 @@ window.__ModuleLoader__.load({
|
|
|
6127
6417
|
timeZone: info.timeZone,
|
|
6128
6418
|
startingTime: info.startingTime,
|
|
6129
6419
|
version: info.version,
|
|
6420
|
+
preset: info.preset,
|
|
6421
|
+
lorebooks: info.lorebooks,
|
|
6130
6422
|
alternates: info.alternateOpenings
|
|
6131
6423
|
});
|
|
6132
6424
|
const lines = (value) => value.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
@@ -6142,8 +6434,10 @@ window.__ModuleLoader__.load({
|
|
|
6142
6434
|
"authorUrl",
|
|
6143
6435
|
"timeZone",
|
|
6144
6436
|
"startingTime",
|
|
6145
|
-
"version"
|
|
6437
|
+
"version",
|
|
6438
|
+
"preset"
|
|
6146
6439
|
]) if (draft[key].trim() !== saved[key].trim()) edit[key] = draft[key];
|
|
6440
|
+
if (JSON.stringify(draft.lorebooks) !== JSON.stringify(saved.lorebooks)) edit["lorebooks"] = draft.lorebooks;
|
|
6147
6441
|
if (JSON.stringify(words(draft.tags)) !== JSON.stringify(words(saved.tags))) edit["tags"] = words(draft.tags);
|
|
6148
6442
|
if (JSON.stringify(lines(draft.rules)) !== JSON.stringify(lines(saved.rules))) edit["rules"] = lines(draft.rules);
|
|
6149
6443
|
const cleaned = (list) => list.map((entry) => ({
|
|
@@ -6161,6 +6455,16 @@ window.__ModuleLoader__.load({
|
|
|
6161
6455
|
const [draft, setDraft] = (0, react.useState)();
|
|
6162
6456
|
const [status, setStatus] = (0, react.useState)({ state: "idle" });
|
|
6163
6457
|
const [playable, setPlayable] = (0, react.useState)([]);
|
|
6458
|
+
const [presets, setPresets] = (0, react.useState)([]);
|
|
6459
|
+
const [books, setBooks] = (0, react.useState)([]);
|
|
6460
|
+
(0, react.useEffect)(() => {
|
|
6461
|
+
const abort = new AbortController();
|
|
6462
|
+
listPresets(abort.signal).then(setPresets, () => void 0);
|
|
6463
|
+
listLorebooks(abort.signal).then(setBooks, () => void 0);
|
|
6464
|
+
return () => {
|
|
6465
|
+
abort.abort();
|
|
6466
|
+
};
|
|
6467
|
+
}, []);
|
|
6164
6468
|
(0, react.useEffect)(() => {
|
|
6165
6469
|
const abort = new AbortController();
|
|
6166
6470
|
loadPlayable(worldId, abort.signal).then(setPlayable, () => void 0);
|
|
@@ -6172,8 +6476,8 @@ window.__ModuleLoader__.load({
|
|
|
6172
6476
|
const abort = new AbortController();
|
|
6173
6477
|
loadInfo(worldId, abort.signal).then((value) => {
|
|
6174
6478
|
setInfo(value);
|
|
6175
|
-
setSaved(draftOf$
|
|
6176
|
-
setDraft(draftOf$
|
|
6479
|
+
setSaved(draftOf$4(value));
|
|
6480
|
+
setDraft(draftOf$4(value));
|
|
6177
6481
|
}, (failure) => {
|
|
6178
6482
|
if (!abort.signal.aborted) setStatus({
|
|
6179
6483
|
state: "failed",
|
|
@@ -6191,6 +6495,13 @@ window.__ModuleLoader__.load({
|
|
|
6191
6495
|
});
|
|
6192
6496
|
const edit = changes(saved, draft);
|
|
6193
6497
|
const dirty = Object.keys(edit).length > 0;
|
|
6498
|
+
const setBooksDraft = (lorebooks) => {
|
|
6499
|
+
setDraft({
|
|
6500
|
+
...draft,
|
|
6501
|
+
lorebooks
|
|
6502
|
+
});
|
|
6503
|
+
setStatus({ state: "idle" });
|
|
6504
|
+
};
|
|
6194
6505
|
const set = (key, value) => {
|
|
6195
6506
|
setDraft({
|
|
6196
6507
|
...draft,
|
|
@@ -6209,8 +6520,8 @@ window.__ModuleLoader__.load({
|
|
|
6209
6520
|
setStatus({ state: "saving" });
|
|
6210
6521
|
saveInfo(worldId, edit, new AbortController().signal).then((value) => {
|
|
6211
6522
|
setInfo(value);
|
|
6212
|
-
setSaved(draftOf$
|
|
6213
|
-
setDraft(draftOf$
|
|
6523
|
+
setSaved(draftOf$4(value));
|
|
6524
|
+
setDraft(draftOf$4(value));
|
|
6214
6525
|
setStatus({ state: "saved" });
|
|
6215
6526
|
onSaved();
|
|
6216
6527
|
}, (failure) => {
|
|
@@ -6418,7 +6729,73 @@ window.__ModuleLoader__.load({
|
|
|
6418
6729
|
field("version", "infoVersion", "infoVersionHelp", { placeholder: "1.0" }),
|
|
6419
6730
|
field("authorUrl", "infoAuthorUrl", void 0, { placeholder: "https://" }),
|
|
6420
6731
|
field("timeZone", "infoTimeZone", "infoTimeZoneHelp", { placeholder: "Europe/London" }),
|
|
6421
|
-
field("startingTime", "infoStartingTime", "infoStartingTimeHelp", { placeholder: "1912-04-14T23:40:00" })
|
|
6732
|
+
field("startingTime", "infoStartingTime", "infoStartingTimeHelp", { placeholder: "1912-04-14T23:40:00" }),
|
|
6733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
6734
|
+
className: CharactersPanel_module_css_default.field,
|
|
6735
|
+
children: [
|
|
6736
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6737
|
+
className: CharactersPanel_module_css_default.label,
|
|
6738
|
+
children: t("infoPreset")
|
|
6739
|
+
}),
|
|
6740
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
6741
|
+
className: CharactersPanel_module_css_default.select,
|
|
6742
|
+
value: draft.preset,
|
|
6743
|
+
"data-testid": "roleplay-world-preset",
|
|
6744
|
+
onChange: (event) => {
|
|
6745
|
+
set("preset", event.target.value);
|
|
6746
|
+
},
|
|
6747
|
+
children: [
|
|
6748
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
6749
|
+
value: "",
|
|
6750
|
+
children: t("infoPresetNone")
|
|
6751
|
+
}),
|
|
6752
|
+
presets.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
6753
|
+
value: entry.name,
|
|
6754
|
+
disabled: entry.problems.length > 0,
|
|
6755
|
+
children: entry.title
|
|
6756
|
+
}, entry.name)),
|
|
6757
|
+
draft.preset !== "" && !presets.some((entry) => entry.name === draft.preset) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
6758
|
+
value: draft.preset,
|
|
6759
|
+
children: t("infoPresetMissing", { name: draft.preset })
|
|
6760
|
+
})
|
|
6761
|
+
]
|
|
6762
|
+
}),
|
|
6763
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6764
|
+
className: CharactersPanel_module_css_default.help,
|
|
6765
|
+
children: t("infoPresetHelp")
|
|
6766
|
+
})
|
|
6767
|
+
]
|
|
6768
|
+
}),
|
|
6769
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
6770
|
+
className: CharactersPanel_module_css_default.field,
|
|
6771
|
+
"data-testid": "roleplay-world-lorebooks",
|
|
6772
|
+
children: [
|
|
6773
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
|
|
6774
|
+
className: CharactersPanel_module_css_default.label,
|
|
6775
|
+
children: t("infoLorebooks")
|
|
6776
|
+
}),
|
|
6777
|
+
books.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
|
|
6778
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
6779
|
+
type: "checkbox",
|
|
6780
|
+
checked: draft.lorebooks.includes(entry.name),
|
|
6781
|
+
disabled: entry.problems.length > 0,
|
|
6782
|
+
onChange: (event) => {
|
|
6783
|
+
setBooksDraft(event.target.checked ? [...draft.lorebooks, entry.name] : draft.lorebooks.filter((name) => name !== entry.name));
|
|
6784
|
+
}
|
|
6785
|
+
}),
|
|
6786
|
+
" ",
|
|
6787
|
+
entry.title
|
|
6788
|
+
] }, entry.name)),
|
|
6789
|
+
draft.lorebooks.filter((name) => !books.some((entry) => entry.name === name)).map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6790
|
+
className: CharactersPanel_module_css_default.help,
|
|
6791
|
+
children: t("infoLorebookMissing", { name })
|
|
6792
|
+
}, name)),
|
|
6793
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6794
|
+
className: CharactersPanel_module_css_default.help,
|
|
6795
|
+
children: t("infoLorebooksHelp")
|
|
6796
|
+
})
|
|
6797
|
+
]
|
|
6798
|
+
})
|
|
6422
6799
|
]
|
|
6423
6800
|
})]
|
|
6424
6801
|
})
|
|
@@ -6430,7 +6807,7 @@ window.__ModuleLoader__.load({
|
|
|
6430
6807
|
}
|
|
6431
6808
|
//#endregion
|
|
6432
6809
|
//#region src/client/world-editor/PromptsPanel.tsx
|
|
6433
|
-
const messageOf$
|
|
6810
|
+
const messageOf$8 = (error) => error instanceof Error ? error.message : String(error);
|
|
6434
6811
|
/** The prompts the models are given: the world can carry its own version of each, which replaces the shipped one in the sessions it starts. */
|
|
6435
6812
|
function PromptsPanel({ t, worldId, language, actions }) {
|
|
6436
6813
|
const [tag, setTag] = (0, react.useState)(language);
|
|
@@ -6443,7 +6820,7 @@ window.__ModuleLoader__.load({
|
|
|
6443
6820
|
loadPrompts(worldId, tag, new AbortController().signal).then(setEntries, (failure) => {
|
|
6444
6821
|
setStatus({
|
|
6445
6822
|
state: "failed",
|
|
6446
|
-
message: messageOf$
|
|
6823
|
+
message: messageOf$8(failure)
|
|
6447
6824
|
});
|
|
6448
6825
|
});
|
|
6449
6826
|
}, [worldId, tag]);
|
|
@@ -6463,7 +6840,7 @@ window.__ModuleLoader__.load({
|
|
|
6463
6840
|
}, (failure) => {
|
|
6464
6841
|
if (!abort.signal.aborted) setStatus({
|
|
6465
6842
|
state: "failed",
|
|
6466
|
-
message: messageOf$
|
|
6843
|
+
message: messageOf$8(failure)
|
|
6467
6844
|
});
|
|
6468
6845
|
});
|
|
6469
6846
|
return () => {
|
|
@@ -6474,6 +6851,26 @@ window.__ModuleLoader__.load({
|
|
|
6474
6851
|
tag,
|
|
6475
6852
|
open
|
|
6476
6853
|
]);
|
|
6854
|
+
const [presetName, setPresetName] = (0, react.useState)("");
|
|
6855
|
+
const [made, setMade] = (0, react.useState)();
|
|
6856
|
+
const makePreset = () => {
|
|
6857
|
+
const name = presetName.trim();
|
|
6858
|
+
savePresetFromWorld({
|
|
6859
|
+
name,
|
|
6860
|
+
fromWorld: worldId
|
|
6861
|
+
}, new AbortController().signal).then(() => {
|
|
6862
|
+
setMade({
|
|
6863
|
+
state: "made",
|
|
6864
|
+
message: t("presetMade", { name })
|
|
6865
|
+
});
|
|
6866
|
+
setPresetName("");
|
|
6867
|
+
}, (failure) => {
|
|
6868
|
+
setMade({
|
|
6869
|
+
state: "failed",
|
|
6870
|
+
message: t("presetSaveFailed", { message: messageOf$8(failure) })
|
|
6871
|
+
});
|
|
6872
|
+
});
|
|
6873
|
+
};
|
|
6477
6874
|
const dirty = prompt !== void 0 && draft !== prompt.text;
|
|
6478
6875
|
const write = (action, done) => {
|
|
6479
6876
|
setStatus({ state: "saving" });
|
|
@@ -6484,7 +6881,7 @@ window.__ModuleLoader__.load({
|
|
|
6484
6881
|
}, (failure) => {
|
|
6485
6882
|
setStatus({
|
|
6486
6883
|
state: "failed",
|
|
6487
|
-
message: messageOf$
|
|
6884
|
+
message: messageOf$8(failure)
|
|
6488
6885
|
});
|
|
6489
6886
|
});
|
|
6490
6887
|
};
|
|
@@ -6540,6 +6937,33 @@ window.__ModuleLoader__.load({
|
|
|
6540
6937
|
" ",
|
|
6541
6938
|
entry.carried && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, { children: t("promptCarried") })
|
|
6542
6939
|
] }, entry.id)) }),
|
|
6940
|
+
(entries ?? []).some((entry) => entry.kind === "prose" && entry.carried) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6941
|
+
className: CharactersPanel_module_css_default.row,
|
|
6942
|
+
children: [
|
|
6943
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
6944
|
+
className: CharactersPanel_module_css_default.select,
|
|
6945
|
+
value: presetName,
|
|
6946
|
+
placeholder: t("presetName"),
|
|
6947
|
+
"aria-label": t("presetName"),
|
|
6948
|
+
onChange: (event) => {
|
|
6949
|
+
setPresetName(event.target.value);
|
|
6950
|
+
setMade(void 0);
|
|
6951
|
+
}
|
|
6952
|
+
}),
|
|
6953
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
6954
|
+
variant: "ghost",
|
|
6955
|
+
size: "sm",
|
|
6956
|
+
disabled: presetName.trim() === "",
|
|
6957
|
+
onClick: makePreset,
|
|
6958
|
+
children: t("presetMake")
|
|
6959
|
+
}),
|
|
6960
|
+
made !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6961
|
+
className: made.state === "failed" ? CharactersPanel_module_css_default.error : CharactersPanel_module_css_default.barText,
|
|
6962
|
+
role: made.state === "failed" ? "alert" : "status",
|
|
6963
|
+
children: made.message
|
|
6964
|
+
})
|
|
6965
|
+
]
|
|
6966
|
+
}),
|
|
6543
6967
|
prompt !== void 0 && open !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
6544
6968
|
className: CharactersPanel_module_css_default.section,
|
|
6545
6969
|
children: [
|
|
@@ -6965,7 +7389,7 @@ window.__ModuleLoader__.load({
|
|
|
6965
7389
|
}
|
|
6966
7390
|
//#endregion
|
|
6967
7391
|
//#region src/client/world-editor/CalendarPanel.tsx
|
|
6968
|
-
const draftOf$
|
|
7392
|
+
const draftOf$3 = (calendar) => ({
|
|
6969
7393
|
hemisphere: calendar.hemisphere,
|
|
6970
7394
|
holidays: calendar.holidays.map((holiday) => ({
|
|
6971
7395
|
id: holiday.id,
|
|
@@ -6992,7 +7416,7 @@ window.__ModuleLoader__.load({
|
|
|
6992
7416
|
(0, react.useEffect)(() => {
|
|
6993
7417
|
const abort = new AbortController();
|
|
6994
7418
|
loadCalendar(worldId, abort.signal).then((value) => {
|
|
6995
|
-
const next = draftOf$
|
|
7419
|
+
const next = draftOf$3(value);
|
|
6996
7420
|
setSaved(next);
|
|
6997
7421
|
setDraft(next);
|
|
6998
7422
|
}, (failure) => {
|
|
@@ -7027,7 +7451,7 @@ window.__ModuleLoader__.load({
|
|
|
7027
7451
|
const save = () => {
|
|
7028
7452
|
setStatus({ state: "saving" });
|
|
7029
7453
|
saveCalendar(worldId, documentOf$1(draft), new AbortController().signal).then((value) => {
|
|
7030
|
-
const next = draftOf$
|
|
7454
|
+
const next = draftOf$3(value);
|
|
7031
7455
|
setSaved(next);
|
|
7032
7456
|
setDraft(next);
|
|
7033
7457
|
setStatus({ state: "saved" });
|
|
@@ -7298,28 +7722,28 @@ window.__ModuleLoader__.load({
|
|
|
7298
7722
|
}
|
|
7299
7723
|
//#endregion
|
|
7300
7724
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/tool-switches/ToolSwitches.module.css.mjs
|
|
7301
|
-
const css$
|
|
7302
|
-
const key$
|
|
7303
|
-
let tag$
|
|
7304
|
-
if (tag$
|
|
7305
|
-
tag$
|
|
7306
|
-
tag$
|
|
7307
|
-
tag$
|
|
7308
|
-
document.head.appendChild(tag$
|
|
7725
|
+
const css$23 = ".rp_CjoFLq_root{flex-direction:column;gap:12px;display:flex}.rp_CjoFLq_title{margin:0;font-size:16px;font-weight:500;line-height:24px}.rp_CjoFLq_help{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.rp_CjoFLq_agent{border-top:1px solid var(--dsw-alias-border-l3);flex-direction:column;gap:6px;padding:8px 0;display:flex}.rp_CjoFLq_agentName{font-size:14px;font-weight:500}.rp_CjoFLq_hint{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_CjoFLq_tool{cursor:pointer;align-items:flex-start;gap:8px;font-size:13px;display:flex}.rp_CjoFLq_tool input{margin-top:3px}.rp_CjoFLq_toolText{flex-direction:column;display:flex}.rp_CjoFLq_default{color:var(--dsw-alias-label-tertiary);margin-left:6px;font-size:11px}.rp_CjoFLq_error{color:var(--dsw-alias-state-error-primary,#d33);font-size:12px}.rp_CjoFLq_external{flex-direction:column;gap:6px;margin-top:4px;display:flex}.rp_CjoFLq_external>summary{cursor:pointer}";
|
|
7726
|
+
const key$23 = "src/client/widgets/tool-switches/ToolSwitches.module.css";
|
|
7727
|
+
let tag$23 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$23) + "]");
|
|
7728
|
+
if (tag$23 === null) {
|
|
7729
|
+
tag$23 = document.createElement("style");
|
|
7730
|
+
tag$23.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
7731
|
+
tag$23.dataset.pluginCss = key$23;
|
|
7732
|
+
document.head.appendChild(tag$23);
|
|
7309
7733
|
}
|
|
7310
|
-
tag$
|
|
7734
|
+
tag$23.textContent = css$23;
|
|
7311
7735
|
var ToolSwitches_module_css_default = {
|
|
7312
|
-
"
|
|
7313
|
-
"error": "rp_CjoFLq_error",
|
|
7314
|
-
"toolText": "rp_CjoFLq_toolText",
|
|
7315
|
-
"default": "rp_CjoFLq_default",
|
|
7316
|
-
"agent": "rp_CjoFLq_agent",
|
|
7317
|
-
"root": "rp_CjoFLq_root",
|
|
7736
|
+
"hint": "rp_CjoFLq_hint",
|
|
7318
7737
|
"external": "rp_CjoFLq_external",
|
|
7319
7738
|
"tool": "rp_CjoFLq_tool",
|
|
7739
|
+
"help": "rp_CjoFLq_help",
|
|
7740
|
+
"root": "rp_CjoFLq_root",
|
|
7320
7741
|
"agentName": "rp_CjoFLq_agentName",
|
|
7321
|
-
"
|
|
7322
|
-
"
|
|
7742
|
+
"toolText": "rp_CjoFLq_toolText",
|
|
7743
|
+
"default": "rp_CjoFLq_default",
|
|
7744
|
+
"title": "rp_CjoFLq_title",
|
|
7745
|
+
"error": "rp_CjoFLq_error",
|
|
7746
|
+
"agent": "rp_CjoFLq_agent"
|
|
7323
7747
|
};
|
|
7324
7748
|
//#endregion
|
|
7325
7749
|
//#region src/client/widgets/tool-switches/ToolSwitches.tsx
|
|
@@ -7488,7 +7912,7 @@ window.__ModuleLoader__.load({
|
|
|
7488
7912
|
}
|
|
7489
7913
|
//#endregion
|
|
7490
7914
|
//#region src/client/world-editor/DicePanel.tsx
|
|
7491
|
-
const draftOf$
|
|
7915
|
+
const draftOf$2 = (dice) => dice.checks.map((check) => ({
|
|
7492
7916
|
key: check.key,
|
|
7493
7917
|
name: check.name,
|
|
7494
7918
|
use: check.use,
|
|
@@ -7549,7 +7973,7 @@ window.__ModuleLoader__.load({
|
|
|
7549
7973
|
(0, react.useEffect)(() => {
|
|
7550
7974
|
const abort = new AbortController();
|
|
7551
7975
|
loadDice(worldId, abort.signal).then((value) => {
|
|
7552
|
-
const next = draftOf$
|
|
7976
|
+
const next = draftOf$2(value);
|
|
7553
7977
|
setSaved(next);
|
|
7554
7978
|
setDraft(next);
|
|
7555
7979
|
}, (failure) => {
|
|
@@ -7587,7 +8011,7 @@ window.__ModuleLoader__.load({
|
|
|
7587
8011
|
const save = () => {
|
|
7588
8012
|
setStatus({ state: "saving" });
|
|
7589
8013
|
saveDice(worldId, documentOf(draft), new AbortController().signal).then((value) => {
|
|
7590
|
-
const next = draftOf$
|
|
8014
|
+
const next = draftOf$2(value);
|
|
7591
8015
|
setSaved(next);
|
|
7592
8016
|
setDraft(next);
|
|
7593
8017
|
setStatus({ state: "saved" });
|
|
@@ -7888,7 +8312,7 @@ window.__ModuleLoader__.load({
|
|
|
7888
8312
|
}
|
|
7889
8313
|
//#endregion
|
|
7890
8314
|
//#region src/client/world-editor/variables-draft.ts
|
|
7891
|
-
const list = (value) => value.split(/[,,\n]/).map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
8315
|
+
const list$1 = (value) => value.split(/[,,\n]/).map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
7892
8316
|
const NEW = {
|
|
7893
8317
|
key: "",
|
|
7894
8318
|
name: "",
|
|
@@ -7906,7 +8330,7 @@ window.__ModuleLoader__.load({
|
|
|
7906
8330
|
options: "",
|
|
7907
8331
|
bands: ""
|
|
7908
8332
|
};
|
|
7909
|
-
const draftOf = (value) => ({
|
|
8333
|
+
const draftOf$1 = (value) => ({
|
|
7910
8334
|
key: value.key,
|
|
7911
8335
|
name: value.name,
|
|
7912
8336
|
kind: value.kind,
|
|
@@ -7938,8 +8362,8 @@ window.__ModuleLoader__.load({
|
|
|
7938
8362
|
const [min, max, only, options] = [
|
|
7939
8363
|
number(draft.min),
|
|
7940
8364
|
number(draft.max),
|
|
7941
|
-
list(draft.only),
|
|
7942
|
-
list(draft.options)
|
|
8365
|
+
list$1(draft.only),
|
|
8366
|
+
list$1(draft.options)
|
|
7943
8367
|
];
|
|
7944
8368
|
return {
|
|
7945
8369
|
key: draft.key.trim(),
|
|
@@ -7969,7 +8393,7 @@ window.__ModuleLoader__.load({
|
|
|
7969
8393
|
(0, react.useEffect)(() => {
|
|
7970
8394
|
const abort = new AbortController();
|
|
7971
8395
|
loadVariables(worldId, abort.signal).then((value) => {
|
|
7972
|
-
const drafts = value.map(draftOf);
|
|
8396
|
+
const drafts = value.map(draftOf$1);
|
|
7973
8397
|
setSaved(drafts);
|
|
7974
8398
|
setDraft(drafts);
|
|
7975
8399
|
}, (failure) => {
|
|
@@ -7998,7 +8422,7 @@ window.__ModuleLoader__.load({
|
|
|
7998
8422
|
const save = () => {
|
|
7999
8423
|
setStatus({ state: "saving" });
|
|
8000
8424
|
saveVariables(worldId, draft.map(declarationOf), new AbortController().signal).then((value) => {
|
|
8001
|
-
const drafts = value.map(draftOf);
|
|
8425
|
+
const drafts = value.map(draftOf$1);
|
|
8002
8426
|
setSaved(drafts);
|
|
8003
8427
|
setDraft(drafts);
|
|
8004
8428
|
setStatus({ state: "saved" });
|
|
@@ -8317,52 +8741,52 @@ window.__ModuleLoader__.load({
|
|
|
8317
8741
|
const imageUrl = (target, image) => `${route(target, "/file")}&path=${encodeURIComponent(image.path)}&v=${encodeURIComponent(image.createdAt)}`;
|
|
8318
8742
|
//#endregion
|
|
8319
8743
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/widgets/gallery-view/GalleryView.module.css.mjs
|
|
8320
|
-
const css$
|
|
8321
|
-
const key$
|
|
8322
|
-
let tag$
|
|
8323
|
-
if (tag$
|
|
8324
|
-
tag$
|
|
8325
|
-
tag$
|
|
8326
|
-
tag$
|
|
8327
|
-
document.head.appendChild(tag$
|
|
8744
|
+
const css$22 = ".rp_9pSHmG_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;padding:16px 24px;display:flex;overflow-y:auto}.rp_9pSHmG_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;display:flex}.rp_9pSHmG_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_9pSHmG_actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_9pSHmG_select{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);height:32px;font:inherit;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);padding:0 8px;font-size:12px}.rp_9pSHmG_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 24px;font-size:13px}.rp_9pSHmG_grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_9pSHmG_cell{min-width:0}.rp_9pSHmG_thumb{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);width:100%;font:inherit;text-align:left;color:inherit;cursor:pointer;flex-direction:column;padding:0;display:flex;overflow:hidden}.rp_9pSHmG_open{cursor:zoom-in;background:0 0;border:0;padding:0;display:block}.rp_9pSHmG_thumb:hover{border-color:var(--dsw-alias-border-l4)}.rp_9pSHmG_image{aspect-ratio:1;object-fit:cover;background:var(--dsw-alias-bg-layer-3);width:100%;display:block}.rp_9pSHmG_caption{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary);padding:6px 8px;font-size:12px;overflow:hidden}.rp_9pSHmG_detail{flex-direction:column;gap:12px;width:min(640px,100%);max-height:70vh;display:flex;overflow-y:auto}.rp_9pSHmG_large{border-radius:var(--dsw-radius-lg);object-fit:contain;max-width:100%;max-height:32vh;margin:0 auto;display:block}.rp_9pSHmG_facts{grid-template-columns:max-content 1fr;gap:6px 12px;margin:0;font-size:12px;line-height:18px;display:grid}.rp_9pSHmG_facts dt{color:var(--dsw-alias-label-tertiary)}.rp_9pSHmG_facts dd{min-width:0;color:var(--dsw-alias-label-primary);margin:0}.rp_9pSHmG_pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:160px;overflow-y:auto}.rp_9pSHmG_tags{flex-wrap:wrap;gap:4px;display:flex}.rp_9pSHmG_note{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_9pSHmG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_9pSHmG_status,.rp_9pSHmG_statusError{color:var(--dsw-alias-label-tertiary);padding:0 8px 6px;font-size:11px;line-height:16px}.rp_9pSHmG_statusError{color:var(--dsw-alias-state-error-primary)}.rp_9pSHmG_reusable{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:6px;padding:0 8px 6px;font-size:11px;display:flex}.rp_9pSHmG_reusable input{accent-color:var(--dsw-alias-state-business-primary);margin:0}.rp_9pSHmG_editButton{font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;background:0 0;border:0;align-self:flex-start;margin:0 8px 4px;padding:0;font-size:11px}.rp_9pSHmG_edit{flex-direction:column;gap:12px;width:min(480px,100%);display:flex}.rp_9pSHmG_editField{flex-direction:column;gap:4px;display:flex}.rp_9pSHmG_editLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.rp_9pSHmG_editHelp{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_9pSHmG_editArea,.rp_9pSHmG_editInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);font:inherit;color:var(--dsw-alias-label-primary);padding:6px 8px;font-size:13px}.rp_9pSHmG_editArea{resize:vertical;min-height:96px}.rp_9pSHmG_editArea:focus-visible,.rp_9pSHmG_editInput:focus-visible,.rp_9pSHmG_select:focus-visible{border-color:var(--dsw-alias-state-business-primary);outline:none}@media (width<=640px){.rp_9pSHmG_page{padding-inline:16px}.rp_9pSHmG_toolbar{align-items:flex-start}.rp_9pSHmG_grid{grid-template-columns:repeat(auto-fill,minmax(136px,1fr))}}";
|
|
8745
|
+
const key$22 = "src/client/widgets/gallery-view/GalleryView.module.css";
|
|
8746
|
+
let tag$22 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$22) + "]");
|
|
8747
|
+
if (tag$22 === null) {
|
|
8748
|
+
tag$22 = document.createElement("style");
|
|
8749
|
+
tag$22.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
8750
|
+
tag$22.dataset.pluginCss = key$22;
|
|
8751
|
+
document.head.appendChild(tag$22);
|
|
8328
8752
|
}
|
|
8329
|
-
tag$
|
|
8753
|
+
tag$22.textContent = css$22;
|
|
8330
8754
|
var GalleryView_module_css_default = {
|
|
8331
|
-
"
|
|
8332
|
-
"editLabel": "rp_9pSHmG_editLabel",
|
|
8333
|
-
"toolbar": "rp_9pSHmG_toolbar",
|
|
8334
|
-
"image": "rp_9pSHmG_image",
|
|
8335
|
-
"status": "rp_9pSHmG_status",
|
|
8336
|
-
"cell": "rp_9pSHmG_cell",
|
|
8337
|
-
"count": "rp_9pSHmG_count",
|
|
8338
|
-
"edit": "rp_9pSHmG_edit",
|
|
8339
|
-
"large": "rp_9pSHmG_large",
|
|
8340
|
-
"editField": "rp_9pSHmG_editField",
|
|
8341
|
-
"actions": "rp_9pSHmG_actions",
|
|
8755
|
+
"caption": "rp_9pSHmG_caption",
|
|
8342
8756
|
"reusable": "rp_9pSHmG_reusable",
|
|
8343
|
-
"
|
|
8757
|
+
"facts": "rp_9pSHmG_facts",
|
|
8758
|
+
"status": "rp_9pSHmG_status",
|
|
8344
8759
|
"error": "rp_9pSHmG_error",
|
|
8345
|
-
"
|
|
8760
|
+
"edit": "rp_9pSHmG_edit",
|
|
8761
|
+
"count": "rp_9pSHmG_count",
|
|
8762
|
+
"editLabel": "rp_9pSHmG_editLabel",
|
|
8763
|
+
"editInput": "rp_9pSHmG_editInput",
|
|
8764
|
+
"select": "rp_9pSHmG_select",
|
|
8765
|
+
"large": "rp_9pSHmG_large",
|
|
8766
|
+
"pre": "rp_9pSHmG_pre",
|
|
8346
8767
|
"page": "rp_9pSHmG_page",
|
|
8347
|
-
"
|
|
8348
|
-
"caption": "rp_9pSHmG_caption",
|
|
8768
|
+
"open": "rp_9pSHmG_open",
|
|
8349
8769
|
"message": "rp_9pSHmG_message",
|
|
8350
|
-
"
|
|
8351
|
-
"
|
|
8352
|
-
"
|
|
8353
|
-
"
|
|
8354
|
-
"
|
|
8770
|
+
"editHelp": "rp_9pSHmG_editHelp",
|
|
8771
|
+
"note": "rp_9pSHmG_note",
|
|
8772
|
+
"cell": "rp_9pSHmG_cell",
|
|
8773
|
+
"grid": "rp_9pSHmG_grid",
|
|
8774
|
+
"image": "rp_9pSHmG_image",
|
|
8775
|
+
"toolbar": "rp_9pSHmG_toolbar",
|
|
8355
8776
|
"detail": "rp_9pSHmG_detail",
|
|
8356
|
-
"select": "rp_9pSHmG_select",
|
|
8357
|
-
"editArea": "rp_9pSHmG_editArea",
|
|
8358
8777
|
"statusError": "rp_9pSHmG_statusError",
|
|
8359
|
-
"
|
|
8778
|
+
"editField": "rp_9pSHmG_editField",
|
|
8779
|
+
"thumb": "rp_9pSHmG_thumb",
|
|
8780
|
+
"editArea": "rp_9pSHmG_editArea",
|
|
8781
|
+
"tags": "rp_9pSHmG_tags",
|
|
8782
|
+
"editButton": "rp_9pSHmG_editButton",
|
|
8783
|
+
"actions": "rp_9pSHmG_actions"
|
|
8360
8784
|
};
|
|
8361
8785
|
//#endregion
|
|
8362
8786
|
//#region src/client/widgets/gallery-view/GalleryView.tsx
|
|
8363
8787
|
/** How often the list is read again while pictures are waiting to be described. */
|
|
8364
8788
|
const POLL_MS$2 = 3e3;
|
|
8365
|
-
const messageOf$
|
|
8789
|
+
const messageOf$7 = (error) => error instanceof Error ? error.message : String(error);
|
|
8366
8790
|
function EditDialog({ t, image, onSave, onClose }) {
|
|
8367
8791
|
const [description, setDescription] = (0, react.useState)(image.description ?? "");
|
|
8368
8792
|
const [tags, setTags] = (0, react.useState)(image.tags.join(", "));
|
|
@@ -8376,7 +8800,7 @@ window.__ModuleLoader__.load({
|
|
|
8376
8800
|
tags: tags.split(/[,,]/).map((tag) => tag.trim()).filter((tag) => tag !== "")
|
|
8377
8801
|
}).then(onClose, (failure) => {
|
|
8378
8802
|
setBusy(false);
|
|
8379
|
-
setError(messageOf$
|
|
8803
|
+
setError(messageOf$7(failure));
|
|
8380
8804
|
});
|
|
8381
8805
|
};
|
|
8382
8806
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
@@ -8463,7 +8887,7 @@ window.__ModuleLoader__.load({
|
|
|
8463
8887
|
if (!signal.aborted) {
|
|
8464
8888
|
setLoad({
|
|
8465
8889
|
status: "failed",
|
|
8466
|
-
message: messageOf$
|
|
8890
|
+
message: messageOf$7(failure)
|
|
8467
8891
|
});
|
|
8468
8892
|
setRefreshing(false);
|
|
8469
8893
|
}
|
|
@@ -8510,7 +8934,7 @@ window.__ModuleLoader__.load({
|
|
|
8510
8934
|
} catch (failure) {
|
|
8511
8935
|
setNotice(t("uploadFailed", {
|
|
8512
8936
|
name: file.name,
|
|
8513
|
-
message: messageOf$
|
|
8937
|
+
message: messageOf$7(failure)
|
|
8514
8938
|
}));
|
|
8515
8939
|
}
|
|
8516
8940
|
setUploading(false);
|
|
@@ -8527,7 +8951,7 @@ window.__ModuleLoader__.load({
|
|
|
8527
8951
|
};
|
|
8528
8952
|
const mark = (image, reusable) => {
|
|
8529
8953
|
updateImage(target, image.path, { reusable }, new AbortController().signal).then(replace, (failure) => {
|
|
8530
|
-
setNotice(t("updateFailed", { message: messageOf$
|
|
8954
|
+
setNotice(t("updateFailed", { message: messageOf$7(failure) }));
|
|
8531
8955
|
});
|
|
8532
8956
|
};
|
|
8533
8957
|
const { images, failures } = load.contents;
|
|
@@ -8686,24 +9110,24 @@ window.__ModuleLoader__.load({
|
|
|
8686
9110
|
}
|
|
8687
9111
|
//#endregion
|
|
8688
9112
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/world-editor/WorldEditor.module.css.mjs
|
|
8689
|
-
const css$
|
|
8690
|
-
const key$
|
|
8691
|
-
let tag$
|
|
8692
|
-
if (tag$
|
|
8693
|
-
tag$
|
|
8694
|
-
tag$
|
|
8695
|
-
tag$
|
|
8696
|
-
document.head.appendChild(tag$
|
|
9113
|
+
const css$21 = ".rp__swA3a_view{flex:1 1 0;width:100%;min-height:0;display:flex}.rp__swA3a_message{color:var(--dsw-alias-label-secondary);margin:0;padding:24px;font-size:13px}.rp__swA3a_warning{color:var(--dsw-alias-label-primary);border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-2);margin:0 0 12px;padding:8px 12px;font-size:13px}.rp__swA3a_drawer{box-sizing:border-box;border-right:.5px solid var(--dsw-alias-border-l3);flex-direction:column;flex:0 0 168px;gap:2px;padding:16px 8px;display:flex}.rp__swA3a_drawerItem{border-radius:var(--dsw-radius-md);width:100%;font:inherit;text-align:left;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;padding:6px 12px;font-size:13px;line-height:20px;display:block}@media (width<=720px){.rp__swA3a_view{flex-direction:column}.rp__swA3a_drawer{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l3);flex-direction:row;flex:none;width:100%;padding:8px;overflow-x:auto}.rp__swA3a_drawerItem{white-space:nowrap;flex:none;width:auto}}.rp__swA3a_drawerItem:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.rp__swA3a_drawerItemOn{color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2);font-weight:500}.rp__swA3a_content{flex-direction:column;flex:1 1 0;min-width:0;min-height:0;display:flex}";
|
|
9114
|
+
const key$21 = "src/client/world-editor/WorldEditor.module.css";
|
|
9115
|
+
let tag$21 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$21) + "]");
|
|
9116
|
+
if (tag$21 === null) {
|
|
9117
|
+
tag$21 = document.createElement("style");
|
|
9118
|
+
tag$21.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
9119
|
+
tag$21.dataset.pluginCss = key$21;
|
|
9120
|
+
document.head.appendChild(tag$21);
|
|
8697
9121
|
}
|
|
8698
|
-
tag$
|
|
9122
|
+
tag$21.textContent = css$21;
|
|
8699
9123
|
var WorldEditor_module_css_default = {
|
|
9124
|
+
"content": "rp__swA3a_content",
|
|
9125
|
+
"drawerItemOn": "rp__swA3a_drawerItemOn",
|
|
8700
9126
|
"message": "rp__swA3a_message",
|
|
9127
|
+
"drawer": "rp__swA3a_drawer",
|
|
8701
9128
|
"view": "rp__swA3a_view",
|
|
8702
|
-
"drawerItem": "rp__swA3a_drawerItem",
|
|
8703
9129
|
"warning": "rp__swA3a_warning",
|
|
8704
|
-
"
|
|
8705
|
-
"drawerItemOn": "rp__swA3a_drawerItemOn",
|
|
8706
|
-
"content": "rp__swA3a_content"
|
|
9130
|
+
"drawerItem": "rp__swA3a_drawerItem"
|
|
8707
9131
|
};
|
|
8708
9132
|
//#endregion
|
|
8709
9133
|
//#region src/client/world-editor/WorldEditor.tsx
|
|
@@ -9088,38 +9512,38 @@ window.__ModuleLoader__.load({
|
|
|
9088
9512
|
}
|
|
9089
9513
|
//#endregion
|
|
9090
9514
|
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/avatars/AvatarsPage.module.css.mjs
|
|
9091
|
-
const css$
|
|
9092
|
-
const key$
|
|
9093
|
-
let tag$
|
|
9094
|
-
if (tag$
|
|
9095
|
-
tag$
|
|
9096
|
-
tag$
|
|
9097
|
-
tag$
|
|
9098
|
-
document.head.appendChild(tag$
|
|
9515
|
+
const css$20 = ".rp_pQOzEG_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_pQOzEG_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_pQOzEG_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_pQOzEG_actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_pQOzEG_viewport{flex:1 1 0;min-height:0;padding:4px;overflow-y:auto}.rp_pQOzEG_grid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_pQOzEG_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);align-items:center;gap:4px;min-width:0;padding-right:8px;display:flex}.rp_pQOzEG_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_pQOzEG_open{min-width:0;font:inherit;text-align:left;color:inherit;cursor:pointer;background:0 0;border:0;flex:auto;align-items:center;gap:12px;padding:10px 0 10px 10px;display:flex}.rp_pQOzEG_open:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color);outline-offset:2px}.rp_pQOzEG_portrait,.rp_pQOzEG_placeholder{border-radius:var(--dsw-radius-lg);object-fit:cover;flex:none;width:48px;height:48px}.rp_pQOzEG_placeholder{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;font-size:20px;font-weight:500;display:flex}.rp_pQOzEG_text{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_pQOzEG_name{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;overflow:hidden}.rp_pQOzEG_summary{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.rp_pQOzEG_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_pQOzEG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_pQOzEG_editHeader{border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_pQOzEG_editTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500}.rp_pQOzEG_editBody{flex:1 1 0;min-height:0;display:flex}.rp_pQOzEG_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_pQOzEG_field{flex-direction:column;gap:6px;min-width:0;display:flex}.rp_pQOzEG_label{color:var(--dsw-alias-label-secondary);font-size:12px}@media (width<=640px){.rp_pQOzEG_toolbar{align-items:flex-start}.rp_pQOzEG_count{padding-top:6px}.rp_pQOzEG_grid{grid-template-columns:1fr}.rp_pQOzEG_form{min-width:0}}";
|
|
9516
|
+
const key$20 = "src/client/pages/avatars/AvatarsPage.module.css";
|
|
9517
|
+
let tag$20 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$20) + "]");
|
|
9518
|
+
if (tag$20 === null) {
|
|
9519
|
+
tag$20 = document.createElement("style");
|
|
9520
|
+
tag$20.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
9521
|
+
tag$20.dataset.pluginCss = key$20;
|
|
9522
|
+
document.head.appendChild(tag$20);
|
|
9099
9523
|
}
|
|
9100
|
-
tag$
|
|
9524
|
+
tag$20.textContent = css$20;
|
|
9101
9525
|
var AvatarsPage_module_css_default = {
|
|
9102
|
-
"
|
|
9103
|
-
"
|
|
9104
|
-
"count": "rp_pQOzEG_count",
|
|
9526
|
+
"editHeader": "rp_pQOzEG_editHeader",
|
|
9527
|
+
"name": "rp_pQOzEG_name",
|
|
9105
9528
|
"actions": "rp_pQOzEG_actions",
|
|
9529
|
+
"form": "rp_pQOzEG_form",
|
|
9530
|
+
"open": "rp_pQOzEG_open",
|
|
9531
|
+
"error": "rp_pQOzEG_error",
|
|
9532
|
+
"summary": "rp_pQOzEG_summary",
|
|
9533
|
+
"viewport": "rp_pQOzEG_viewport",
|
|
9534
|
+
"editTitle": "rp_pQOzEG_editTitle",
|
|
9106
9535
|
"card": "rp_pQOzEG_card",
|
|
9107
|
-
"
|
|
9536
|
+
"editBody": "rp_pQOzEG_editBody",
|
|
9537
|
+
"page": "rp_pQOzEG_page",
|
|
9538
|
+
"text": "rp_pQOzEG_text",
|
|
9108
9539
|
"field": "rp_pQOzEG_field",
|
|
9109
|
-
"
|
|
9540
|
+
"portrait": "rp_pQOzEG_portrait",
|
|
9110
9541
|
"message": "rp_pQOzEG_message",
|
|
9111
|
-
"editTitle": "rp_pQOzEG_editTitle",
|
|
9112
|
-
"editBody": "rp_pQOzEG_editBody",
|
|
9113
|
-
"viewport": "rp_pQOzEG_viewport",
|
|
9114
|
-
"form": "rp_pQOzEG_form",
|
|
9115
9542
|
"toolbar": "rp_pQOzEG_toolbar",
|
|
9116
9543
|
"label": "rp_pQOzEG_label",
|
|
9117
|
-
"
|
|
9118
|
-
"error": "rp_pQOzEG_error",
|
|
9119
|
-
"text": "rp_pQOzEG_text",
|
|
9544
|
+
"count": "rp_pQOzEG_count",
|
|
9120
9545
|
"grid": "rp_pQOzEG_grid",
|
|
9121
|
-
"
|
|
9122
|
-
"page": "rp_pQOzEG_page"
|
|
9546
|
+
"placeholder": "rp_pQOzEG_placeholder"
|
|
9123
9547
|
};
|
|
9124
9548
|
//#endregion
|
|
9125
9549
|
//#region src/client/pages/avatars/AvatarsPage.tsx
|
|
@@ -9223,7 +9647,7 @@ window.__ModuleLoader__.load({
|
|
|
9223
9647
|
})
|
|
9224
9648
|
});
|
|
9225
9649
|
}
|
|
9226
|
-
function DeleteDialog({ t, avatar, remove, onClose }) {
|
|
9650
|
+
function DeleteDialog$2({ t, avatar, remove, onClose }) {
|
|
9227
9651
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
9228
9652
|
const [error, setError] = (0, react.useState)();
|
|
9229
9653
|
const confirm = () => {
|
|
@@ -9376,7 +9800,7 @@ window.__ModuleLoader__.load({
|
|
|
9376
9800
|
});
|
|
9377
9801
|
}
|
|
9378
9802
|
}),
|
|
9379
|
-
deleting !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteDialog, {
|
|
9803
|
+
deleting !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteDialog$2, {
|
|
9380
9804
|
t,
|
|
9381
9805
|
avatar: deleting,
|
|
9382
9806
|
remove,
|
|
@@ -9402,7 +9826,7 @@ window.__ModuleLoader__.load({
|
|
|
9402
9826
|
}
|
|
9403
9827
|
//#endregion
|
|
9404
9828
|
//#region src/client/widgets/tool-switches/locales.ts
|
|
9405
|
-
const dictionaries$
|
|
9829
|
+
const dictionaries$16 = {
|
|
9406
9830
|
en: {
|
|
9407
9831
|
sw_title: "Tools",
|
|
9408
9832
|
sw_help: "Which optional tools each kind of agent may use. A choice applies to every agent of that kind, not to one character. Tools this version does not know are left as they are and not shown.",
|
|
@@ -9478,7 +9902,7 @@ window.__ModuleLoader__.load({
|
|
|
9478
9902
|
};
|
|
9479
9903
|
//#endregion
|
|
9480
9904
|
//#region src/client/widgets/gallery-view/locales.ts
|
|
9481
|
-
const dictionaries$
|
|
9905
|
+
const dictionaries$15 = {
|
|
9482
9906
|
en: {
|
|
9483
9907
|
tab: "Gallery",
|
|
9484
9908
|
notRoleplay: "This chat is not a roleplay session, so it has no gallery.",
|
|
@@ -9556,7 +9980,7 @@ window.__ModuleLoader__.load({
|
|
|
9556
9980
|
cancel: "取消"
|
|
9557
9981
|
}
|
|
9558
9982
|
};
|
|
9559
|
-
const dictionaries$
|
|
9983
|
+
const dictionaries$11 = withDictionaries(withDictionaries(withDictionaries(withDictionaries(withDictionaries({
|
|
9560
9984
|
en: {
|
|
9561
9985
|
language: "en",
|
|
9562
9986
|
sectionInfo: "About",
|
|
@@ -9643,6 +10067,13 @@ window.__ModuleLoader__.load({
|
|
|
9643
10067
|
infoAlternateText: "Narration",
|
|
9644
10068
|
infoAlternateAdd: "Add an opening",
|
|
9645
10069
|
infoAlternateRemove: "Remove",
|
|
10070
|
+
infoLorebooks: "Suggested lorebooks",
|
|
10071
|
+
infoLorebooksHelp: "Background knowledge from your library that a new story of this world starts with; the player can change the choice when starting.",
|
|
10072
|
+
infoLorebookMissing: "{name} (not in your library)",
|
|
10073
|
+
infoPreset: "Suggested preset",
|
|
10074
|
+
infoPresetHelp: "The writing instructions from your library that a new story of this world starts with. The world's own prompts still come first, and the player can choose another when starting.",
|
|
10075
|
+
infoPresetNone: "None",
|
|
10076
|
+
infoPresetMissing: "{name} (not in the library)",
|
|
9646
10077
|
infoStory: "Author and time",
|
|
9647
10078
|
infoAuthor: "Author",
|
|
9648
10079
|
infoVersion: "Version",
|
|
@@ -9661,6 +10092,10 @@ window.__ModuleLoader__.load({
|
|
|
9661
10092
|
promptShippedText: "Showing the shipped text; saving makes it this world's own.",
|
|
9662
10093
|
promptRulesWarning: "This prompt holds the rules of the game and how the tools are used. Change it only when you know what the models are told; ${name} marks values the program fills in and must stay.",
|
|
9663
10094
|
promptRevert: "Use the shipped one",
|
|
10095
|
+
presetMake: "Save as preset",
|
|
10096
|
+
presetName: "Preset name",
|
|
10097
|
+
presetMade: "Saved as the preset \"{name}\". It is in the presets folder of your roleplay folder.",
|
|
10098
|
+
presetSaveFailed: "Could not make the preset: {message}",
|
|
9664
10099
|
tab: "World",
|
|
9665
10100
|
noPlayableWarning: "This world has no playable character, so a session cannot be started. Add one, or ask the authoring assistant to.",
|
|
9666
10101
|
editorLoading: "Loading the world…",
|
|
@@ -9924,6 +10359,13 @@ window.__ModuleLoader__.load({
|
|
|
9924
10359
|
infoAlternateText: "叙述",
|
|
9925
10360
|
infoAlternateAdd: "添加开场",
|
|
9926
10361
|
infoAlternateRemove: "移除",
|
|
10362
|
+
infoLorebooks: "建议的世界书",
|
|
10363
|
+
infoLorebooksHelp: "新故事默认带上的、来自你的库中的背景知识;玩家开始时可以更改。",
|
|
10364
|
+
infoLorebookMissing: "{name}(库中没有)",
|
|
10365
|
+
infoPreset: "建议的预设",
|
|
10366
|
+
infoPresetHelp: "新故事默认使用的、来自你的库中的写作指令。世界自带的提示词仍然优先;玩家开始时也可以另选。",
|
|
10367
|
+
infoPresetNone: "无",
|
|
10368
|
+
infoPresetMissing: "{name}(库中没有)",
|
|
9927
10369
|
infoStory: "作者与时间",
|
|
9928
10370
|
infoAuthor: "作者",
|
|
9929
10371
|
infoVersion: "版本",
|
|
@@ -9942,6 +10384,10 @@ window.__ModuleLoader__.load({
|
|
|
9942
10384
|
promptShippedText: "显示的是默认文本;保存后会成为本世界自己的版本。",
|
|
9943
10385
|
promptRulesWarning: "这条提示词包含游戏规则和工具的用法。只有在清楚模型被告知了什么时才修改;${name} 是程序填入的值,必须保留。",
|
|
9944
10386
|
promptRevert: "改用默认版本",
|
|
10387
|
+
presetMake: "保存为预设",
|
|
10388
|
+
presetName: "预设名称",
|
|
10389
|
+
presetMade: "已保存为预设“{name}”,位于角色扮演文件夹的 presets 文件夹中。",
|
|
10390
|
+
presetSaveFailed: "无法创建预设:{message}",
|
|
9945
10391
|
tab: "世界",
|
|
9946
10392
|
noPlayableWarning: "这个世界没有可扮演的角色,因此无法开始会话。请添加一个,或让创作助手添加。",
|
|
9947
10393
|
editorLoading: "正在载入世界…",
|
|
@@ -10119,7 +10565,7 @@ window.__ModuleLoader__.load({
|
|
|
10119
10565
|
relationCancel: "取消",
|
|
10120
10566
|
relationCreate: "创建"
|
|
10121
10567
|
}
|
|
10122
|
-
}, prefixed(dictionaries$
|
|
10568
|
+
}, prefixed(dictionaries$15, "gallery_")), prefixed({
|
|
10123
10569
|
en: {
|
|
10124
10570
|
title: "Triggers",
|
|
10125
10571
|
help: "What the world does by itself when something comes true. They are read from triggers.json; ask the authoring assistant to make or change them, or edit the file.",
|
|
@@ -10353,7 +10799,7 @@ window.__ModuleLoader__.load({
|
|
|
10353
10799
|
logOpen: "请求打开:{surface}",
|
|
10354
10800
|
noSurfaces: "这个界面包没有可预览的界面位置。"
|
|
10355
10801
|
}
|
|
10356
|
-
}, "pk_")), dictionaries$
|
|
10802
|
+
}, "pk_")), dictionaries$16), prefixed({
|
|
10357
10803
|
en: {
|
|
10358
10804
|
help: "How uncertain attempts are settled. The game master rolls one of these checks and is told which band the roll fell in, so no number is ever made up. Each check says when it is used, the dice it rolls and what each result means; the bands together should cover every value the dice can give.",
|
|
10359
10805
|
none: "This world has no checks. Its game master can still roll plain dice for things that have none.",
|
|
@@ -10427,79 +10873,2079 @@ window.__ModuleLoader__.load({
|
|
|
10427
10873
|
bandCritical: "关键"
|
|
10428
10874
|
}
|
|
10429
10875
|
}, "dice_"));
|
|
10430
|
-
const dictionaries$
|
|
10876
|
+
const dictionaries$10 = withDictionaries({
|
|
10877
|
+
en: {
|
|
10878
|
+
nav: "Avatars",
|
|
10879
|
+
avatarsLoading: "Loading avatars…",
|
|
10880
|
+
avatarsLoadFailed: "Could not load the avatars: {message}",
|
|
10881
|
+
avatarsEmpty: "No avatars yet. An avatar is a character you can play in any world: make one, then add it to a world or bring it into a new session.",
|
|
10882
|
+
avatarsCountOne: "{count} avatar",
|
|
10883
|
+
avatarsCountOther: "{count} avatars",
|
|
10884
|
+
avatarsRefresh: "Refresh",
|
|
10885
|
+
avatarsRefreshing: "Refreshing…",
|
|
10886
|
+
avatarsBack: "Back",
|
|
10887
|
+
avatarsCancel: "Cancel",
|
|
10888
|
+
avatarsClose: "Close",
|
|
10889
|
+
avatarsMissing: "This avatar is no longer there.",
|
|
10890
|
+
avatarCreate: "New avatar",
|
|
10891
|
+
avatarCreateTitle: "New avatar",
|
|
10892
|
+
avatarCreateHelp: "An avatar is a playable character that is not tied to a world. Give it a name; everything else can be written in the editor.",
|
|
10893
|
+
avatarName: "Name",
|
|
10894
|
+
avatarCreating: "Creating…",
|
|
10895
|
+
avatarCreateFailed: "Could not create the avatar: {message}",
|
|
10896
|
+
avatarDelete: "Delete",
|
|
10897
|
+
avatarDeleteTitle: "Delete avatar",
|
|
10898
|
+
avatarDeleteHelp: "Delete {name}? Worlds and sessions that already have it keep their own copy. The avatar is moved to the trash folder.",
|
|
10899
|
+
avatarDeleting: "Deleting…",
|
|
10900
|
+
avatarDeleteFailed: "Could not delete the avatar: {message}",
|
|
10901
|
+
avatarEdit: "Edit"
|
|
10902
|
+
},
|
|
10903
|
+
zh: {
|
|
10904
|
+
nav: "角色形象",
|
|
10905
|
+
avatarsLoading: "正在加载角色形象…",
|
|
10906
|
+
avatarsLoadFailed: "无法加载角色形象:{message}",
|
|
10907
|
+
avatarsEmpty: "还没有角色形象。角色形象是可在任何世界里扮演的角色:先创建一个,再把它加入世界,或在新存档中带上它。",
|
|
10908
|
+
avatarsCountOne: "{count} 个角色形象",
|
|
10909
|
+
avatarsCountOther: "{count} 个角色形象",
|
|
10910
|
+
avatarsRefresh: "刷新",
|
|
10911
|
+
avatarsRefreshing: "正在刷新…",
|
|
10912
|
+
avatarsBack: "返回",
|
|
10913
|
+
avatarsCancel: "取消",
|
|
10914
|
+
avatarsClose: "关闭",
|
|
10915
|
+
avatarsMissing: "这个角色形象已不存在。",
|
|
10916
|
+
avatarCreate: "新建角色形象",
|
|
10917
|
+
avatarCreateTitle: "新建角色形象",
|
|
10918
|
+
avatarCreateHelp: "角色形象是不属于任何世界的可扮演角色。先起个名字,其余内容可在编辑器中填写。",
|
|
10919
|
+
avatarName: "名称",
|
|
10920
|
+
avatarCreating: "正在创建…",
|
|
10921
|
+
avatarCreateFailed: "无法创建角色形象:{message}",
|
|
10922
|
+
avatarDelete: "删除",
|
|
10923
|
+
avatarDeleteTitle: "删除角色形象",
|
|
10924
|
+
avatarDeleteHelp: "删除{name}?已经带有它的世界和存档会保留各自的副本。该角色形象会被移到回收文件夹。",
|
|
10925
|
+
avatarDeleting: "正在删除…",
|
|
10926
|
+
avatarDeleteFailed: "无法删除角色形象:{message}",
|
|
10927
|
+
avatarEdit: "编辑"
|
|
10928
|
+
}
|
|
10929
|
+
}, dictionaries$11);
|
|
10930
|
+
//#endregion
|
|
10931
|
+
//#region src/client/pages/avatars/index.ts
|
|
10932
|
+
const NAMESPACE$11 = "roleplay.avatars";
|
|
10933
|
+
/** Adds the Avatars page to the Role Play panel: characters to play in any world. */
|
|
10934
|
+
function registerAvatarsPage(ctx) {
|
|
10935
|
+
const t = ctx.locale.bind(NAMESPACE$11);
|
|
10936
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$11, dictionaries$10), "roleplay: avatars dictionaries");
|
|
10937
|
+
const avatars = new AvatarsController();
|
|
10938
|
+
ctx.effect(() => () => {
|
|
10939
|
+
avatars.dispose();
|
|
10940
|
+
}, "roleplay: avatars requests");
|
|
10941
|
+
ctx.slots.inject("roleplay.page", () => ctx.slots.register({
|
|
10942
|
+
name: "roleplay.page",
|
|
10943
|
+
id: "avatars",
|
|
10944
|
+
order: 5,
|
|
10945
|
+
label: () => t("nav"),
|
|
10946
|
+
locale: NAMESPACE$11,
|
|
10947
|
+
inject: () => avatars.inject()
|
|
10948
|
+
}, AvatarsPage));
|
|
10949
|
+
}
|
|
10950
|
+
//#endregion
|
|
10951
|
+
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/lorebooks/LorebooksPage.module.css.mjs
|
|
10952
|
+
const css$19 = ".rp_VV-Eha_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_VV-Eha_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_VV-Eha_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_VV-Eha_actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_VV-Eha_viewport{flex:1 1 0;min-height:0;padding:4px;overflow-y:auto}.rp_VV-Eha_grid{grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_VV-Eha_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:8px;min-width:0;padding:12px;display:flex}.rp_VV-Eha_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_VV-Eha_head{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_VV-Eha_title{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;overflow:hidden}.rp_VV-Eha_name{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_VV-Eha_description{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:0;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.rp_VV-Eha_meta{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_VV-Eha_cardActions{flex-wrap:wrap;gap:4px;margin-top:auto;display:flex}.rp_VV-Eha_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_VV-Eha_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_VV-Eha_warning{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-error-primary));margin:0;font-size:12px}.rp_VV-Eha_ok{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_VV-Eha_editHeader{border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_VV-Eha_editTitle{color:var(--dsw-alias-label-primary);flex:auto;font-size:14px;font-weight:500}.rp_VV-Eha_editBody{flex-direction:column;flex:1 1 0;gap:24px;min-height:0;padding:16px 24px;display:flex;overflow-y:auto}.rp_VV-Eha_section{flex-direction:column;gap:12px;max-width:720px;display:flex}.rp_VV-Eha_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.rp_VV-Eha_help{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.rp_VV-Eha_row{flex-wrap:wrap;gap:12px;display:flex}.rp_VV-Eha_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_VV-Eha_field{flex-direction:column;flex:200px;gap:6px;min-width:0;display:flex}.rp_VV-Eha_label{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_VV-Eha_area{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:280px;font:13px/20px var(--dsw-font-mono,monospace);color:var(--dsw-alias-label-primary);resize:vertical;padding:8px}.rp_VV-Eha_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);width:100%;font:inherit;color:var(--dsw-alias-label-primary);padding:6px 8px;font-size:13px}@media (width<=640px){.rp_VV-Eha_grid{grid-template-columns:1fr}.rp_VV-Eha_form{min-width:0}.rp_VV-Eha_editBody{padding:16px}}.rp_VV-Eha_select{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);max-width:100%;font:inherit;color:var(--dsw-alias-label-primary);padding:4px 6px;font-size:13px}.rp_VV-Eha_entryArea{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:200px;color:var(--dsw-alias-label-primary);resize:vertical;padding:8px;font:13px/20px inherit}";
|
|
10953
|
+
const key$19 = "src/client/pages/lorebooks/LorebooksPage.module.css";
|
|
10954
|
+
let tag$19 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$19) + "]");
|
|
10955
|
+
if (tag$19 === null) {
|
|
10956
|
+
tag$19 = document.createElement("style");
|
|
10957
|
+
tag$19.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
10958
|
+
tag$19.dataset.pluginCss = key$19;
|
|
10959
|
+
document.head.appendChild(tag$19);
|
|
10960
|
+
}
|
|
10961
|
+
tag$19.textContent = css$19;
|
|
10962
|
+
var LorebooksPage_module_css_default = {
|
|
10963
|
+
"label": "rp_VV-Eha_label",
|
|
10964
|
+
"count": "rp_VV-Eha_count",
|
|
10965
|
+
"actions": "rp_VV-Eha_actions",
|
|
10966
|
+
"name": "rp_VV-Eha_name",
|
|
10967
|
+
"grid": "rp_VV-Eha_grid",
|
|
10968
|
+
"description": "rp_VV-Eha_description",
|
|
10969
|
+
"sectionTitle": "rp_VV-Eha_sectionTitle",
|
|
10970
|
+
"area": "rp_VV-Eha_area",
|
|
10971
|
+
"entryArea": "rp_VV-Eha_entryArea",
|
|
10972
|
+
"message": "rp_VV-Eha_message",
|
|
10973
|
+
"toolbar": "rp_VV-Eha_toolbar",
|
|
10974
|
+
"warning": "rp_VV-Eha_warning",
|
|
10975
|
+
"error": "rp_VV-Eha_error",
|
|
10976
|
+
"help": "rp_VV-Eha_help",
|
|
10977
|
+
"editTitle": "rp_VV-Eha_editTitle",
|
|
10978
|
+
"editHeader": "rp_VV-Eha_editHeader",
|
|
10979
|
+
"field": "rp_VV-Eha_field",
|
|
10980
|
+
"title": "rp_VV-Eha_title",
|
|
10981
|
+
"ok": "rp_VV-Eha_ok",
|
|
10982
|
+
"section": "rp_VV-Eha_section",
|
|
10983
|
+
"meta": "rp_VV-Eha_meta",
|
|
10984
|
+
"card": "rp_VV-Eha_card",
|
|
10985
|
+
"cardActions": "rp_VV-Eha_cardActions",
|
|
10986
|
+
"select": "rp_VV-Eha_select",
|
|
10987
|
+
"page": "rp_VV-Eha_page",
|
|
10988
|
+
"input": "rp_VV-Eha_input",
|
|
10989
|
+
"head": "rp_VV-Eha_head",
|
|
10990
|
+
"editBody": "rp_VV-Eha_editBody",
|
|
10991
|
+
"row": "rp_VV-Eha_row",
|
|
10992
|
+
"form": "rp_VV-Eha_form",
|
|
10993
|
+
"viewport": "rp_VV-Eha_viewport"
|
|
10994
|
+
};
|
|
10995
|
+
//#endregion
|
|
10996
|
+
//#region src/client/pages/lorebooks/LorebookEditor.tsx
|
|
10997
|
+
const messageOf$6 = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
10998
|
+
const KINDS = [
|
|
10999
|
+
"history",
|
|
11000
|
+
"culture",
|
|
11001
|
+
"religion",
|
|
11002
|
+
"politics",
|
|
11003
|
+
"geography",
|
|
11004
|
+
"science",
|
|
11005
|
+
"custom",
|
|
11006
|
+
"legend",
|
|
11007
|
+
"other"
|
|
11008
|
+
];
|
|
11009
|
+
const SCOPES = ["everyone", "listed"];
|
|
11010
|
+
const ID = /^[\p{L}\p{N}][\p{L}\p{N}_-]{0,79}$/u;
|
|
11011
|
+
const list = (text) => text.split(/[,\n,、]/).map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
11012
|
+
const draftOf = (entry) => ({
|
|
11013
|
+
id: entry.id,
|
|
11014
|
+
title: entry.title,
|
|
11015
|
+
kind: entry.kind,
|
|
11016
|
+
scope: entry.scope,
|
|
11017
|
+
knownBy: entry.knownBy.join(", "),
|
|
11018
|
+
summary: entry.summary,
|
|
11019
|
+
body: entry.body,
|
|
11020
|
+
related: entry.related.join(", ")
|
|
11021
|
+
});
|
|
11022
|
+
const blank = () => ({
|
|
11023
|
+
id: "",
|
|
11024
|
+
title: "",
|
|
11025
|
+
kind: "other",
|
|
11026
|
+
scope: "everyone",
|
|
11027
|
+
knownBy: "",
|
|
11028
|
+
summary: "",
|
|
11029
|
+
body: "",
|
|
11030
|
+
related: ""
|
|
11031
|
+
});
|
|
11032
|
+
const entryOf = (draft) => ({
|
|
11033
|
+
id: draft.id.trim(),
|
|
11034
|
+
title: draft.title.trim(),
|
|
11035
|
+
kind: draft.kind,
|
|
11036
|
+
scope: draft.scope,
|
|
11037
|
+
knownBy: draft.scope === "listed" ? list(draft.knownBy) : [],
|
|
11038
|
+
summary: draft.summary.trim(),
|
|
11039
|
+
body: draft.body,
|
|
11040
|
+
related: list(draft.related)
|
|
11041
|
+
});
|
|
11042
|
+
const infoOf$1 = (summary) => ({
|
|
11043
|
+
title: summary.title === summary.name ? "" : summary.title,
|
|
11044
|
+
description: summary.description
|
|
11045
|
+
});
|
|
11046
|
+
/** One library lorebook: what it says about itself and its entries one at a time; the assistant does the larger rewrites and the import. */
|
|
11047
|
+
function LorebookEditor({ t, name, onBack, author }) {
|
|
11048
|
+
const [loaded, setLoaded] = (0, react.useState)();
|
|
11049
|
+
const [failure, setFailure] = (0, react.useState)();
|
|
11050
|
+
const [info, setInfo] = (0, react.useState)();
|
|
11051
|
+
const [infoStatus, setInfoStatus] = (0, react.useState)({ state: "idle" });
|
|
11052
|
+
const [draft, setDraft] = (0, react.useState)(blank());
|
|
11053
|
+
const [creating, setCreating] = (0, react.useState)(true);
|
|
11054
|
+
const [entryStatus, setEntryStatus] = (0, react.useState)({ state: "idle" });
|
|
11055
|
+
const accept = (value, keep) => {
|
|
11056
|
+
setLoaded(value);
|
|
11057
|
+
setInfo(infoOf$1(value.summary));
|
|
11058
|
+
const chosen = value.entries.find((entry) => entry.id === keep) ?? value.entries[0];
|
|
11059
|
+
setCreating(chosen === void 0);
|
|
11060
|
+
setDraft(chosen === void 0 ? blank() : draftOf(chosen));
|
|
11061
|
+
};
|
|
11062
|
+
(0, react.useEffect)(() => {
|
|
11063
|
+
const abort = new AbortController();
|
|
11064
|
+
readLorebook(name, abort.signal).then((value) => {
|
|
11065
|
+
accept(value);
|
|
11066
|
+
}, (problem) => {
|
|
11067
|
+
if (!abort.signal.aborted) setFailure(messageOf$6(problem));
|
|
11068
|
+
});
|
|
11069
|
+
return () => {
|
|
11070
|
+
abort.abort();
|
|
11071
|
+
};
|
|
11072
|
+
}, [name]);
|
|
11073
|
+
if (loaded === void 0 || info === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11074
|
+
className: LorebooksPage_module_css_default.message,
|
|
11075
|
+
role: failure === void 0 ? void 0 : "alert",
|
|
11076
|
+
children: failure === void 0 ? t("loading") : t("loadFailed", { message: failure })
|
|
11077
|
+
});
|
|
11078
|
+
const saved = infoOf$1(loaded.summary);
|
|
11079
|
+
const infoDirty = JSON.stringify(info) !== JSON.stringify(saved);
|
|
11080
|
+
const current = creating ? void 0 : loaded.entries.find((entry) => entry.id === draft.id);
|
|
11081
|
+
const entryDirty = creating || current !== void 0 && JSON.stringify(draftOf(current)) !== JSON.stringify(draft);
|
|
11082
|
+
const ready = ID.test(draft.id.trim()) && draft.title.trim() !== "" && (draft.body.trim() !== "" || draft.summary.trim() !== "") && (draft.scope === "everyone" || list(draft.knownBy).length > 0);
|
|
11083
|
+
const saveInfo = () => {
|
|
11084
|
+
setInfoStatus({ state: "saving" });
|
|
11085
|
+
updateLorebookInfo(name, info, new AbortController().signal).then((summary) => {
|
|
11086
|
+
setLoaded({
|
|
11087
|
+
...loaded,
|
|
11088
|
+
summary
|
|
11089
|
+
});
|
|
11090
|
+
setInfo(infoOf$1(summary));
|
|
11091
|
+
setInfoStatus({ state: "saved" });
|
|
11092
|
+
}, (problem) => {
|
|
11093
|
+
setInfoStatus({
|
|
11094
|
+
state: "failed",
|
|
11095
|
+
message: messageOf$6(problem)
|
|
11096
|
+
});
|
|
11097
|
+
});
|
|
11098
|
+
};
|
|
11099
|
+
const reload = (keep) => {
|
|
11100
|
+
readLorebook(name, new AbortController().signal).then((value) => {
|
|
11101
|
+
accept(value, keep);
|
|
11102
|
+
}, (problem) => {
|
|
11103
|
+
setEntryStatus({
|
|
11104
|
+
state: "failed",
|
|
11105
|
+
message: messageOf$6(problem)
|
|
11106
|
+
});
|
|
11107
|
+
});
|
|
11108
|
+
};
|
|
11109
|
+
const saveEntry = () => {
|
|
11110
|
+
setEntryStatus({ state: "saving" });
|
|
11111
|
+
const entry = entryOf(draft);
|
|
11112
|
+
writeLorebookEntry(name, entry, new AbortController().signal).then(() => {
|
|
11113
|
+
setEntryStatus({ state: "saved" });
|
|
11114
|
+
reload(entry.id);
|
|
11115
|
+
}, (problem) => {
|
|
11116
|
+
setEntryStatus({
|
|
11117
|
+
state: "failed",
|
|
11118
|
+
message: messageOf$6(problem)
|
|
11119
|
+
});
|
|
11120
|
+
});
|
|
11121
|
+
};
|
|
11122
|
+
const removeEntry = () => {
|
|
11123
|
+
setEntryStatus({ state: "saving" });
|
|
11124
|
+
removeLorebookEntry(name, draft.id, new AbortController().signal).then(() => {
|
|
11125
|
+
setEntryStatus({ state: "idle" });
|
|
11126
|
+
reload();
|
|
11127
|
+
}, (problem) => {
|
|
11128
|
+
setEntryStatus({
|
|
11129
|
+
state: "failed",
|
|
11130
|
+
message: messageOf$6(problem)
|
|
11131
|
+
});
|
|
11132
|
+
});
|
|
11133
|
+
};
|
|
11134
|
+
const edit = (change) => {
|
|
11135
|
+
setDraft({
|
|
11136
|
+
...draft,
|
|
11137
|
+
...change
|
|
11138
|
+
});
|
|
11139
|
+
setEntryStatus({ state: "idle" });
|
|
11140
|
+
};
|
|
11141
|
+
const text = (key, caption, options = {}) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11142
|
+
className: LorebooksPage_module_css_default.field,
|
|
11143
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11144
|
+
className: LorebooksPage_module_css_default.label,
|
|
11145
|
+
children: t(caption)
|
|
11146
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11147
|
+
className: LorebooksPage_module_css_default.input,
|
|
11148
|
+
value: draft[key],
|
|
11149
|
+
disabled: options.disabled === true,
|
|
11150
|
+
onChange: (event) => {
|
|
11151
|
+
edit({ [key]: event.target.value });
|
|
11152
|
+
}
|
|
11153
|
+
})]
|
|
11154
|
+
});
|
|
11155
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11156
|
+
className: LorebooksPage_module_css_default.page,
|
|
11157
|
+
"data-testid": "roleplay-lorebook-editor",
|
|
11158
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11159
|
+
className: LorebooksPage_module_css_default.editHeader,
|
|
11160
|
+
children: [
|
|
11161
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11162
|
+
variant: "ghost",
|
|
11163
|
+
size: "sm",
|
|
11164
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronLeftOutlineRegular, {}),
|
|
11165
|
+
onClick: onBack,
|
|
11166
|
+
children: t("back")
|
|
11167
|
+
}),
|
|
11168
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11169
|
+
className: LorebooksPage_module_css_default.editTitle,
|
|
11170
|
+
children: loaded.summary.title
|
|
11171
|
+
}),
|
|
11172
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11173
|
+
variant: "primary",
|
|
11174
|
+
size: "sm",
|
|
11175
|
+
onClick: author,
|
|
11176
|
+
children: t("author")
|
|
11177
|
+
})
|
|
11178
|
+
]
|
|
11179
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11180
|
+
className: LorebooksPage_module_css_default.editBody,
|
|
11181
|
+
children: [
|
|
11182
|
+
loaded.summary.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11183
|
+
className: LorebooksPage_module_css_default.error,
|
|
11184
|
+
role: "alert",
|
|
11185
|
+
children: t("broken", { problems: loaded.summary.problems.join("; ") })
|
|
11186
|
+
}),
|
|
11187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
11188
|
+
className: LorebooksPage_module_css_default.section,
|
|
11189
|
+
children: [
|
|
11190
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
11191
|
+
className: LorebooksPage_module_css_default.sectionTitle,
|
|
11192
|
+
children: t("info")
|
|
11193
|
+
}),
|
|
11194
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11195
|
+
className: LorebooksPage_module_css_default.field,
|
|
11196
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11197
|
+
className: LorebooksPage_module_css_default.label,
|
|
11198
|
+
children: t("bookTitle")
|
|
11199
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11200
|
+
className: LorebooksPage_module_css_default.input,
|
|
11201
|
+
value: info.title,
|
|
11202
|
+
onChange: (event) => {
|
|
11203
|
+
setInfo({
|
|
11204
|
+
...info,
|
|
11205
|
+
title: event.target.value
|
|
11206
|
+
});
|
|
11207
|
+
setInfoStatus({ state: "idle" });
|
|
11208
|
+
}
|
|
11209
|
+
})]
|
|
11210
|
+
}),
|
|
11211
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11212
|
+
className: LorebooksPage_module_css_default.field,
|
|
11213
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11214
|
+
className: LorebooksPage_module_css_default.label,
|
|
11215
|
+
children: t("bookDescription")
|
|
11216
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
11217
|
+
className: LorebooksPage_module_css_default.input,
|
|
11218
|
+
rows: 3,
|
|
11219
|
+
value: info.description,
|
|
11220
|
+
onChange: (event) => {
|
|
11221
|
+
setInfo({
|
|
11222
|
+
...info,
|
|
11223
|
+
description: event.target.value
|
|
11224
|
+
});
|
|
11225
|
+
setInfoStatus({ state: "idle" });
|
|
11226
|
+
}
|
|
11227
|
+
})]
|
|
11228
|
+
}),
|
|
11229
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11230
|
+
className: LorebooksPage_module_css_default.actions,
|
|
11231
|
+
children: [
|
|
11232
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11233
|
+
variant: "primary",
|
|
11234
|
+
size: "sm",
|
|
11235
|
+
disabled: !infoDirty || infoStatus.state === "saving",
|
|
11236
|
+
onClick: saveInfo,
|
|
11237
|
+
children: infoStatus.state === "saving" ? t("infoSaving") : t("infoSave")
|
|
11238
|
+
}),
|
|
11239
|
+
infoStatus.state === "saved" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11240
|
+
className: LorebooksPage_module_css_default.ok,
|
|
11241
|
+
role: "status",
|
|
11242
|
+
children: t("infoSaved")
|
|
11243
|
+
}),
|
|
11244
|
+
infoStatus.state === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11245
|
+
className: LorebooksPage_module_css_default.error,
|
|
11246
|
+
role: "alert",
|
|
11247
|
+
children: t("infoFailed", { message: infoStatus.message ?? "" })
|
|
11248
|
+
})
|
|
11249
|
+
]
|
|
11250
|
+
})
|
|
11251
|
+
]
|
|
11252
|
+
}),
|
|
11253
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
11254
|
+
className: LorebooksPage_module_css_default.section,
|
|
11255
|
+
children: [
|
|
11256
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
11257
|
+
className: LorebooksPage_module_css_default.sectionTitle,
|
|
11258
|
+
children: t("entries")
|
|
11259
|
+
}),
|
|
11260
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11261
|
+
className: LorebooksPage_module_css_default.help,
|
|
11262
|
+
children: t("entriesHelp")
|
|
11263
|
+
}),
|
|
11264
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11265
|
+
className: LorebooksPage_module_css_default.actions,
|
|
11266
|
+
children: [loaded.entries.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
11267
|
+
className: LorebooksPage_module_css_default.select,
|
|
11268
|
+
value: creating ? "" : draft.id,
|
|
11269
|
+
"aria-label": t("entryPick"),
|
|
11270
|
+
"data-testid": "roleplay-lorebook-entry",
|
|
11271
|
+
onChange: (event) => {
|
|
11272
|
+
const found = loaded.entries.find((entry) => entry.id === event.target.value);
|
|
11273
|
+
if (found !== void 0) {
|
|
11274
|
+
setCreating(false);
|
|
11275
|
+
setDraft(draftOf(found));
|
|
11276
|
+
setEntryStatus({ state: "idle" });
|
|
11277
|
+
}
|
|
11278
|
+
},
|
|
11279
|
+
children: [creating && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
11280
|
+
value: "",
|
|
11281
|
+
children: t("entryNew")
|
|
11282
|
+
}), loaded.entries.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
|
|
11283
|
+
value: entry.id,
|
|
11284
|
+
children: [entry.title, entry.scope === "listed" ? ` · ${t("scope_listed")}` : ""]
|
|
11285
|
+
}, entry.id))]
|
|
11286
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11287
|
+
variant: "outline",
|
|
11288
|
+
size: "sm",
|
|
11289
|
+
disabled: creating && draft.id === "" && draft.title === "" && draft.body === "",
|
|
11290
|
+
onClick: () => {
|
|
11291
|
+
setCreating(true);
|
|
11292
|
+
setDraft(blank());
|
|
11293
|
+
setEntryStatus({ state: "idle" });
|
|
11294
|
+
},
|
|
11295
|
+
children: t("entryAdd")
|
|
11296
|
+
})]
|
|
11297
|
+
}),
|
|
11298
|
+
text("id", "entryId", { disabled: !creating }),
|
|
11299
|
+
text("title", "entryTitle"),
|
|
11300
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11301
|
+
className: LorebooksPage_module_css_default.row,
|
|
11302
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11303
|
+
className: LorebooksPage_module_css_default.field,
|
|
11304
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11305
|
+
className: LorebooksPage_module_css_default.label,
|
|
11306
|
+
children: t("entryKind")
|
|
11307
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
11308
|
+
className: LorebooksPage_module_css_default.select,
|
|
11309
|
+
value: draft.kind,
|
|
11310
|
+
onChange: (event) => {
|
|
11311
|
+
edit({ kind: event.target.value });
|
|
11312
|
+
},
|
|
11313
|
+
children: KINDS.map((kind) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
11314
|
+
value: kind,
|
|
11315
|
+
children: t(`kind_${kind}`)
|
|
11316
|
+
}, kind))
|
|
11317
|
+
})]
|
|
11318
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11319
|
+
className: LorebooksPage_module_css_default.field,
|
|
11320
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11321
|
+
className: LorebooksPage_module_css_default.label,
|
|
11322
|
+
children: t("entryScope")
|
|
11323
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
11324
|
+
className: LorebooksPage_module_css_default.select,
|
|
11325
|
+
value: draft.scope,
|
|
11326
|
+
"data-testid": "roleplay-lorebook-scope",
|
|
11327
|
+
onChange: (event) => {
|
|
11328
|
+
edit({ scope: event.target.value });
|
|
11329
|
+
},
|
|
11330
|
+
children: SCOPES.map((scope) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
11331
|
+
value: scope,
|
|
11332
|
+
children: t(`scope_${scope}`)
|
|
11333
|
+
}, scope))
|
|
11334
|
+
})]
|
|
11335
|
+
})]
|
|
11336
|
+
}),
|
|
11337
|
+
draft.scope === "listed" && text("knownBy", "entryKnownBy"),
|
|
11338
|
+
text("summary", "entrySummary"),
|
|
11339
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11340
|
+
className: LorebooksPage_module_css_default.field,
|
|
11341
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11342
|
+
className: LorebooksPage_module_css_default.label,
|
|
11343
|
+
children: t("entryBody")
|
|
11344
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
11345
|
+
className: LorebooksPage_module_css_default.entryArea,
|
|
11346
|
+
value: draft.body,
|
|
11347
|
+
onChange: (event) => {
|
|
11348
|
+
edit({ body: event.target.value });
|
|
11349
|
+
}
|
|
11350
|
+
})]
|
|
11351
|
+
}),
|
|
11352
|
+
loaded.entries.length > 1 && text("related", "entryRelated"),
|
|
11353
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11354
|
+
className: LorebooksPage_module_css_default.actions,
|
|
11355
|
+
children: [
|
|
11356
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11357
|
+
variant: "primary",
|
|
11358
|
+
size: "sm",
|
|
11359
|
+
disabled: !entryDirty || !ready || entryStatus.state === "saving",
|
|
11360
|
+
onClick: saveEntry,
|
|
11361
|
+
children: entryStatus.state === "saving" ? t("entrySaving") : t("entrySave")
|
|
11362
|
+
}),
|
|
11363
|
+
!creating && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11364
|
+
variant: "ghost",
|
|
11365
|
+
size: "sm",
|
|
11366
|
+
disabled: entryStatus.state === "saving",
|
|
11367
|
+
onClick: removeEntry,
|
|
11368
|
+
children: t("entryRemove")
|
|
11369
|
+
}),
|
|
11370
|
+
entryStatus.state === "saved" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11371
|
+
className: LorebooksPage_module_css_default.ok,
|
|
11372
|
+
role: "status",
|
|
11373
|
+
children: t("entrySaved")
|
|
11374
|
+
}),
|
|
11375
|
+
entryStatus.state === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11376
|
+
className: LorebooksPage_module_css_default.error,
|
|
11377
|
+
role: "alert",
|
|
11378
|
+
children: t("entryFailed", { message: entryStatus.message ?? "" })
|
|
11379
|
+
})
|
|
11380
|
+
]
|
|
11381
|
+
})
|
|
11382
|
+
]
|
|
11383
|
+
})
|
|
11384
|
+
]
|
|
11385
|
+
})]
|
|
11386
|
+
});
|
|
11387
|
+
}
|
|
11388
|
+
//#endregion
|
|
11389
|
+
//#region src/client/pages/lorebooks/LorebooksPage.tsx
|
|
11390
|
+
const NAME$1 = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
11391
|
+
const messageOf$5 = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
11392
|
+
const nameFromFile$1 = (file) => file.replace(/\.[^.]*$/, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^[-_]+|[-_]+$/g, "").slice(0, 64);
|
|
11393
|
+
function NameDialog$1({ t, mode, file, submit, onClose }) {
|
|
11394
|
+
const formId = (0, react.useId)();
|
|
11395
|
+
const [name, setName] = (0, react.useState)(file === void 0 ? "" : nameFromFile$1(file));
|
|
11396
|
+
const [title, setTitle] = (0, react.useState)("");
|
|
11397
|
+
const [description, setDescription] = (0, react.useState)("");
|
|
11398
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
11399
|
+
const [error, setError] = (0, react.useState)();
|
|
11400
|
+
const go = () => {
|
|
11401
|
+
if (!NAME$1.test(name) || busy) return;
|
|
11402
|
+
setBusy(true);
|
|
11403
|
+
setError(void 0);
|
|
11404
|
+
submit(name, title.trim(), description.trim()).then(onClose, (failure) => {
|
|
11405
|
+
setBusy(false);
|
|
11406
|
+
setError(messageOf$5(failure));
|
|
11407
|
+
});
|
|
11408
|
+
};
|
|
11409
|
+
const importing = mode === "import";
|
|
11410
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
11411
|
+
open: true,
|
|
11412
|
+
onClose,
|
|
11413
|
+
title: importing ? t("importTitle") : t("createTitle"),
|
|
11414
|
+
description: importing ? t("importHelp", { file: file ?? "" }) : t("createHelp"),
|
|
11415
|
+
closeLabel: t("close"),
|
|
11416
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11417
|
+
variant: "ghost",
|
|
11418
|
+
disabled: busy,
|
|
11419
|
+
onClick: onClose,
|
|
11420
|
+
children: t("cancel")
|
|
11421
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11422
|
+
variant: "primary",
|
|
11423
|
+
type: "submit",
|
|
11424
|
+
form: formId,
|
|
11425
|
+
disabled: busy || !NAME$1.test(name),
|
|
11426
|
+
children: importing ? busy ? t("importing") : t("import") : busy ? t("creating") : t("create")
|
|
11427
|
+
})] }),
|
|
11428
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
11429
|
+
id: formId,
|
|
11430
|
+
className: LorebooksPage_module_css_default.form,
|
|
11431
|
+
onSubmit: (event) => {
|
|
11432
|
+
event.preventDefault();
|
|
11433
|
+
go();
|
|
11434
|
+
},
|
|
11435
|
+
children: [
|
|
11436
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11437
|
+
className: LorebooksPage_module_css_default.field,
|
|
11438
|
+
children: [
|
|
11439
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11440
|
+
className: LorebooksPage_module_css_default.label,
|
|
11441
|
+
children: t("bookName")
|
|
11442
|
+
}),
|
|
11443
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
11444
|
+
value: name,
|
|
11445
|
+
maxLength: 64,
|
|
11446
|
+
"data-modal-autofocus": true,
|
|
11447
|
+
onChange: (event) => {
|
|
11448
|
+
setName(event.target.value);
|
|
11449
|
+
}
|
|
11450
|
+
}),
|
|
11451
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11452
|
+
className: LorebooksPage_module_css_default.help,
|
|
11453
|
+
children: t("bookNameHelp")
|
|
11454
|
+
})
|
|
11455
|
+
]
|
|
11456
|
+
}),
|
|
11457
|
+
!importing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11458
|
+
className: LorebooksPage_module_css_default.field,
|
|
11459
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11460
|
+
className: LorebooksPage_module_css_default.label,
|
|
11461
|
+
children: t("bookTitle")
|
|
11462
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
11463
|
+
value: title,
|
|
11464
|
+
maxLength: 300,
|
|
11465
|
+
onChange: (event) => {
|
|
11466
|
+
setTitle(event.target.value);
|
|
11467
|
+
}
|
|
11468
|
+
})]
|
|
11469
|
+
}),
|
|
11470
|
+
!importing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11471
|
+
className: LorebooksPage_module_css_default.field,
|
|
11472
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11473
|
+
className: LorebooksPage_module_css_default.label,
|
|
11474
|
+
children: t("bookDescription")
|
|
11475
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
11476
|
+
value: description,
|
|
11477
|
+
maxLength: 300,
|
|
11478
|
+
onChange: (event) => {
|
|
11479
|
+
setDescription(event.target.value);
|
|
11480
|
+
}
|
|
11481
|
+
})]
|
|
11482
|
+
}),
|
|
11483
|
+
error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11484
|
+
className: LorebooksPage_module_css_default.error,
|
|
11485
|
+
role: "alert",
|
|
11486
|
+
children: importing ? t("importFailed", { message: error }) : t("createFailed", { message: error })
|
|
11487
|
+
})
|
|
11488
|
+
]
|
|
11489
|
+
})
|
|
11490
|
+
});
|
|
11491
|
+
}
|
|
11492
|
+
function DeleteDialog$1({ t, book, remove, onClose }) {
|
|
11493
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
11494
|
+
const [error, setError] = (0, react.useState)();
|
|
11495
|
+
const confirm = () => {
|
|
11496
|
+
setBusy(true);
|
|
11497
|
+
setError(void 0);
|
|
11498
|
+
remove(book.name).then(onClose, (failure) => {
|
|
11499
|
+
setBusy(false);
|
|
11500
|
+
setError(messageOf$5(failure));
|
|
11501
|
+
});
|
|
11502
|
+
};
|
|
11503
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
11504
|
+
open: true,
|
|
11505
|
+
onClose,
|
|
11506
|
+
title: t("deleteTitle"),
|
|
11507
|
+
description: t("deleteHelp", { name: book.title }),
|
|
11508
|
+
closeLabel: t("close"),
|
|
11509
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11510
|
+
variant: "ghost",
|
|
11511
|
+
disabled: busy,
|
|
11512
|
+
onClick: onClose,
|
|
11513
|
+
children: t("cancel")
|
|
11514
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11515
|
+
variant: "primary",
|
|
11516
|
+
disabled: busy,
|
|
11517
|
+
onClick: confirm,
|
|
11518
|
+
children: busy ? t("deleting") : t("delete")
|
|
11519
|
+
})] }),
|
|
11520
|
+
children: error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11521
|
+
className: LorebooksPage_module_css_default.error,
|
|
11522
|
+
role: "alert",
|
|
11523
|
+
children: t("deleteFailed", { message: error })
|
|
11524
|
+
})
|
|
11525
|
+
});
|
|
11526
|
+
}
|
|
11527
|
+
/** The lorebook library: reusable background knowledge that a story copies when it starts. */
|
|
11528
|
+
function LorebooksPage({ t, useLorebooks, load, refresh, create, remove, author, importFile }) {
|
|
11529
|
+
const state = useLorebooks((snapshot) => snapshot);
|
|
11530
|
+
const [editing, setEditing] = (0, react.useState)();
|
|
11531
|
+
const [creating, setCreating] = (0, react.useState)(false);
|
|
11532
|
+
const [deleting, setDeleting] = (0, react.useState)();
|
|
11533
|
+
const [uploaded, setUploaded] = (0, react.useState)();
|
|
11534
|
+
const [notice, setNotice] = (0, react.useState)();
|
|
11535
|
+
const picker = (0, react.useRef)(null);
|
|
11536
|
+
(0, react.useEffect)(() => {
|
|
11537
|
+
load();
|
|
11538
|
+
}, [load]);
|
|
11539
|
+
const open = (name) => {
|
|
11540
|
+
setNotice(void 0);
|
|
11541
|
+
author(name).catch((failure) => {
|
|
11542
|
+
setNotice(t("authorFailed", { message: messageOf$5(failure) }));
|
|
11543
|
+
});
|
|
11544
|
+
};
|
|
11545
|
+
if (editing !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LorebookEditor, {
|
|
11546
|
+
t,
|
|
11547
|
+
name: editing,
|
|
11548
|
+
onBack: () => {
|
|
11549
|
+
setEditing(void 0);
|
|
11550
|
+
refresh();
|
|
11551
|
+
},
|
|
11552
|
+
author: () => {
|
|
11553
|
+
open(editing);
|
|
11554
|
+
}
|
|
11555
|
+
});
|
|
11556
|
+
const books = state.books ?? [];
|
|
11557
|
+
const failedWithoutData = state.status === "failed" && state.books === void 0;
|
|
11558
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11559
|
+
className: LorebooksPage_module_css_default.page,
|
|
11560
|
+
"data-testid": "roleplay-lorebooks-page",
|
|
11561
|
+
children: [
|
|
11562
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11563
|
+
className: LorebooksPage_module_css_default.toolbar,
|
|
11564
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11565
|
+
className: LorebooksPage_module_css_default.count,
|
|
11566
|
+
children: state.books === void 0 ? "" : t(books.length === 1 ? "countOne" : "countOther", { count: books.length })
|
|
11567
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11568
|
+
className: LorebooksPage_module_css_default.actions,
|
|
11569
|
+
children: [
|
|
11570
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11571
|
+
ref: picker,
|
|
11572
|
+
type: "file",
|
|
11573
|
+
accept: ".json,application/json",
|
|
11574
|
+
hidden: true,
|
|
11575
|
+
"data-testid": "roleplay-lorebook-file",
|
|
11576
|
+
onChange: (event) => {
|
|
11577
|
+
setUploaded(event.target.files?.[0]);
|
|
11578
|
+
event.target.value = "";
|
|
11579
|
+
}
|
|
11580
|
+
}),
|
|
11581
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11582
|
+
variant: "outline",
|
|
11583
|
+
size: "sm",
|
|
11584
|
+
onClick: () => {
|
|
11585
|
+
picker.current?.click();
|
|
11586
|
+
},
|
|
11587
|
+
children: t("import")
|
|
11588
|
+
}),
|
|
11589
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11590
|
+
variant: "primary",
|
|
11591
|
+
size: "sm",
|
|
11592
|
+
onClick: () => {
|
|
11593
|
+
setCreating(true);
|
|
11594
|
+
},
|
|
11595
|
+
children: t("create")
|
|
11596
|
+
}),
|
|
11597
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11598
|
+
variant: "outline",
|
|
11599
|
+
size: "sm",
|
|
11600
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
|
|
11601
|
+
disabled: state.refreshing || state.status === "loading",
|
|
11602
|
+
"aria-busy": state.refreshing,
|
|
11603
|
+
onClick: refresh,
|
|
11604
|
+
children: state.refreshing ? t("refreshing") : t("refresh")
|
|
11605
|
+
})
|
|
11606
|
+
]
|
|
11607
|
+
})]
|
|
11608
|
+
}),
|
|
11609
|
+
state.error !== void 0 && !failedWithoutData && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11610
|
+
className: LorebooksPage_module_css_default.error,
|
|
11611
|
+
role: "alert",
|
|
11612
|
+
children: t("loadFailed", { message: state.error })
|
|
11613
|
+
}),
|
|
11614
|
+
notice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11615
|
+
className: LorebooksPage_module_css_default.error,
|
|
11616
|
+
role: "alert",
|
|
11617
|
+
children: notice
|
|
11618
|
+
}),
|
|
11619
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11620
|
+
className: LorebooksPage_module_css_default.viewport,
|
|
11621
|
+
children: state.status === "idle" || state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11622
|
+
className: LorebooksPage_module_css_default.message,
|
|
11623
|
+
children: t("loading")
|
|
11624
|
+
}) : failedWithoutData ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11625
|
+
className: LorebooksPage_module_css_default.error,
|
|
11626
|
+
role: "alert",
|
|
11627
|
+
children: t("loadFailed", { message: state.error ?? "" })
|
|
11628
|
+
}) : books.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11629
|
+
className: LorebooksPage_module_css_default.message,
|
|
11630
|
+
children: t("empty")
|
|
11631
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
11632
|
+
className: LorebooksPage_module_css_default.grid,
|
|
11633
|
+
children: books.map((book) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
11634
|
+
className: LorebooksPage_module_css_default.card,
|
|
11635
|
+
"data-testid": "roleplay-lorebook-card",
|
|
11636
|
+
children: [
|
|
11637
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11638
|
+
className: LorebooksPage_module_css_default.head,
|
|
11639
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11640
|
+
className: LorebooksPage_module_css_default.title,
|
|
11641
|
+
children: book.title
|
|
11642
|
+
}), book.title !== book.name && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11643
|
+
className: LorebooksPage_module_css_default.name,
|
|
11644
|
+
children: book.name
|
|
11645
|
+
})]
|
|
11646
|
+
}),
|
|
11647
|
+
book.description !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11648
|
+
className: LorebooksPage_module_css_default.description,
|
|
11649
|
+
children: book.description
|
|
11650
|
+
}),
|
|
11651
|
+
book.problems.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
11652
|
+
className: LorebooksPage_module_css_default.error,
|
|
11653
|
+
children: t("broken", { problems: book.problems.join("; ") })
|
|
11654
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11655
|
+
className: LorebooksPage_module_css_default.meta,
|
|
11656
|
+
children: [t("entriesCount", { count: book.entries }), t("commonCount", { count: book.common })].join(" · ")
|
|
11657
|
+
}),
|
|
11658
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11659
|
+
className: LorebooksPage_module_css_default.cardActions,
|
|
11660
|
+
children: [
|
|
11661
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11662
|
+
variant: "outline",
|
|
11663
|
+
size: "sm",
|
|
11664
|
+
onClick: () => {
|
|
11665
|
+
setEditing(book.name);
|
|
11666
|
+
},
|
|
11667
|
+
children: t("edit")
|
|
11668
|
+
}),
|
|
11669
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11670
|
+
variant: "outline",
|
|
11671
|
+
size: "sm",
|
|
11672
|
+
onClick: () => {
|
|
11673
|
+
open(book.name);
|
|
11674
|
+
},
|
|
11675
|
+
children: t("author")
|
|
11676
|
+
}),
|
|
11677
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
11678
|
+
variant: "ghost",
|
|
11679
|
+
size: "sm",
|
|
11680
|
+
onClick: () => {
|
|
11681
|
+
setDeleting(book);
|
|
11682
|
+
},
|
|
11683
|
+
children: t("delete")
|
|
11684
|
+
})
|
|
11685
|
+
]
|
|
11686
|
+
})
|
|
11687
|
+
]
|
|
11688
|
+
}, book.name))
|
|
11689
|
+
})
|
|
11690
|
+
}),
|
|
11691
|
+
creating && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NameDialog$1, {
|
|
11692
|
+
t,
|
|
11693
|
+
mode: "create",
|
|
11694
|
+
submit: create,
|
|
11695
|
+
onClose: () => {
|
|
11696
|
+
setCreating(false);
|
|
11697
|
+
}
|
|
11698
|
+
}),
|
|
11699
|
+
uploaded !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NameDialog$1, {
|
|
11700
|
+
t,
|
|
11701
|
+
mode: "import",
|
|
11702
|
+
file: uploaded.name,
|
|
11703
|
+
submit: async (name) => {
|
|
11704
|
+
const result = await importFile(name, uploaded);
|
|
11705
|
+
if (!result.started) setNotice(t("importNotStarted", { message: result.failure ?? "" }));
|
|
11706
|
+
},
|
|
11707
|
+
onClose: () => {
|
|
11708
|
+
setUploaded(void 0);
|
|
11709
|
+
}
|
|
11710
|
+
}),
|
|
11711
|
+
deleting !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteDialog$1, {
|
|
11712
|
+
t,
|
|
11713
|
+
book: deleting,
|
|
11714
|
+
remove,
|
|
11715
|
+
onClose: () => {
|
|
11716
|
+
setDeleting(void 0);
|
|
11717
|
+
}
|
|
11718
|
+
})
|
|
11719
|
+
]
|
|
11720
|
+
});
|
|
11721
|
+
}
|
|
11722
|
+
//#endregion
|
|
11723
|
+
//#region src/client/pages/lorebooks/locales.ts
|
|
11724
|
+
const dictionaries$9 = {
|
|
11725
|
+
en: {
|
|
11726
|
+
nav: "Lorebooks",
|
|
11727
|
+
language: "en",
|
|
11728
|
+
loading: "Loading lorebooks…",
|
|
11729
|
+
loadFailed: "Could not load the lorebooks: {message}",
|
|
11730
|
+
empty: "No lorebooks yet. A lorebook is a collection of background knowledge (history, customs, places, legends) that any story can start with. Make one to fill in, or import a SillyTavern lorebook.",
|
|
11731
|
+
countOne: "{count} lorebook",
|
|
11732
|
+
countOther: "{count} lorebooks",
|
|
11733
|
+
refresh: "Refresh",
|
|
11734
|
+
refreshing: "Refreshing…",
|
|
11735
|
+
back: "Back",
|
|
11736
|
+
cancel: "Cancel",
|
|
11737
|
+
close: "Close",
|
|
11738
|
+
create: "New lorebook",
|
|
11739
|
+
createTitle: "New lorebook",
|
|
11740
|
+
createHelp: "The new lorebook starts empty. Add entries yourself or with the assistant.",
|
|
11741
|
+
bookName: "Name",
|
|
11742
|
+
bookNameHelp: "Letters, digits, \"-\" and \"_\", up to 64. Worlds and stories refer to the lorebook by this name.",
|
|
11743
|
+
bookTitle: "Title",
|
|
11744
|
+
bookDescription: "Description",
|
|
11745
|
+
creating: "Creating…",
|
|
11746
|
+
createFailed: "Could not create the lorebook: {message}",
|
|
11747
|
+
import: "Import SillyTavern lorebook",
|
|
11748
|
+
importTitle: "Import a SillyTavern lorebook",
|
|
11749
|
+
importHelp: "The assistant reads {file}. Facts become entries that everyone in a story knows, unless an entry clearly says only some characters do. Instructions to the AI are kept aside, and you are asked before they become a preset.",
|
|
11750
|
+
importing: "Importing…",
|
|
11751
|
+
importFailed: "Could not import the lorebook: {message}",
|
|
11752
|
+
importNotStarted: "The lorebook was kept, but the assistant could not be started: {message}. Open its authoring chat to continue.",
|
|
11753
|
+
edit: "Edit",
|
|
11754
|
+
author: "Edit with assistant",
|
|
11755
|
+
authorFailed: "Could not open the authoring chat: {message}",
|
|
11756
|
+
delete: "Delete",
|
|
11757
|
+
deleteTitle: "Delete lorebook",
|
|
11758
|
+
deleteHelp: "Delete {name}? Stories that already use it keep their own copy. The lorebook is moved to the trash folder.",
|
|
11759
|
+
deleting: "Deleting…",
|
|
11760
|
+
deleteFailed: "Could not delete the lorebook: {message}",
|
|
11761
|
+
broken: "Cannot be used: {problems}",
|
|
11762
|
+
entriesCount: "{count} entries",
|
|
11763
|
+
commonCount: "{count} known to everyone",
|
|
11764
|
+
info: "About",
|
|
11765
|
+
infoSave: "Save",
|
|
11766
|
+
infoSaving: "Saving…",
|
|
11767
|
+
infoSaved: "Saved.",
|
|
11768
|
+
infoFailed: "Could not save: {message}",
|
|
11769
|
+
entries: "Entries",
|
|
11770
|
+
entriesHelp: "One fact of the world each, written as reference prose. A story starts with every entry; entries known to everyone are known to every character, and the others only to the characters listed.",
|
|
11771
|
+
entryPick: "Entry",
|
|
11772
|
+
entryNew: "New entry",
|
|
11773
|
+
entryAdd: "New entry",
|
|
11774
|
+
entryId: "Id",
|
|
11775
|
+
entryTitle: "Title",
|
|
11776
|
+
entryKind: "Kind",
|
|
11777
|
+
entryScope: "Who knows it",
|
|
11778
|
+
entryKnownBy: "Known by (names, separated by commas)",
|
|
11779
|
+
entrySummary: "Summary (one sentence)",
|
|
11780
|
+
entryBody: "Text",
|
|
11781
|
+
entryRelated: "Related entries (ids, separated by commas)",
|
|
11782
|
+
entrySave: "Save entry",
|
|
11783
|
+
entrySaving: "Saving…",
|
|
11784
|
+
entrySaved: "Saved.",
|
|
11785
|
+
entryRemove: "Remove this entry",
|
|
11786
|
+
entryFailed: "Could not save the entry: {message}",
|
|
11787
|
+
scope_everyone: "Everyone",
|
|
11788
|
+
scope_listed: "Only the characters listed",
|
|
11789
|
+
kind_history: "History",
|
|
11790
|
+
kind_culture: "Culture",
|
|
11791
|
+
kind_religion: "Religion",
|
|
11792
|
+
kind_politics: "Politics",
|
|
11793
|
+
kind_geography: "Geography",
|
|
11794
|
+
kind_science: "Science",
|
|
11795
|
+
kind_custom: "Custom",
|
|
11796
|
+
kind_legend: "Legend",
|
|
11797
|
+
kind_other: "Other"
|
|
11798
|
+
},
|
|
11799
|
+
zh: {
|
|
11800
|
+
nav: "世界书",
|
|
11801
|
+
language: "zh",
|
|
11802
|
+
loading: "正在加载世界书…",
|
|
11803
|
+
loadFailed: "无法加载世界书:{message}",
|
|
11804
|
+
empty: "还没有世界书。世界书是任何故事都可以带上的背景知识集合(历史、习俗、地点、传说)。你可以新建一本来填写,或导入酒馆世界书。",
|
|
11805
|
+
countOne: "{count} 本世界书",
|
|
11806
|
+
countOther: "{count} 本世界书",
|
|
11807
|
+
refresh: "刷新",
|
|
11808
|
+
refreshing: "正在刷新…",
|
|
11809
|
+
back: "返回",
|
|
11810
|
+
cancel: "取消",
|
|
11811
|
+
close: "关闭",
|
|
11812
|
+
create: "新建世界书",
|
|
11813
|
+
createTitle: "新建世界书",
|
|
11814
|
+
createHelp: "新世界书一开始是空的。可以自己添加条目,也可以交给助手。",
|
|
11815
|
+
bookName: "名称",
|
|
11816
|
+
bookNameHelp: "字母、数字、“-”和“_”,最长 64 个字符。世界和故事通过这个名称引用世界书。",
|
|
11817
|
+
bookTitle: "标题",
|
|
11818
|
+
bookDescription: "描述",
|
|
11819
|
+
creating: "正在创建…",
|
|
11820
|
+
createFailed: "无法创建世界书:{message}",
|
|
11821
|
+
import: "导入酒馆世界书",
|
|
11822
|
+
importTitle: "导入酒馆世界书",
|
|
11823
|
+
importHelp: "助手会读取 {file}。事实会变成故事中人人皆知的条目,除非条目明确说明只有部分角色知道。给 AI 的指令会被单独保存,变成预设之前会先征求你的同意。",
|
|
11824
|
+
importing: "正在导入…",
|
|
11825
|
+
importFailed: "无法导入世界书:{message}",
|
|
11826
|
+
importNotStarted: "世界书已保存,但助手没能启动:{message}。请打开它的创作聊天继续。",
|
|
11827
|
+
edit: "编辑",
|
|
11828
|
+
author: "用助手编辑",
|
|
11829
|
+
authorFailed: "无法打开创作聊天:{message}",
|
|
11830
|
+
delete: "删除",
|
|
11831
|
+
deleteTitle: "删除世界书",
|
|
11832
|
+
deleteHelp: "删除{name}?已经在使用它的故事会保留各自的副本。该世界书会被移到回收文件夹。",
|
|
11833
|
+
deleting: "正在删除…",
|
|
11834
|
+
deleteFailed: "无法删除世界书:{message}",
|
|
11835
|
+
broken: "无法使用:{problems}",
|
|
11836
|
+
entriesCount: "{count} 个条目",
|
|
11837
|
+
commonCount: "{count} 个人人皆知",
|
|
11838
|
+
info: "概览",
|
|
11839
|
+
infoSave: "保存",
|
|
11840
|
+
infoSaving: "正在保存…",
|
|
11841
|
+
infoSaved: "已保存。",
|
|
11842
|
+
infoFailed: "无法保存:{message}",
|
|
11843
|
+
entries: "条目",
|
|
11844
|
+
entriesHelp: "每条是世界的一个事实,写成说明性文字。故事开始时会带上每个条目;人人皆知的条目每个角色都知道,其余的只有列出的角色知道。",
|
|
11845
|
+
entryPick: "条目",
|
|
11846
|
+
entryNew: "新条目",
|
|
11847
|
+
entryAdd: "新条目",
|
|
11848
|
+
entryId: "编号",
|
|
11849
|
+
entryTitle: "标题",
|
|
11850
|
+
entryKind: "类型",
|
|
11851
|
+
entryScope: "谁知道",
|
|
11852
|
+
entryKnownBy: "知道的人(名字,用逗号分隔)",
|
|
11853
|
+
entrySummary: "摘要(一句话)",
|
|
11854
|
+
entryBody: "正文",
|
|
11855
|
+
entryRelated: "相关条目(编号,用逗号分隔)",
|
|
11856
|
+
entrySave: "保存条目",
|
|
11857
|
+
entrySaving: "正在保存…",
|
|
11858
|
+
entrySaved: "已保存。",
|
|
11859
|
+
entryRemove: "移除此条目",
|
|
11860
|
+
entryFailed: "无法保存条目:{message}",
|
|
11861
|
+
scope_everyone: "所有人",
|
|
11862
|
+
scope_listed: "仅列出的角色",
|
|
11863
|
+
kind_history: "历史",
|
|
11864
|
+
kind_culture: "文化",
|
|
11865
|
+
kind_religion: "宗教",
|
|
11866
|
+
kind_politics: "政治",
|
|
11867
|
+
kind_geography: "地理",
|
|
11868
|
+
kind_science: "科学",
|
|
11869
|
+
kind_custom: "习俗",
|
|
11870
|
+
kind_legend: "传说",
|
|
11871
|
+
kind_other: "其他"
|
|
11872
|
+
}
|
|
11873
|
+
};
|
|
11874
|
+
//#endregion
|
|
11875
|
+
//#region src/client/pages/lorebooks/lorebooks-controller.ts
|
|
11876
|
+
const messageOf$4 = (error) => error instanceof Error ? error.message : String(error);
|
|
11877
|
+
/** Reads the lorebook library from the host and makes, removes and opens its lorebooks. */
|
|
11878
|
+
var LorebooksController = class {
|
|
11879
|
+
openChat;
|
|
11880
|
+
language;
|
|
11881
|
+
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
|
|
11882
|
+
status: "idle",
|
|
11883
|
+
refreshing: false
|
|
11884
|
+
});
|
|
11885
|
+
abort = new AbortController();
|
|
11886
|
+
face = {
|
|
11887
|
+
hooks: { lorebooks: this.store },
|
|
11888
|
+
load: () => {
|
|
11889
|
+
if (this.store.getSnapshot().status === "idle") this.read(false);
|
|
11890
|
+
},
|
|
11891
|
+
refresh: () => {
|
|
11892
|
+
this.read(true);
|
|
11893
|
+
},
|
|
11894
|
+
create: async (name, title, description) => {
|
|
11895
|
+
await createLorebook({
|
|
11896
|
+
name,
|
|
11897
|
+
...title === "" ? {} : { title },
|
|
11898
|
+
...description === "" ? {} : { description }
|
|
11899
|
+
}, this.abort.signal);
|
|
11900
|
+
await this.read(true);
|
|
11901
|
+
},
|
|
11902
|
+
remove: async (name) => {
|
|
11903
|
+
await deleteLorebook(name, this.abort.signal);
|
|
11904
|
+
await this.read(true);
|
|
11905
|
+
},
|
|
11906
|
+
author: async (name) => {
|
|
11907
|
+
this.openChat((await authorLorebook(name, this.language(), this.abort.signal)).chatSessionId);
|
|
11908
|
+
},
|
|
11909
|
+
importFile: async (name, file) => {
|
|
11910
|
+
const opened = await importLorebook(name, file, this.language(), this.abort.signal);
|
|
11911
|
+
await this.read(true);
|
|
11912
|
+
this.openChat(opened.chatSessionId);
|
|
11913
|
+
return {
|
|
11914
|
+
started: opened.started,
|
|
11915
|
+
...opened.failure === void 0 ? {} : { failure: opened.failure }
|
|
11916
|
+
};
|
|
11917
|
+
}
|
|
11918
|
+
};
|
|
11919
|
+
constructor(openChat, language) {
|
|
11920
|
+
this.openChat = openChat;
|
|
11921
|
+
this.language = language;
|
|
11922
|
+
}
|
|
11923
|
+
inject() {
|
|
11924
|
+
return this.face;
|
|
11925
|
+
}
|
|
11926
|
+
dispose() {
|
|
11927
|
+
this.abort.abort();
|
|
11928
|
+
}
|
|
11929
|
+
async read(refreshing) {
|
|
11930
|
+
this.store.update((draft) => {
|
|
11931
|
+
if (refreshing) draft.refreshing = true;
|
|
11932
|
+
else draft.status = "loading";
|
|
11933
|
+
});
|
|
11934
|
+
try {
|
|
11935
|
+
const books = await listLorebooks(this.abort.signal);
|
|
11936
|
+
this.store.update((draft) => {
|
|
11937
|
+
draft.status = "ready";
|
|
11938
|
+
draft.books = books;
|
|
11939
|
+
delete draft.error;
|
|
11940
|
+
});
|
|
11941
|
+
} catch (error) {
|
|
11942
|
+
if (this.abort.signal.aborted) return;
|
|
11943
|
+
this.store.update((draft) => {
|
|
11944
|
+
draft.error = messageOf$4(error);
|
|
11945
|
+
if (draft.books === void 0) draft.status = "failed";
|
|
11946
|
+
});
|
|
11947
|
+
} finally {
|
|
11948
|
+
if (!this.abort.signal.aborted) this.store.update((draft) => {
|
|
11949
|
+
draft.refreshing = false;
|
|
11950
|
+
});
|
|
11951
|
+
}
|
|
11952
|
+
}
|
|
11953
|
+
};
|
|
11954
|
+
//#endregion
|
|
11955
|
+
//#region src/client/pages/lorebooks/index.ts
|
|
11956
|
+
const NAMESPACE$10 = "roleplay.lorebooks";
|
|
11957
|
+
/** Adds the Lorebooks page to the Role Play panel: reusable background knowledge that stories start with. */
|
|
11958
|
+
function registerLorebooksPage(ctx) {
|
|
11959
|
+
const t = ctx.locale.bind(NAMESPACE$10);
|
|
11960
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$10, dictionaries$9), "roleplay: lorebooks dictionaries");
|
|
11961
|
+
const lorebooks = new LorebooksController(createChatOpener(ctx), () => t("language"));
|
|
11962
|
+
ctx.effect(() => () => {
|
|
11963
|
+
lorebooks.dispose();
|
|
11964
|
+
}, "roleplay: lorebooks requests");
|
|
11965
|
+
ctx.slots.inject("roleplay.page", () => ctx.slots.register({
|
|
11966
|
+
name: "roleplay.page",
|
|
11967
|
+
id: "lorebooks",
|
|
11968
|
+
order: 8,
|
|
11969
|
+
label: () => t("nav"),
|
|
11970
|
+
locale: NAMESPACE$10,
|
|
11971
|
+
inject: () => lorebooks.inject()
|
|
11972
|
+
}, LorebooksPage));
|
|
11973
|
+
}
|
|
11974
|
+
//#endregion
|
|
11975
|
+
//#region \0css-module:/home/runner/work/dsh-agentic-roleplay/dsh-agentic-roleplay/packages/dsh-agentic-roleplay-core/src/client/pages/presets/PresetsPage.module.css.mjs
|
|
11976
|
+
const css$18 = ".rp_ZK89ba_page{flex-direction:column;flex:1 1 0;gap:8px;min-height:0;display:flex}.rp_ZK89ba_toolbar{flex:none;justify-content:space-between;align-items:center;gap:12px;min-height:28px;display:flex}.rp_ZK89ba_count{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_ZK89ba_actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.rp_ZK89ba_viewport{flex:1 1 0;min-height:0;padding:4px;overflow-y:auto}.rp_ZK89ba_grid{grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px;margin:0;padding:0;list-style:none;display:grid}.rp_ZK89ba_card{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:8px;min-width:0;padding:12px;display:flex}.rp_ZK89ba_card:hover{border-color:var(--dsw-alias-border-l4)}.rp_ZK89ba_head{flex-direction:column;gap:2px;min-width:0;display:flex}.rp_ZK89ba_title{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;overflow:hidden}.rp_ZK89ba_name{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_ZK89ba_description{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:0;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.rp_ZK89ba_meta{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_ZK89ba_cardActions{flex-wrap:wrap;gap:4px;margin-top:auto;display:flex}.rp_ZK89ba_message{text-align:center;color:var(--dsw-alias-label-secondary);margin:0;padding:40px 0;font-size:13px}.rp_ZK89ba_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px}.rp_ZK89ba_warning{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-error-primary));margin:0;font-size:12px}.rp_ZK89ba_ok{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px}.rp_ZK89ba_editHeader{border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;align-items:center;gap:8px;padding:8px 16px;display:flex}.rp_ZK89ba_editTitle{color:var(--dsw-alias-label-primary);flex:auto;font-size:14px;font-weight:500}.rp_ZK89ba_editBody{flex-direction:column;flex:1 1 0;gap:24px;min-height:0;padding:16px 24px;display:flex;overflow-y:auto}.rp_ZK89ba_section{flex-direction:column;gap:12px;max-width:720px;display:flex}.rp_ZK89ba_sectionTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.rp_ZK89ba_help{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px}.rp_ZK89ba_row{flex-wrap:wrap;gap:12px;display:flex}.rp_ZK89ba_form{flex-direction:column;gap:16px;min-width:min(420px,100%);display:flex}.rp_ZK89ba_field{flex-direction:column;flex:200px;gap:6px;min-width:0;display:flex}.rp_ZK89ba_label{color:var(--dsw-alias-label-tertiary);font-size:12px}.rp_ZK89ba_area{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);width:100%;min-height:280px;font:13px/20px var(--dsw-font-mono,monospace);color:var(--dsw-alias-label-primary);resize:vertical;padding:8px}.rp_ZK89ba_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);width:100%;font:inherit;color:var(--dsw-alias-label-primary);padding:6px 8px;font-size:13px}@media (width<=640px){.rp_ZK89ba_grid{grid-template-columns:1fr}.rp_ZK89ba_form{min-width:0}.rp_ZK89ba_editBody{padding:16px}}";
|
|
11977
|
+
const key$18 = "src/client/pages/presets/PresetsPage.module.css";
|
|
11978
|
+
let tag$18 = document.querySelector("style[data-plugin-css=" + JSON.stringify(key$18) + "]");
|
|
11979
|
+
if (tag$18 === null) {
|
|
11980
|
+
tag$18 = document.createElement("style");
|
|
11981
|
+
tag$18.dataset.plugin = "@dsh-agentic-roleplay/core";
|
|
11982
|
+
tag$18.dataset.pluginCss = key$18;
|
|
11983
|
+
document.head.appendChild(tag$18);
|
|
11984
|
+
}
|
|
11985
|
+
tag$18.textContent = css$18;
|
|
11986
|
+
var PresetsPage_module_css_default = {
|
|
11987
|
+
"row": "rp_ZK89ba_row",
|
|
11988
|
+
"description": "rp_ZK89ba_description",
|
|
11989
|
+
"field": "rp_ZK89ba_field",
|
|
11990
|
+
"name": "rp_ZK89ba_name",
|
|
11991
|
+
"input": "rp_ZK89ba_input",
|
|
11992
|
+
"card": "rp_ZK89ba_card",
|
|
11993
|
+
"warning": "rp_ZK89ba_warning",
|
|
11994
|
+
"help": "rp_ZK89ba_help",
|
|
11995
|
+
"editTitle": "rp_ZK89ba_editTitle",
|
|
11996
|
+
"cardActions": "rp_ZK89ba_cardActions",
|
|
11997
|
+
"meta": "rp_ZK89ba_meta",
|
|
11998
|
+
"toolbar": "rp_ZK89ba_toolbar",
|
|
11999
|
+
"page": "rp_ZK89ba_page",
|
|
12000
|
+
"viewport": "rp_ZK89ba_viewport",
|
|
12001
|
+
"ok": "rp_ZK89ba_ok",
|
|
12002
|
+
"editBody": "rp_ZK89ba_editBody",
|
|
12003
|
+
"actions": "rp_ZK89ba_actions",
|
|
12004
|
+
"area": "rp_ZK89ba_area",
|
|
12005
|
+
"count": "rp_ZK89ba_count",
|
|
12006
|
+
"grid": "rp_ZK89ba_grid",
|
|
12007
|
+
"title": "rp_ZK89ba_title",
|
|
12008
|
+
"sectionTitle": "rp_ZK89ba_sectionTitle",
|
|
12009
|
+
"section": "rp_ZK89ba_section",
|
|
12010
|
+
"error": "rp_ZK89ba_error",
|
|
12011
|
+
"form": "rp_ZK89ba_form",
|
|
12012
|
+
"head": "rp_ZK89ba_head",
|
|
12013
|
+
"editHeader": "rp_ZK89ba_editHeader",
|
|
12014
|
+
"label": "rp_ZK89ba_label",
|
|
12015
|
+
"message": "rp_ZK89ba_message"
|
|
12016
|
+
};
|
|
12017
|
+
//#endregion
|
|
12018
|
+
//#region src/client/pages/presets/PresetEditor.tsx
|
|
12019
|
+
const messageOf$3 = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
12020
|
+
const numberOf = (text) => text.trim() === "" ? void 0 : Number(text);
|
|
12021
|
+
const PROMPT_IDS = [
|
|
12022
|
+
"roleplay/persona",
|
|
12023
|
+
"roleplay/style",
|
|
12024
|
+
"roleplay/character-style"
|
|
12025
|
+
];
|
|
12026
|
+
const PROMPT_LANGUAGES = ["en", "zh"];
|
|
12027
|
+
const promptKey = (path) => ({
|
|
12028
|
+
language: path.slice(0, path.indexOf("/")),
|
|
12029
|
+
id: path.slice(path.indexOf("/") + 1)
|
|
12030
|
+
});
|
|
12031
|
+
const infoOf = (summary) => ({
|
|
12032
|
+
title: summary.title === summary.name ? "" : summary.title,
|
|
12033
|
+
description: summary.description,
|
|
12034
|
+
master: summary.sampling.master?.toString() ?? "",
|
|
12035
|
+
characters: summary.sampling.characters?.toString() ?? ""
|
|
12036
|
+
});
|
|
12037
|
+
/** One library preset: what it says about itself and the text of each prompt it carries; the assistant does the larger rewrites. */
|
|
12038
|
+
function PresetEditor({ t, name, onBack, author }) {
|
|
12039
|
+
const [loaded, setLoaded] = (0, react.useState)();
|
|
12040
|
+
const [failure, setFailure] = (0, react.useState)();
|
|
12041
|
+
const [info, setInfo] = (0, react.useState)();
|
|
12042
|
+
const [infoStatus, setInfoStatus] = (0, react.useState)({ state: "idle" });
|
|
12043
|
+
const [path, setPath] = (0, react.useState)("");
|
|
12044
|
+
const [text, setText] = (0, react.useState)("");
|
|
12045
|
+
const [draft, setDraft] = (0, react.useState)("");
|
|
12046
|
+
const [addition, setAddition] = (0, react.useState)("");
|
|
12047
|
+
const [promptStatus, setPromptStatus] = (0, react.useState)({ state: "idle" });
|
|
12048
|
+
const accept = (value, keep) => {
|
|
12049
|
+
setLoaded(value);
|
|
12050
|
+
setInfo(infoOf(value.summary));
|
|
12051
|
+
setDraft("");
|
|
12052
|
+
const paths = Object.keys(value.prompts).sort();
|
|
12053
|
+
const chosen = keep !== void 0 && paths.includes(keep) ? keep : paths[0] ?? "";
|
|
12054
|
+
setPath(chosen);
|
|
12055
|
+
setText(value.prompts[chosen] ?? "");
|
|
12056
|
+
};
|
|
12057
|
+
(0, react.useEffect)(() => {
|
|
12058
|
+
const abort = new AbortController();
|
|
12059
|
+
readPreset(name, abort.signal).then((value) => {
|
|
12060
|
+
accept(value);
|
|
12061
|
+
}, (problem) => {
|
|
12062
|
+
if (!abort.signal.aborted) setFailure(messageOf$3(problem));
|
|
12063
|
+
});
|
|
12064
|
+
return () => {
|
|
12065
|
+
abort.abort();
|
|
12066
|
+
};
|
|
12067
|
+
}, [name]);
|
|
12068
|
+
if (loaded === void 0 || info === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12069
|
+
className: PresetsPage_module_css_default.message,
|
|
12070
|
+
role: failure === void 0 ? void 0 : "alert",
|
|
12071
|
+
children: failure === void 0 ? t("loading") : t("loadFailed", { message: failure })
|
|
12072
|
+
});
|
|
12073
|
+
const paths = [...Object.keys(loaded.prompts), ...draft === "" ? [] : [draft]].sort();
|
|
12074
|
+
const missing = PROMPT_LANGUAGES.flatMap((language) => PROMPT_IDS.map((id) => `${language}/${id}`)).filter((key) => !paths.includes(key));
|
|
12075
|
+
const saved = infoOf(loaded.summary);
|
|
12076
|
+
const infoDirty = JSON.stringify(info) !== JSON.stringify(saved);
|
|
12077
|
+
const promptDirty = path !== "" && (path === draft || text !== loaded.prompts[path]);
|
|
12078
|
+
const saveInfo = () => {
|
|
12079
|
+
setInfoStatus({ state: "saving" });
|
|
12080
|
+
const sampling = {
|
|
12081
|
+
...numberOf(info.master) === void 0 ? {} : { master: numberOf(info.master) },
|
|
12082
|
+
...numberOf(info.characters) === void 0 ? {} : { characters: numberOf(info.characters) }
|
|
12083
|
+
};
|
|
12084
|
+
updatePresetInfo(name, {
|
|
12085
|
+
title: info.title,
|
|
12086
|
+
description: info.description,
|
|
12087
|
+
sampling
|
|
12088
|
+
}, new AbortController().signal).then((summary) => {
|
|
12089
|
+
setLoaded({
|
|
12090
|
+
...loaded,
|
|
12091
|
+
summary
|
|
12092
|
+
});
|
|
12093
|
+
setInfo(infoOf(summary));
|
|
12094
|
+
setInfoStatus({ state: "saved" });
|
|
12095
|
+
}, (problem) => {
|
|
12096
|
+
setInfoStatus({
|
|
12097
|
+
state: "failed",
|
|
12098
|
+
message: messageOf$3(problem)
|
|
12099
|
+
});
|
|
12100
|
+
});
|
|
12101
|
+
};
|
|
12102
|
+
const afterPrompt = (summary, prompts, keep) => {
|
|
12103
|
+
accept({
|
|
12104
|
+
summary,
|
|
12105
|
+
prompts
|
|
12106
|
+
}, keep);
|
|
12107
|
+
};
|
|
12108
|
+
const savePrompt = () => {
|
|
12109
|
+
const { language, id } = promptKey(path);
|
|
12110
|
+
setPromptStatus({ state: "saving" });
|
|
12111
|
+
writePresetPrompt(name, language, id, text, new AbortController().signal).then((summary) => {
|
|
12112
|
+
afterPrompt(summary, {
|
|
12113
|
+
...loaded.prompts,
|
|
12114
|
+
[path]: text.endsWith("\n") ? text : `${text}\n`
|
|
12115
|
+
}, path);
|
|
12116
|
+
setPromptStatus({ state: "saved" });
|
|
12117
|
+
}, (problem) => {
|
|
12118
|
+
setPromptStatus({
|
|
12119
|
+
state: "failed",
|
|
12120
|
+
message: messageOf$3(problem)
|
|
12121
|
+
});
|
|
12122
|
+
});
|
|
12123
|
+
};
|
|
12124
|
+
const removePrompt = () => {
|
|
12125
|
+
if (path === draft) {
|
|
12126
|
+
setDraft("");
|
|
12127
|
+
const rest = Object.keys(loaded.prompts).sort();
|
|
12128
|
+
setPath(rest[0] ?? "");
|
|
12129
|
+
setText(loaded.prompts[rest[0] ?? ""] ?? "");
|
|
12130
|
+
setPromptStatus({ state: "idle" });
|
|
12131
|
+
return;
|
|
12132
|
+
}
|
|
12133
|
+
const { language, id } = promptKey(path);
|
|
12134
|
+
setPromptStatus({ state: "saving" });
|
|
12135
|
+
removePresetPrompt(name, language, id, new AbortController().signal).then((summary) => {
|
|
12136
|
+
const rest = { ...loaded.prompts };
|
|
12137
|
+
delete rest[path];
|
|
12138
|
+
afterPrompt(summary, rest);
|
|
12139
|
+
setPromptStatus({ state: "idle" });
|
|
12140
|
+
}, (problem) => {
|
|
12141
|
+
setPromptStatus({
|
|
12142
|
+
state: "failed",
|
|
12143
|
+
message: messageOf$3(problem)
|
|
12144
|
+
});
|
|
12145
|
+
});
|
|
12146
|
+
};
|
|
12147
|
+
const label = (key) => {
|
|
12148
|
+
const { language, id } = promptKey(key);
|
|
12149
|
+
return `${language} · ${PROMPT_IDS.includes(id) ? t(`prompt_${id}`) : id}`;
|
|
12150
|
+
};
|
|
12151
|
+
const field = (key, caption, options = {}) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12152
|
+
className: PresetsPage_module_css_default.field,
|
|
12153
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12154
|
+
className: PresetsPage_module_css_default.label,
|
|
12155
|
+
children: t(caption)
|
|
12156
|
+
}), options.rows === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
12157
|
+
className: PresetsPage_module_css_default.input,
|
|
12158
|
+
value: info[key],
|
|
12159
|
+
inputMode: options.number === true ? "decimal" : void 0,
|
|
12160
|
+
onChange: (event) => {
|
|
12161
|
+
setInfo({
|
|
12162
|
+
...info,
|
|
12163
|
+
[key]: event.target.value
|
|
12164
|
+
});
|
|
12165
|
+
setInfoStatus({ state: "idle" });
|
|
12166
|
+
}
|
|
12167
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
12168
|
+
className: PresetsPage_module_css_default.input,
|
|
12169
|
+
rows: options.rows,
|
|
12170
|
+
value: info[key],
|
|
12171
|
+
onChange: (event) => {
|
|
12172
|
+
setInfo({
|
|
12173
|
+
...info,
|
|
12174
|
+
[key]: event.target.value
|
|
12175
|
+
});
|
|
12176
|
+
setInfoStatus({ state: "idle" });
|
|
12177
|
+
}
|
|
12178
|
+
})]
|
|
12179
|
+
});
|
|
12180
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12181
|
+
className: PresetsPage_module_css_default.page,
|
|
12182
|
+
"data-testid": "roleplay-preset-editor",
|
|
12183
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12184
|
+
className: PresetsPage_module_css_default.editHeader,
|
|
12185
|
+
children: [
|
|
12186
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12187
|
+
variant: "ghost",
|
|
12188
|
+
size: "sm",
|
|
12189
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronLeftOutlineRegular, {}),
|
|
12190
|
+
onClick: onBack,
|
|
12191
|
+
children: t("back")
|
|
12192
|
+
}),
|
|
12193
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12194
|
+
className: PresetsPage_module_css_default.editTitle,
|
|
12195
|
+
children: loaded.summary.title
|
|
12196
|
+
}),
|
|
12197
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12198
|
+
variant: "primary",
|
|
12199
|
+
size: "sm",
|
|
12200
|
+
onClick: author,
|
|
12201
|
+
children: t("author")
|
|
12202
|
+
})
|
|
12203
|
+
]
|
|
12204
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12205
|
+
className: PresetsPage_module_css_default.editBody,
|
|
12206
|
+
children: [
|
|
12207
|
+
loaded.summary.problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12208
|
+
className: PresetsPage_module_css_default.error,
|
|
12209
|
+
role: "alert",
|
|
12210
|
+
children: t("broken", { problems: loaded.summary.problems.join("; ") })
|
|
12211
|
+
}),
|
|
12212
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
12213
|
+
className: PresetsPage_module_css_default.section,
|
|
12214
|
+
children: [
|
|
12215
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
12216
|
+
className: PresetsPage_module_css_default.sectionTitle,
|
|
12217
|
+
children: t("info")
|
|
12218
|
+
}),
|
|
12219
|
+
field("title", "presetTitle"),
|
|
12220
|
+
field("description", "presetDescription", { rows: 3 }),
|
|
12221
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12222
|
+
className: PresetsPage_module_css_default.row,
|
|
12223
|
+
children: [field("master", "samplingMaster", { number: true }), field("characters", "samplingCharacters", { number: true })]
|
|
12224
|
+
}),
|
|
12225
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12226
|
+
className: PresetsPage_module_css_default.help,
|
|
12227
|
+
children: t("samplingHelp")
|
|
12228
|
+
}),
|
|
12229
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12230
|
+
className: PresetsPage_module_css_default.actions,
|
|
12231
|
+
children: [
|
|
12232
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12233
|
+
variant: "primary",
|
|
12234
|
+
size: "sm",
|
|
12235
|
+
disabled: !infoDirty || infoStatus.state === "saving",
|
|
12236
|
+
onClick: saveInfo,
|
|
12237
|
+
children: infoStatus.state === "saving" ? t("infoSaving") : t("infoSave")
|
|
12238
|
+
}),
|
|
12239
|
+
infoStatus.state === "saved" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12240
|
+
className: PresetsPage_module_css_default.ok,
|
|
12241
|
+
role: "status",
|
|
12242
|
+
children: t("infoSaved")
|
|
12243
|
+
}),
|
|
12244
|
+
infoStatus.state === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12245
|
+
className: PresetsPage_module_css_default.error,
|
|
12246
|
+
role: "alert",
|
|
12247
|
+
children: t("infoFailed", { message: infoStatus.message ?? "" })
|
|
12248
|
+
})
|
|
12249
|
+
]
|
|
12250
|
+
})
|
|
12251
|
+
]
|
|
12252
|
+
}),
|
|
12253
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
12254
|
+
className: PresetsPage_module_css_default.section,
|
|
12255
|
+
children: [
|
|
12256
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
12257
|
+
className: PresetsPage_module_css_default.sectionTitle,
|
|
12258
|
+
children: t("prompts")
|
|
12259
|
+
}),
|
|
12260
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12261
|
+
className: PresetsPage_module_css_default.help,
|
|
12262
|
+
children: t("promptsHelp")
|
|
12263
|
+
}),
|
|
12264
|
+
loaded.summary.rules.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12265
|
+
className: PresetsPage_module_css_default.warning,
|
|
12266
|
+
role: "note",
|
|
12267
|
+
children: t("rulesWarning", { list: loaded.summary.rules.join(", ") })
|
|
12268
|
+
}),
|
|
12269
|
+
paths.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12270
|
+
className: PresetsPage_module_css_default.message,
|
|
12271
|
+
children: t("promptsNone")
|
|
12272
|
+
}),
|
|
12273
|
+
paths.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12274
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12275
|
+
className: PresetsPage_module_css_default.field,
|
|
12276
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12277
|
+
className: PresetsPage_module_css_default.label,
|
|
12278
|
+
children: t("promptPick")
|
|
12279
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
12280
|
+
value: path,
|
|
12281
|
+
"data-testid": "roleplay-preset-prompt",
|
|
12282
|
+
onChange: (event) => {
|
|
12283
|
+
setPath(event.target.value);
|
|
12284
|
+
setText(loaded.prompts[event.target.value] ?? "");
|
|
12285
|
+
setPromptStatus({ state: "idle" });
|
|
12286
|
+
},
|
|
12287
|
+
children: paths.map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
12288
|
+
value: key,
|
|
12289
|
+
children: label(key)
|
|
12290
|
+
}, key))
|
|
12291
|
+
})]
|
|
12292
|
+
}),
|
|
12293
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
12294
|
+
className: PresetsPage_module_css_default.area,
|
|
12295
|
+
value: text,
|
|
12296
|
+
"aria-label": t("promptPick"),
|
|
12297
|
+
onChange: (event) => {
|
|
12298
|
+
setText(event.target.value);
|
|
12299
|
+
setPromptStatus({ state: "idle" });
|
|
12300
|
+
}
|
|
12301
|
+
}),
|
|
12302
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12303
|
+
className: PresetsPage_module_css_default.actions,
|
|
12304
|
+
children: [
|
|
12305
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12306
|
+
variant: "primary",
|
|
12307
|
+
size: "sm",
|
|
12308
|
+
disabled: !promptDirty || promptStatus.state === "saving" || text.trim() === "",
|
|
12309
|
+
onClick: savePrompt,
|
|
12310
|
+
children: promptStatus.state === "saving" ? t("promptSaving") : t("promptSave")
|
|
12311
|
+
}),
|
|
12312
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12313
|
+
variant: "ghost",
|
|
12314
|
+
size: "sm",
|
|
12315
|
+
disabled: !promptDirty,
|
|
12316
|
+
onClick: () => {
|
|
12317
|
+
setText(loaded.prompts[path] ?? "");
|
|
12318
|
+
},
|
|
12319
|
+
children: t("promptReset")
|
|
12320
|
+
}),
|
|
12321
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12322
|
+
variant: "ghost",
|
|
12323
|
+
size: "sm",
|
|
12324
|
+
disabled: promptStatus.state === "saving",
|
|
12325
|
+
onClick: removePrompt,
|
|
12326
|
+
children: t("promptRemove")
|
|
12327
|
+
}),
|
|
12328
|
+
promptStatus.state === "saved" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12329
|
+
className: PresetsPage_module_css_default.ok,
|
|
12330
|
+
role: "status",
|
|
12331
|
+
children: t("promptSaved")
|
|
12332
|
+
}),
|
|
12333
|
+
promptStatus.state === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12334
|
+
className: PresetsPage_module_css_default.error,
|
|
12335
|
+
role: "alert",
|
|
12336
|
+
children: t("promptFailed", { message: promptStatus.message ?? "" })
|
|
12337
|
+
})
|
|
12338
|
+
]
|
|
12339
|
+
})
|
|
12340
|
+
] }),
|
|
12341
|
+
missing.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12342
|
+
className: PresetsPage_module_css_default.actions,
|
|
12343
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
12344
|
+
value: addition,
|
|
12345
|
+
"aria-label": t("promptAdd"),
|
|
12346
|
+
"data-testid": "roleplay-preset-prompt-add",
|
|
12347
|
+
onChange: (event) => {
|
|
12348
|
+
setAddition(event.target.value);
|
|
12349
|
+
},
|
|
12350
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
12351
|
+
value: "",
|
|
12352
|
+
children: t("promptAdd")
|
|
12353
|
+
}), missing.map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
12354
|
+
value: key,
|
|
12355
|
+
children: label(key)
|
|
12356
|
+
}, key))]
|
|
12357
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12358
|
+
variant: "ghost",
|
|
12359
|
+
size: "sm",
|
|
12360
|
+
disabled: addition === "",
|
|
12361
|
+
onClick: () => {
|
|
12362
|
+
setDraft(addition);
|
|
12363
|
+
setPath(addition);
|
|
12364
|
+
setText("");
|
|
12365
|
+
setAddition("");
|
|
12366
|
+
setPromptStatus({ state: "idle" });
|
|
12367
|
+
},
|
|
12368
|
+
children: t("promptAddButton")
|
|
12369
|
+
})]
|
|
12370
|
+
})
|
|
12371
|
+
]
|
|
12372
|
+
})
|
|
12373
|
+
]
|
|
12374
|
+
})]
|
|
12375
|
+
});
|
|
12376
|
+
}
|
|
12377
|
+
//#endregion
|
|
12378
|
+
//#region src/client/pages/presets/PresetsPage.tsx
|
|
12379
|
+
const NAME = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
12380
|
+
const messageOf$2 = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
12381
|
+
const nameFromFile = (file) => file.replace(/\.[^.]*$/, "").replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^[-_]+|[-_]+$/g, "").slice(0, 64);
|
|
12382
|
+
function NameDialog({ t, mode, file, submit, onClose }) {
|
|
12383
|
+
const formId = (0, react.useId)();
|
|
12384
|
+
const [name, setName] = (0, react.useState)(file === void 0 ? "" : nameFromFile(file));
|
|
12385
|
+
const [title, setTitle] = (0, react.useState)("");
|
|
12386
|
+
const [description, setDescription] = (0, react.useState)("");
|
|
12387
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
12388
|
+
const [error, setError] = (0, react.useState)();
|
|
12389
|
+
const go = () => {
|
|
12390
|
+
if (!NAME.test(name) || busy) return;
|
|
12391
|
+
setBusy(true);
|
|
12392
|
+
setError(void 0);
|
|
12393
|
+
submit(name, title.trim(), description.trim()).then(onClose, (failure) => {
|
|
12394
|
+
setBusy(false);
|
|
12395
|
+
setError(messageOf$2(failure));
|
|
12396
|
+
});
|
|
12397
|
+
};
|
|
12398
|
+
const importing = mode === "import";
|
|
12399
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
12400
|
+
open: true,
|
|
12401
|
+
onClose,
|
|
12402
|
+
title: importing ? t("importTitle") : t("createTitle"),
|
|
12403
|
+
description: importing ? t("importHelp", { file: file ?? "" }) : t("createHelp"),
|
|
12404
|
+
closeLabel: t("close"),
|
|
12405
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12406
|
+
variant: "ghost",
|
|
12407
|
+
disabled: busy,
|
|
12408
|
+
onClick: onClose,
|
|
12409
|
+
children: t("cancel")
|
|
12410
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12411
|
+
variant: "primary",
|
|
12412
|
+
type: "submit",
|
|
12413
|
+
form: formId,
|
|
12414
|
+
disabled: busy || !NAME.test(name),
|
|
12415
|
+
children: importing ? busy ? t("importing") : t("import") : busy ? t("creating") : t("create")
|
|
12416
|
+
})] }),
|
|
12417
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
12418
|
+
id: formId,
|
|
12419
|
+
className: PresetsPage_module_css_default.form,
|
|
12420
|
+
onSubmit: (event) => {
|
|
12421
|
+
event.preventDefault();
|
|
12422
|
+
go();
|
|
12423
|
+
},
|
|
12424
|
+
children: [
|
|
12425
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12426
|
+
className: PresetsPage_module_css_default.field,
|
|
12427
|
+
children: [
|
|
12428
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12429
|
+
className: PresetsPage_module_css_default.label,
|
|
12430
|
+
children: t("presetName")
|
|
12431
|
+
}),
|
|
12432
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
12433
|
+
value: name,
|
|
12434
|
+
maxLength: 64,
|
|
12435
|
+
"data-modal-autofocus": true,
|
|
12436
|
+
onChange: (event) => {
|
|
12437
|
+
setName(event.target.value);
|
|
12438
|
+
}
|
|
12439
|
+
}),
|
|
12440
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12441
|
+
className: PresetsPage_module_css_default.help,
|
|
12442
|
+
children: t("presetNameHelp")
|
|
12443
|
+
})
|
|
12444
|
+
]
|
|
12445
|
+
}),
|
|
12446
|
+
!importing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12447
|
+
className: PresetsPage_module_css_default.field,
|
|
12448
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12449
|
+
className: PresetsPage_module_css_default.label,
|
|
12450
|
+
children: t("presetTitle")
|
|
12451
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
12452
|
+
value: title,
|
|
12453
|
+
maxLength: 300,
|
|
12454
|
+
onChange: (event) => {
|
|
12455
|
+
setTitle(event.target.value);
|
|
12456
|
+
}
|
|
12457
|
+
})]
|
|
12458
|
+
}),
|
|
12459
|
+
!importing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12460
|
+
className: PresetsPage_module_css_default.field,
|
|
12461
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12462
|
+
className: PresetsPage_module_css_default.label,
|
|
12463
|
+
children: t("presetDescription")
|
|
12464
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
12465
|
+
value: description,
|
|
12466
|
+
maxLength: 300,
|
|
12467
|
+
onChange: (event) => {
|
|
12468
|
+
setDescription(event.target.value);
|
|
12469
|
+
}
|
|
12470
|
+
})]
|
|
12471
|
+
}),
|
|
12472
|
+
error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12473
|
+
className: PresetsPage_module_css_default.error,
|
|
12474
|
+
role: "alert",
|
|
12475
|
+
children: importing ? t("importFailed", { message: error }) : t("createFailed", { message: error })
|
|
12476
|
+
})
|
|
12477
|
+
]
|
|
12478
|
+
})
|
|
12479
|
+
});
|
|
12480
|
+
}
|
|
12481
|
+
function DeleteDialog({ t, preset, remove, onClose }) {
|
|
12482
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
12483
|
+
const [error, setError] = (0, react.useState)();
|
|
12484
|
+
const confirm = () => {
|
|
12485
|
+
setBusy(true);
|
|
12486
|
+
setError(void 0);
|
|
12487
|
+
remove(preset.name).then(onClose, (failure) => {
|
|
12488
|
+
setBusy(false);
|
|
12489
|
+
setError(messageOf$2(failure));
|
|
12490
|
+
});
|
|
12491
|
+
};
|
|
12492
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
12493
|
+
open: true,
|
|
12494
|
+
onClose,
|
|
12495
|
+
title: t("deleteTitle"),
|
|
12496
|
+
description: t("deleteHelp", { name: preset.title }),
|
|
12497
|
+
closeLabel: t("close"),
|
|
12498
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12499
|
+
variant: "ghost",
|
|
12500
|
+
disabled: busy,
|
|
12501
|
+
onClick: onClose,
|
|
12502
|
+
children: t("cancel")
|
|
12503
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12504
|
+
variant: "primary",
|
|
12505
|
+
disabled: busy,
|
|
12506
|
+
onClick: confirm,
|
|
12507
|
+
children: busy ? t("deleting") : t("delete")
|
|
12508
|
+
})] }),
|
|
12509
|
+
children: error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12510
|
+
className: PresetsPage_module_css_default.error,
|
|
12511
|
+
role: "alert",
|
|
12512
|
+
children: t("deleteFailed", { message: error })
|
|
12513
|
+
})
|
|
12514
|
+
});
|
|
12515
|
+
}
|
|
12516
|
+
/** The preset library: reusable writing instructions that a story copies when it starts. */
|
|
12517
|
+
function PresetsPage({ t, usePresets, load, refresh, create, remove, author, importFile }) {
|
|
12518
|
+
const state = usePresets((snapshot) => snapshot);
|
|
12519
|
+
const [editing, setEditing] = (0, react.useState)();
|
|
12520
|
+
const [creating, setCreating] = (0, react.useState)(false);
|
|
12521
|
+
const [deleting, setDeleting] = (0, react.useState)();
|
|
12522
|
+
const [uploaded, setUploaded] = (0, react.useState)();
|
|
12523
|
+
const [notice, setNotice] = (0, react.useState)();
|
|
12524
|
+
const picker = (0, react.useRef)(null);
|
|
12525
|
+
(0, react.useEffect)(() => {
|
|
12526
|
+
load();
|
|
12527
|
+
}, [load]);
|
|
12528
|
+
const open = (name) => {
|
|
12529
|
+
setNotice(void 0);
|
|
12530
|
+
author(name).catch((failure) => {
|
|
12531
|
+
setNotice(t("authorFailed", { message: messageOf$2(failure) }));
|
|
12532
|
+
});
|
|
12533
|
+
};
|
|
12534
|
+
if (editing !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PresetEditor, {
|
|
12535
|
+
t,
|
|
12536
|
+
name: editing,
|
|
12537
|
+
onBack: () => {
|
|
12538
|
+
setEditing(void 0);
|
|
12539
|
+
refresh();
|
|
12540
|
+
},
|
|
12541
|
+
author: () => {
|
|
12542
|
+
open(editing);
|
|
12543
|
+
}
|
|
12544
|
+
});
|
|
12545
|
+
const presets = state.presets ?? [];
|
|
12546
|
+
const failedWithoutData = state.status === "failed" && state.presets === void 0;
|
|
12547
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12548
|
+
className: PresetsPage_module_css_default.page,
|
|
12549
|
+
"data-testid": "roleplay-presets-page",
|
|
12550
|
+
children: [
|
|
12551
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12552
|
+
className: PresetsPage_module_css_default.toolbar,
|
|
12553
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12554
|
+
className: PresetsPage_module_css_default.count,
|
|
12555
|
+
children: state.presets === void 0 ? "" : t(presets.length === 1 ? "countOne" : "countOther", { count: presets.length })
|
|
12556
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12557
|
+
className: PresetsPage_module_css_default.actions,
|
|
12558
|
+
children: [
|
|
12559
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
12560
|
+
ref: picker,
|
|
12561
|
+
type: "file",
|
|
12562
|
+
accept: ".json,application/json",
|
|
12563
|
+
hidden: true,
|
|
12564
|
+
"data-testid": "roleplay-preset-file",
|
|
12565
|
+
onChange: (event) => {
|
|
12566
|
+
setUploaded(event.target.files?.[0]);
|
|
12567
|
+
event.target.value = "";
|
|
12568
|
+
}
|
|
12569
|
+
}),
|
|
12570
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12571
|
+
variant: "outline",
|
|
12572
|
+
size: "sm",
|
|
12573
|
+
onClick: () => {
|
|
12574
|
+
picker.current?.click();
|
|
12575
|
+
},
|
|
12576
|
+
children: t("import")
|
|
12577
|
+
}),
|
|
12578
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12579
|
+
variant: "primary",
|
|
12580
|
+
size: "sm",
|
|
12581
|
+
onClick: () => {
|
|
12582
|
+
setCreating(true);
|
|
12583
|
+
},
|
|
12584
|
+
children: t("create")
|
|
12585
|
+
}),
|
|
12586
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12587
|
+
variant: "outline",
|
|
12588
|
+
size: "sm",
|
|
12589
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, {}),
|
|
12590
|
+
disabled: state.refreshing || state.status === "loading",
|
|
12591
|
+
"aria-busy": state.refreshing,
|
|
12592
|
+
onClick: refresh,
|
|
12593
|
+
children: state.refreshing ? t("refreshing") : t("refresh")
|
|
12594
|
+
})
|
|
12595
|
+
]
|
|
12596
|
+
})]
|
|
12597
|
+
}),
|
|
12598
|
+
state.error !== void 0 && !failedWithoutData && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12599
|
+
className: PresetsPage_module_css_default.error,
|
|
12600
|
+
role: "alert",
|
|
12601
|
+
children: t("loadFailed", { message: state.error })
|
|
12602
|
+
}),
|
|
12603
|
+
notice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12604
|
+
className: PresetsPage_module_css_default.error,
|
|
12605
|
+
role: "alert",
|
|
12606
|
+
children: notice
|
|
12607
|
+
}),
|
|
12608
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12609
|
+
className: PresetsPage_module_css_default.viewport,
|
|
12610
|
+
children: state.status === "idle" || state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12611
|
+
className: PresetsPage_module_css_default.message,
|
|
12612
|
+
children: t("loading")
|
|
12613
|
+
}) : failedWithoutData ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12614
|
+
className: PresetsPage_module_css_default.error,
|
|
12615
|
+
role: "alert",
|
|
12616
|
+
children: t("loadFailed", { message: state.error ?? "" })
|
|
12617
|
+
}) : presets.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12618
|
+
className: PresetsPage_module_css_default.message,
|
|
12619
|
+
children: t("empty")
|
|
12620
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
12621
|
+
className: PresetsPage_module_css_default.grid,
|
|
12622
|
+
children: presets.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
12623
|
+
className: PresetsPage_module_css_default.card,
|
|
12624
|
+
"data-testid": "roleplay-preset-card",
|
|
12625
|
+
children: [
|
|
12626
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12627
|
+
className: PresetsPage_module_css_default.head,
|
|
12628
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12629
|
+
className: PresetsPage_module_css_default.title,
|
|
12630
|
+
children: preset.title
|
|
12631
|
+
}), preset.title !== preset.name && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12632
|
+
className: PresetsPage_module_css_default.name,
|
|
12633
|
+
children: preset.name
|
|
12634
|
+
})]
|
|
12635
|
+
}),
|
|
12636
|
+
preset.description !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12637
|
+
className: PresetsPage_module_css_default.description,
|
|
12638
|
+
children: preset.description
|
|
12639
|
+
}),
|
|
12640
|
+
preset.problems.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12641
|
+
className: PresetsPage_module_css_default.error,
|
|
12642
|
+
children: t("broken", { problems: preset.problems.join("; ") })
|
|
12643
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12644
|
+
className: PresetsPage_module_css_default.meta,
|
|
12645
|
+
children: [t("languages", { list: preset.languages.join(", ") }), t("promptsCount", { count: preset.prompts.length })].join(" · ")
|
|
12646
|
+
}),
|
|
12647
|
+
preset.rules.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12648
|
+
className: PresetsPage_module_css_default.warning,
|
|
12649
|
+
role: "note",
|
|
12650
|
+
children: t("rulesWarning", { list: preset.rules.join(", ") })
|
|
12651
|
+
}),
|
|
12652
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12653
|
+
className: PresetsPage_module_css_default.cardActions,
|
|
12654
|
+
children: [
|
|
12655
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12656
|
+
variant: "outline",
|
|
12657
|
+
size: "sm",
|
|
12658
|
+
onClick: () => {
|
|
12659
|
+
setEditing(preset.name);
|
|
12660
|
+
},
|
|
12661
|
+
children: t("edit")
|
|
12662
|
+
}),
|
|
12663
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12664
|
+
variant: "outline",
|
|
12665
|
+
size: "sm",
|
|
12666
|
+
onClick: () => {
|
|
12667
|
+
open(preset.name);
|
|
12668
|
+
},
|
|
12669
|
+
children: t("author")
|
|
12670
|
+
}),
|
|
12671
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
12672
|
+
variant: "ghost",
|
|
12673
|
+
size: "sm",
|
|
12674
|
+
onClick: () => {
|
|
12675
|
+
setDeleting(preset);
|
|
12676
|
+
},
|
|
12677
|
+
children: t("delete")
|
|
12678
|
+
})
|
|
12679
|
+
]
|
|
12680
|
+
})
|
|
12681
|
+
]
|
|
12682
|
+
}, preset.name))
|
|
12683
|
+
})
|
|
12684
|
+
}),
|
|
12685
|
+
creating && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NameDialog, {
|
|
12686
|
+
t,
|
|
12687
|
+
mode: "create",
|
|
12688
|
+
submit: create,
|
|
12689
|
+
onClose: () => {
|
|
12690
|
+
setCreating(false);
|
|
12691
|
+
}
|
|
12692
|
+
}),
|
|
12693
|
+
uploaded !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NameDialog, {
|
|
12694
|
+
t,
|
|
12695
|
+
mode: "import",
|
|
12696
|
+
file: uploaded.name,
|
|
12697
|
+
submit: async (name) => {
|
|
12698
|
+
const result = await importFile(name, uploaded);
|
|
12699
|
+
if (!result.started) setNotice(t("importNotStarted", { message: result.failure ?? "" }));
|
|
12700
|
+
},
|
|
12701
|
+
onClose: () => {
|
|
12702
|
+
setUploaded(void 0);
|
|
12703
|
+
}
|
|
12704
|
+
}),
|
|
12705
|
+
deleting !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteDialog, {
|
|
12706
|
+
t,
|
|
12707
|
+
preset: deleting,
|
|
12708
|
+
remove,
|
|
12709
|
+
onClose: () => {
|
|
12710
|
+
setDeleting(void 0);
|
|
12711
|
+
}
|
|
12712
|
+
})
|
|
12713
|
+
]
|
|
12714
|
+
});
|
|
12715
|
+
}
|
|
12716
|
+
//#endregion
|
|
12717
|
+
//#region src/client/pages/presets/locales.ts
|
|
12718
|
+
const dictionaries$8 = {
|
|
10431
12719
|
en: {
|
|
10432
|
-
nav: "
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
12720
|
+
nav: "Presets",
|
|
12721
|
+
language: "en",
|
|
12722
|
+
loading: "Loading presets…",
|
|
12723
|
+
loadFailed: "Could not load the presets: {message}",
|
|
12724
|
+
empty: "No presets yet. A preset is a set of writing instructions (the narrator, the narration style, how characters speak) that you can put into any story. Make one to edit, import a SillyTavern preset, or save a world's own prompts as one.",
|
|
12725
|
+
countOne: "{count} preset",
|
|
12726
|
+
countOther: "{count} presets",
|
|
12727
|
+
refresh: "Refresh",
|
|
12728
|
+
refreshing: "Refreshing…",
|
|
12729
|
+
back: "Back",
|
|
12730
|
+
cancel: "Cancel",
|
|
12731
|
+
close: "Close",
|
|
12732
|
+
create: "New preset",
|
|
12733
|
+
createTitle: "New preset",
|
|
12734
|
+
createHelp: "The new preset starts with the shipped narration prompts, which you can then rewrite yourself or with the assistant.",
|
|
12735
|
+
presetName: "Name",
|
|
12736
|
+
presetNameHelp: "Letters, digits, \"-\" and \"_\", up to 64. Worlds and sessions refer to the preset by this name.",
|
|
12737
|
+
presetTitle: "Title",
|
|
12738
|
+
presetDescription: "Description",
|
|
12739
|
+
creating: "Creating…",
|
|
12740
|
+
createFailed: "Could not create the preset: {message}",
|
|
12741
|
+
import: "Import SillyTavern preset",
|
|
12742
|
+
importTitle: "Import a SillyTavern preset",
|
|
12743
|
+
importHelp: "The assistant reads {file} and writes the parts that are about how to narrate into a new preset: the narrator, the style, how characters speak. Rules of the game, formats and scripts are not carried over.",
|
|
12744
|
+
importing: "Importing…",
|
|
12745
|
+
importFailed: "Could not import the preset: {message}",
|
|
12746
|
+
importNotStarted: "The preset was kept, but the assistant could not be started: {message}. Open its authoring chat to continue.",
|
|
12747
|
+
edit: "Edit",
|
|
12748
|
+
author: "Edit with assistant",
|
|
12749
|
+
authorFailed: "Could not open the authoring chat: {message}",
|
|
12750
|
+
delete: "Delete",
|
|
12751
|
+
deleteTitle: "Delete preset",
|
|
12752
|
+
deleteHelp: "Delete {name}? Stories that already use it keep their own copy. The preset is moved to the trash folder.",
|
|
12753
|
+
deleting: "Deleting…",
|
|
12754
|
+
deleteFailed: "Could not delete the preset: {message}",
|
|
12755
|
+
broken: "Cannot be used: {problems}",
|
|
12756
|
+
languages: "Languages: {list}",
|
|
12757
|
+
promptsCount: "{count} prompts",
|
|
12758
|
+
info: "About",
|
|
12759
|
+
infoSave: "Save",
|
|
12760
|
+
infoSaving: "Saving…",
|
|
12761
|
+
infoSaved: "Saved.",
|
|
12762
|
+
infoFailed: "Could not save: {message}",
|
|
12763
|
+
samplingMaster: "Narrator temperature",
|
|
12764
|
+
samplingCharacters: "Characters temperature",
|
|
12765
|
+
samplingHelp: "Suggested only: a story's own settings win. Leave empty to suggest nothing; 0 to 2.",
|
|
12766
|
+
prompts: "Prompts",
|
|
12767
|
+
promptsHelp: "The text a story gets when it starts with this preset. ${name} marks a value the program fills in. A prompt or language the preset lacks can be added below; the assistant can also write it.",
|
|
12768
|
+
promptsNone: "This preset carries no prompts yet.",
|
|
12769
|
+
promptPick: "Prompt",
|
|
12770
|
+
promptSave: "Save prompt",
|
|
12771
|
+
promptSaving: "Saving…",
|
|
12772
|
+
promptSaved: "Saved.",
|
|
12773
|
+
promptRemove: "Remove this prompt",
|
|
12774
|
+
promptFailed: "Could not save the prompt: {message}",
|
|
12775
|
+
promptReset: "Discard changes",
|
|
12776
|
+
missing: "This preset is no longer there.",
|
|
12777
|
+
promptAdd: "Add a prompt…",
|
|
12778
|
+
promptAddButton: "Add",
|
|
12779
|
+
rulesWarning: "Warning: this preset carries prompts that hold rules of the game ({list}). They change how the models are told to run the story, not only how it reads, and a wrong change can break it.",
|
|
12780
|
+
"prompt_roleplay/persona": "Persona",
|
|
12781
|
+
"prompt_roleplay/style": "Narration style",
|
|
12782
|
+
"prompt_roleplay/character-style": "Character style"
|
|
10456
12783
|
},
|
|
10457
12784
|
zh: {
|
|
10458
|
-
nav: "
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
12785
|
+
nav: "预设",
|
|
12786
|
+
language: "zh",
|
|
12787
|
+
loading: "正在加载预设…",
|
|
12788
|
+
loadFailed: "无法加载预设:{message}",
|
|
12789
|
+
empty: "还没有预设。预设是一组可放进任何故事的写作指令(叙述者、叙述文风、角色怎样说话)。你可以新建一个来编辑,导入酒馆预设,或把世界自带的提示词存成预设。",
|
|
12790
|
+
countOne: "{count} 个预设",
|
|
12791
|
+
countOther: "{count} 个预设",
|
|
12792
|
+
refresh: "刷新",
|
|
12793
|
+
refreshing: "正在刷新…",
|
|
12794
|
+
back: "返回",
|
|
12795
|
+
cancel: "取消",
|
|
12796
|
+
close: "关闭",
|
|
12797
|
+
create: "新建预设",
|
|
12798
|
+
createTitle: "新建预设",
|
|
12799
|
+
createHelp: "新预设以内置的叙述提示词为起点,之后可以自己改写,也可以交给助手改写。",
|
|
12800
|
+
presetName: "名称",
|
|
12801
|
+
presetNameHelp: "字母、数字、“-”和“_”,最长 64 个字符。世界和存档通过这个名称引用预设。",
|
|
12802
|
+
presetTitle: "标题",
|
|
12803
|
+
presetDescription: "描述",
|
|
12804
|
+
creating: "正在创建…",
|
|
12805
|
+
createFailed: "无法创建预设:{message}",
|
|
12806
|
+
import: "导入酒馆预设",
|
|
12807
|
+
importTitle: "导入酒馆预设",
|
|
12808
|
+
importHelp: "助手会读取 {file},把其中关于叙述方式的部分(叙述者、文风、角色说话方式)写进一个新预设;游戏规则、格式和脚本不会被带入。",
|
|
12809
|
+
importing: "正在导入…",
|
|
12810
|
+
importFailed: "无法导入预设:{message}",
|
|
12811
|
+
importNotStarted: "预设已保存,但助手没能启动:{message}。请打开它的创作聊天继续。",
|
|
12812
|
+
edit: "编辑",
|
|
12813
|
+
author: "用助手编辑",
|
|
12814
|
+
authorFailed: "无法打开创作聊天:{message}",
|
|
12815
|
+
delete: "删除",
|
|
12816
|
+
deleteTitle: "删除预设",
|
|
12817
|
+
deleteHelp: "删除{name}?已经在使用它的故事会保留各自的副本。该预设会被移到回收文件夹。",
|
|
12818
|
+
deleting: "正在删除…",
|
|
12819
|
+
deleteFailed: "无法删除预设:{message}",
|
|
12820
|
+
broken: "无法使用:{problems}",
|
|
12821
|
+
languages: "语言:{list}",
|
|
12822
|
+
promptsCount: "{count} 个提示词",
|
|
12823
|
+
info: "概览",
|
|
12824
|
+
infoSave: "保存",
|
|
12825
|
+
infoSaving: "正在保存…",
|
|
12826
|
+
infoSaved: "已保存。",
|
|
12827
|
+
infoFailed: "无法保存:{message}",
|
|
12828
|
+
samplingMaster: "叙述者温度",
|
|
12829
|
+
samplingCharacters: "角色温度",
|
|
12830
|
+
samplingHelp: "仅作建议:故事自己的设置优先。留空表示不建议;范围 0 到 2。",
|
|
12831
|
+
prompts: "提示词",
|
|
12832
|
+
promptsHelp: "以这个预设开始的故事会得到这些文字。${name} 表示由程序填入的值。预设缺少的提示词或语言可以在下面添加,也可以让助手来写。",
|
|
12833
|
+
promptsNone: "这个预设还没有提示词。",
|
|
12834
|
+
promptPick: "提示词",
|
|
12835
|
+
promptSave: "保存提示词",
|
|
12836
|
+
promptSaving: "正在保存…",
|
|
12837
|
+
promptSaved: "已保存。",
|
|
12838
|
+
promptRemove: "移除此提示词",
|
|
12839
|
+
promptFailed: "无法保存提示词:{message}",
|
|
12840
|
+
promptReset: "放弃修改",
|
|
12841
|
+
missing: "这个预设已不存在。",
|
|
12842
|
+
promptAdd: "添加提示词…",
|
|
12843
|
+
promptAddButton: "添加",
|
|
12844
|
+
rulesWarning: "警告:这个预设带有属于游戏规则的提示词({list})。它们改变的是模型如何主持故事,而不只是文风,改错可能会破坏故事的运行。",
|
|
12845
|
+
"prompt_roleplay/persona": "人设",
|
|
12846
|
+
"prompt_roleplay/style": "叙述文风",
|
|
12847
|
+
"prompt_roleplay/character-style": "角色风格"
|
|
10482
12848
|
}
|
|
10483
|
-
}
|
|
12849
|
+
};
|
|
10484
12850
|
//#endregion
|
|
10485
|
-
//#region src/client/pages/
|
|
10486
|
-
const
|
|
10487
|
-
/**
|
|
10488
|
-
|
|
12851
|
+
//#region src/client/pages/presets/presets-controller.ts
|
|
12852
|
+
const messageOf$1 = (error) => error instanceof Error ? error.message : String(error);
|
|
12853
|
+
/** Reads the preset library from the host and makes, removes and opens its presets. */
|
|
12854
|
+
var PresetsController = class {
|
|
12855
|
+
openChat;
|
|
12856
|
+
language;
|
|
12857
|
+
store = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({
|
|
12858
|
+
status: "idle",
|
|
12859
|
+
refreshing: false
|
|
12860
|
+
});
|
|
12861
|
+
abort = new AbortController();
|
|
12862
|
+
face = {
|
|
12863
|
+
hooks: { presets: this.store },
|
|
12864
|
+
load: () => {
|
|
12865
|
+
if (this.store.getSnapshot().status === "idle") this.read(false);
|
|
12866
|
+
},
|
|
12867
|
+
refresh: () => {
|
|
12868
|
+
this.read(true);
|
|
12869
|
+
},
|
|
12870
|
+
create: async (name, title, description) => {
|
|
12871
|
+
await createPreset({
|
|
12872
|
+
name,
|
|
12873
|
+
...title === "" ? {} : { title },
|
|
12874
|
+
...description === "" ? {} : { description }
|
|
12875
|
+
}, this.abort.signal);
|
|
12876
|
+
await this.read(true);
|
|
12877
|
+
},
|
|
12878
|
+
remove: async (name) => {
|
|
12879
|
+
await deletePreset(name, this.abort.signal);
|
|
12880
|
+
await this.read(true);
|
|
12881
|
+
},
|
|
12882
|
+
author: async (name) => {
|
|
12883
|
+
this.openChat((await authorPreset(name, this.language(), this.abort.signal)).chatSessionId);
|
|
12884
|
+
},
|
|
12885
|
+
importFile: async (name, file) => {
|
|
12886
|
+
const opened = await importPreset(name, file, this.language(), this.abort.signal);
|
|
12887
|
+
await this.read(true);
|
|
12888
|
+
this.openChat(opened.chatSessionId);
|
|
12889
|
+
return {
|
|
12890
|
+
started: opened.started,
|
|
12891
|
+
...opened.failure === void 0 ? {} : { failure: opened.failure }
|
|
12892
|
+
};
|
|
12893
|
+
}
|
|
12894
|
+
};
|
|
12895
|
+
constructor(openChat, language) {
|
|
12896
|
+
this.openChat = openChat;
|
|
12897
|
+
this.language = language;
|
|
12898
|
+
}
|
|
12899
|
+
inject() {
|
|
12900
|
+
return this.face;
|
|
12901
|
+
}
|
|
12902
|
+
dispose() {
|
|
12903
|
+
this.abort.abort();
|
|
12904
|
+
}
|
|
12905
|
+
async read(refreshing) {
|
|
12906
|
+
this.store.update((draft) => {
|
|
12907
|
+
if (refreshing) draft.refreshing = true;
|
|
12908
|
+
else draft.status = "loading";
|
|
12909
|
+
});
|
|
12910
|
+
try {
|
|
12911
|
+
const presets = await listPresets(this.abort.signal);
|
|
12912
|
+
this.store.update((draft) => {
|
|
12913
|
+
draft.status = "ready";
|
|
12914
|
+
draft.presets = presets;
|
|
12915
|
+
delete draft.error;
|
|
12916
|
+
});
|
|
12917
|
+
} catch (error) {
|
|
12918
|
+
if (this.abort.signal.aborted) return;
|
|
12919
|
+
this.store.update((draft) => {
|
|
12920
|
+
draft.error = messageOf$1(error);
|
|
12921
|
+
if (draft.presets === void 0) draft.status = "failed";
|
|
12922
|
+
});
|
|
12923
|
+
} finally {
|
|
12924
|
+
if (!this.abort.signal.aborted) this.store.update((draft) => {
|
|
12925
|
+
draft.refreshing = false;
|
|
12926
|
+
});
|
|
12927
|
+
}
|
|
12928
|
+
}
|
|
12929
|
+
};
|
|
12930
|
+
//#endregion
|
|
12931
|
+
//#region src/client/pages/presets/index.ts
|
|
12932
|
+
const NAMESPACE$9 = "roleplay.presets";
|
|
12933
|
+
/** Adds the Presets page to the Role Play panel: reusable writing instructions for stories. */
|
|
12934
|
+
function registerPresetsPage(ctx) {
|
|
10489
12935
|
const t = ctx.locale.bind(NAMESPACE$9);
|
|
10490
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$9, dictionaries$8), "roleplay:
|
|
10491
|
-
const
|
|
12936
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$9, dictionaries$8), "roleplay: presets dictionaries");
|
|
12937
|
+
const presets = new PresetsController(createChatOpener(ctx), () => t("language"));
|
|
10492
12938
|
ctx.effect(() => () => {
|
|
10493
|
-
|
|
10494
|
-
}, "roleplay:
|
|
12939
|
+
presets.dispose();
|
|
12940
|
+
}, "roleplay: presets requests");
|
|
10495
12941
|
ctx.slots.inject("roleplay.page", () => ctx.slots.register({
|
|
10496
12942
|
name: "roleplay.page",
|
|
10497
|
-
id: "
|
|
10498
|
-
order:
|
|
12943
|
+
id: "presets",
|
|
12944
|
+
order: 7,
|
|
10499
12945
|
label: () => t("nav"),
|
|
10500
12946
|
locale: NAMESPACE$9,
|
|
10501
|
-
inject: () =>
|
|
10502
|
-
},
|
|
12947
|
+
inject: () => presets.inject()
|
|
12948
|
+
}, PresetsPage));
|
|
10503
12949
|
}
|
|
10504
12950
|
/** Page by what fits on screen, but never below the minimum page. */
|
|
10505
12951
|
function pagingFor(fit) {
|
|
@@ -10532,8 +12978,8 @@ window.__ModuleLoader__.load({
|
|
|
10532
12978
|
}
|
|
10533
12979
|
tag$17.textContent = css$17;
|
|
10534
12980
|
var Pager_module_css_default = {
|
|
10535
|
-
"
|
|
10536
|
-
"
|
|
12981
|
+
"pager": "rp_KBAD0W_pager",
|
|
12982
|
+
"position": "rp_KBAD0W_position"
|
|
10537
12983
|
};
|
|
10538
12984
|
//#endregion
|
|
10539
12985
|
//#region src/client/widgets/pager/Pager.tsx
|
|
@@ -10606,9 +13052,9 @@ window.__ModuleLoader__.load({
|
|
|
10606
13052
|
}
|
|
10607
13053
|
tag$15.textContent = css$15;
|
|
10608
13054
|
var DeleteSessionDialog_module_css_default = {
|
|
10609
|
-
"error": "rp_FifHrW_error",
|
|
10610
13055
|
"question": "rp_FifHrW_question",
|
|
10611
13056
|
"warning": "rp_FifHrW_warning",
|
|
13057
|
+
"error": "rp_FifHrW_error",
|
|
10612
13058
|
"body": "rp_FifHrW_body"
|
|
10613
13059
|
};
|
|
10614
13060
|
//#endregion
|
|
@@ -10716,28 +13162,28 @@ window.__ModuleLoader__.load({
|
|
|
10716
13162
|
}
|
|
10717
13163
|
tag$14.textContent = css$14;
|
|
10718
13164
|
var SessionsPage_module_css_default = {
|
|
13165
|
+
"count": "rp_24z4eW_count",
|
|
13166
|
+
"actions": "rp_24z4eW_actions",
|
|
13167
|
+
"viewport": "rp_24z4eW_viewport",
|
|
13168
|
+
"worldColumn": "rp_24z4eW_worldColumn",
|
|
13169
|
+
"spin": "rp_24z4eW_spin",
|
|
10719
13170
|
"fits": "rp_24z4eW_fits",
|
|
10720
13171
|
"table": "rp_24z4eW_table",
|
|
13172
|
+
"toolbar": "rp_24z4eW_toolbar",
|
|
10721
13173
|
"spinning": "rp_24z4eW_spinning",
|
|
10722
|
-
"actions": "rp_24z4eW_actions",
|
|
10723
|
-
"nameColumn": "rp_24z4eW_nameColumn",
|
|
10724
|
-
"turnsColumn": "rp_24z4eW_turnsColumn",
|
|
10725
|
-
"timeColumn": "rp_24z4eW_timeColumn",
|
|
10726
13174
|
"scrolls": "rp_24z4eW_scrolls",
|
|
10727
|
-
"
|
|
10728
|
-
"notice": "rp_24z4eW_notice",
|
|
10729
|
-
"message": "rp_24z4eW_message",
|
|
10730
|
-
"actionsColumn": "rp_24z4eW_actionsColumn",
|
|
10731
|
-
"spin": "rp_24z4eW_spin",
|
|
10732
|
-
"viewport": "rp_24z4eW_viewport",
|
|
10733
|
-
"archived": "rp_24z4eW_archived",
|
|
10734
|
-
"count": "rp_24z4eW_count",
|
|
13175
|
+
"turnsColumn": "rp_24z4eW_turnsColumn",
|
|
10735
13176
|
"number": "rp_24z4eW_number",
|
|
10736
|
-
"
|
|
13177
|
+
"page": "rp_24z4eW_page",
|
|
10737
13178
|
"secondary": "rp_24z4eW_secondary",
|
|
10738
|
-
"
|
|
13179
|
+
"name": "rp_24z4eW_name",
|
|
13180
|
+
"message": "rp_24z4eW_message",
|
|
10739
13181
|
"badge": "rp_24z4eW_badge",
|
|
10740
|
-
"
|
|
13182
|
+
"archived": "rp_24z4eW_archived",
|
|
13183
|
+
"notice": "rp_24z4eW_notice",
|
|
13184
|
+
"actionsColumn": "rp_24z4eW_actionsColumn",
|
|
13185
|
+
"timeColumn": "rp_24z4eW_timeColumn",
|
|
13186
|
+
"nameColumn": "rp_24z4eW_nameColumn"
|
|
10741
13187
|
};
|
|
10742
13188
|
//#endregion
|
|
10743
13189
|
//#region src/client/pages/sessions/SessionsPage.tsx
|
|
@@ -11253,16 +13699,16 @@ window.__ModuleLoader__.load({
|
|
|
11253
13699
|
}
|
|
11254
13700
|
tag$13.textContent = css$13;
|
|
11255
13701
|
var WorldCard_module_css_default = {
|
|
11256
|
-
"tag": "rp_Bvxx5q_tag",
|
|
11257
|
-
"card": "rp_Bvxx5q_card",
|
|
11258
13702
|
"info": "rp_Bvxx5q_info",
|
|
11259
|
-
"tags": "rp_Bvxx5q_tags",
|
|
11260
13703
|
"name": "rp_Bvxx5q_name",
|
|
11261
|
-
"
|
|
13704
|
+
"tag": "rp_Bvxx5q_tag",
|
|
11262
13705
|
"openButton": "rp_Bvxx5q_openButton",
|
|
11263
|
-
"
|
|
13706
|
+
"tags": "rp_Bvxx5q_tags",
|
|
13707
|
+
"image": "rp_Bvxx5q_image",
|
|
13708
|
+
"cover": "rp_Bvxx5q_cover",
|
|
11264
13709
|
"placeholder": "rp_Bvxx5q_placeholder",
|
|
11265
|
-
"
|
|
13710
|
+
"play": "rp_Bvxx5q_play",
|
|
13711
|
+
"card": "rp_Bvxx5q_card"
|
|
11266
13712
|
};
|
|
11267
13713
|
//#endregion
|
|
11268
13714
|
//#region src/client/widgets/world-card/WorldCard.tsx
|
|
@@ -11356,10 +13802,10 @@ window.__ModuleLoader__.load({
|
|
|
11356
13802
|
}
|
|
11357
13803
|
tag$12.textContent = css$12;
|
|
11358
13804
|
var AvatarChoices_module_css_default = {
|
|
11359
|
-
"text": "rp_YCstOG_text",
|
|
11360
13805
|
"name": "rp_YCstOG_name",
|
|
11361
|
-
"
|
|
11362
|
-
"
|
|
13806
|
+
"option": "rp_YCstOG_option",
|
|
13807
|
+
"text": "rp_YCstOG_text",
|
|
13808
|
+
"summary": "rp_YCstOG_summary"
|
|
11363
13809
|
};
|
|
11364
13810
|
//#endregion
|
|
11365
13811
|
//#region src/client/widgets/avatar-choices/AvatarChoices.tsx
|
|
@@ -11399,18 +13845,18 @@ window.__ModuleLoader__.load({
|
|
|
11399
13845
|
}
|
|
11400
13846
|
tag$11.textContent = css$11;
|
|
11401
13847
|
var StartSessionDialog_module_css_default = {
|
|
11402
|
-
"optionName": "rp_AnbLKG_optionName",
|
|
11403
|
-
"advancedToggle": "rp_AnbLKG_advancedToggle",
|
|
11404
13848
|
"error": "rp_AnbLKG_error",
|
|
13849
|
+
"form": "rp_AnbLKG_form",
|
|
13850
|
+
"optionSummary": "rp_AnbLKG_optionSummary",
|
|
11405
13851
|
"field": "rp_AnbLKG_field",
|
|
11406
13852
|
"label": "rp_AnbLKG_label",
|
|
11407
|
-
"optionSummary": "rp_AnbLKG_optionSummary",
|
|
11408
|
-
"optionText": "rp_AnbLKG_optionText",
|
|
11409
13853
|
"message": "rp_AnbLKG_message",
|
|
11410
|
-
"option": "rp_AnbLKG_option",
|
|
11411
13854
|
"advanced": "rp_AnbLKG_advanced",
|
|
11412
|
-
"
|
|
11413
|
-
"
|
|
13855
|
+
"optionText": "rp_AnbLKG_optionText",
|
|
13856
|
+
"optionName": "rp_AnbLKG_optionName",
|
|
13857
|
+
"advancedToggle": "rp_AnbLKG_advancedToggle",
|
|
13858
|
+
"advancedBody": "rp_AnbLKG_advancedBody",
|
|
13859
|
+
"option": "rp_AnbLKG_option"
|
|
11414
13860
|
};
|
|
11415
13861
|
//#endregion
|
|
11416
13862
|
//#region src/client/pages/worlds/AddAvatarsDialog.tsx
|
|
@@ -12283,14 +14729,14 @@ window.__ModuleLoader__.load({
|
|
|
12283
14729
|
}
|
|
12284
14730
|
tag$10.textContent = css$10;
|
|
12285
14731
|
var SettingsFields_module_css_default = {
|
|
12286
|
-
"group": "rp_Rhi3yq_group",
|
|
12287
14732
|
"row": "rp_Rhi3yq_row",
|
|
12288
|
-
"field": "rp_Rhi3yq_field",
|
|
12289
|
-
"error": "rp_Rhi3yq_error",
|
|
12290
|
-
"groupTitle": "rp_Rhi3yq_groupTitle",
|
|
12291
14733
|
"label": "rp_Rhi3yq_label",
|
|
14734
|
+
"area": "rp_Rhi3yq_area",
|
|
12292
14735
|
"help": "rp_Rhi3yq_help",
|
|
12293
|
-
"
|
|
14736
|
+
"error": "rp_Rhi3yq_error",
|
|
14737
|
+
"group": "rp_Rhi3yq_group",
|
|
14738
|
+
"groupTitle": "rp_Rhi3yq_groupTitle",
|
|
14739
|
+
"field": "rp_Rhi3yq_field"
|
|
12294
14740
|
};
|
|
12295
14741
|
//#endregion
|
|
12296
14742
|
//#region src/client/settings-form/SettingsFields.tsx
|
|
@@ -12557,9 +15003,9 @@ window.__ModuleLoader__.load({
|
|
|
12557
15003
|
}
|
|
12558
15004
|
tag$9.textContent = css$9;
|
|
12559
15005
|
var TranslateBanner_module_css_default = {
|
|
12560
|
-
"
|
|
15006
|
+
"text": "rp_Lx8vJa_text",
|
|
12561
15007
|
"error": "rp_Lx8vJa_error",
|
|
12562
|
-
"
|
|
15008
|
+
"banner": "rp_Lx8vJa_banner"
|
|
12563
15009
|
};
|
|
12564
15010
|
//#endregion
|
|
12565
15011
|
//#region src/client/pages/worlds/TranslateBanner.tsx
|
|
@@ -12627,6 +15073,9 @@ window.__ModuleLoader__.load({
|
|
|
12627
15073
|
const [name, setName] = (0, react.useState)(dialog.worldName);
|
|
12628
15074
|
const [opening, setOpening] = (0, react.useState)("");
|
|
12629
15075
|
const [startTime, setStartTime] = (0, react.useState)("");
|
|
15076
|
+
const [preset, setPreset] = (0, react.useState)("");
|
|
15077
|
+
const [books, setBooks] = (0, react.useState)();
|
|
15078
|
+
const chosenBooks = books ?? new Set(dialog.suggestedLorebooks);
|
|
12630
15079
|
const [choice, setChoice] = (0, react.useState)();
|
|
12631
15080
|
const [brought, setBrought] = (0, react.useState)(/* @__PURE__ */ new Set());
|
|
12632
15081
|
const [showSettings, setShowSettings] = (0, react.useState)(false);
|
|
@@ -12686,6 +15135,8 @@ window.__ModuleLoader__.load({
|
|
|
12686
15135
|
...selected.startsWith("avatar:") ? { playerAvatar: selected.slice(7) } : { playerCharacterId: selected },
|
|
12687
15136
|
avatars: bringing.map((avatar) => avatar.key),
|
|
12688
15137
|
...!openingValid ? {} : { opening: Number(opening) },
|
|
15138
|
+
...preset === "" ? {} : { preset },
|
|
15139
|
+
...books === void 0 ? {} : { lorebooks: [...books] },
|
|
12689
15140
|
...startTime.trim() === "" || shown["clock.mode"] === "real" ? {} : { startingTime: startTime.trim() },
|
|
12690
15141
|
settings: fromDrafts(base, shown, options)
|
|
12691
15142
|
});
|
|
@@ -12777,6 +15228,79 @@ window.__ModuleLoader__.load({
|
|
|
12777
15228
|
}, index)] : [])]
|
|
12778
15229
|
})]
|
|
12779
15230
|
}),
|
|
15231
|
+
dialog.status === "ready" && (dialog.presets.length > 0 || dialog.suggestedPreset !== "") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
15232
|
+
className: StartSessionDialog_module_css_default.field,
|
|
15233
|
+
children: [
|
|
15234
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15235
|
+
className: StartSessionDialog_module_css_default.label,
|
|
15236
|
+
children: t("startPreset")
|
|
15237
|
+
}),
|
|
15238
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
15239
|
+
value: preset,
|
|
15240
|
+
disabled: dialog.submitting,
|
|
15241
|
+
"data-testid": "roleplay-start-preset",
|
|
15242
|
+
onChange: (event) => {
|
|
15243
|
+
setPreset(event.target.value);
|
|
15244
|
+
},
|
|
15245
|
+
children: [
|
|
15246
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
15247
|
+
value: "",
|
|
15248
|
+
children: dialog.suggestedPreset === "" ? t("startPresetDefault") : t("startPresetWorld", { name: dialog.suggestedPreset })
|
|
15249
|
+
}),
|
|
15250
|
+
dialog.suggestedPreset !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
15251
|
+
value: "none",
|
|
15252
|
+
children: t("startPresetNone")
|
|
15253
|
+
}),
|
|
15254
|
+
dialog.presets.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
15255
|
+
value: entry.name,
|
|
15256
|
+
disabled: entry.problems.length > 0,
|
|
15257
|
+
children: entry.problems.length > 0 ? t("startPresetBroken", { name: entry.title }) : entry.title
|
|
15258
|
+
}, entry.name))
|
|
15259
|
+
]
|
|
15260
|
+
}),
|
|
15261
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15262
|
+
className: StartSessionDialog_module_css_default.message,
|
|
15263
|
+
children: preset === "" || preset === "none" ? t("startPresetHelp") : dialog.presets.find((entry) => entry.name === preset)?.description ?? ""
|
|
15264
|
+
})
|
|
15265
|
+
]
|
|
15266
|
+
}),
|
|
15267
|
+
dialog.status === "ready" && (dialog.lorebooks.length > 0 || dialog.suggestedLorebooks.length > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
15268
|
+
className: StartSessionDialog_module_css_default.field,
|
|
15269
|
+
"data-testid": "roleplay-start-lorebooks",
|
|
15270
|
+
children: [
|
|
15271
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
|
|
15272
|
+
className: StartSessionDialog_module_css_default.label,
|
|
15273
|
+
children: t("startLorebooks")
|
|
15274
|
+
}),
|
|
15275
|
+
dialog.lorebooks.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
|
|
15276
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
15277
|
+
type: "checkbox",
|
|
15278
|
+
checked: chosenBooks.has(entry.name),
|
|
15279
|
+
disabled: dialog.submitting || entry.problems.length > 0,
|
|
15280
|
+
onChange: (event) => {
|
|
15281
|
+
const next = new Set(chosenBooks);
|
|
15282
|
+
if (event.target.checked) next.add(entry.name);
|
|
15283
|
+
else next.delete(entry.name);
|
|
15284
|
+
setBooks(next);
|
|
15285
|
+
}
|
|
15286
|
+
}),
|
|
15287
|
+
" ",
|
|
15288
|
+
entry.problems.length > 0 ? t("startLorebookBroken", { name: entry.title }) : t("startLorebookEntry", {
|
|
15289
|
+
name: entry.title,
|
|
15290
|
+
count: entry.entries
|
|
15291
|
+
}),
|
|
15292
|
+
dialog.suggestedLorebooks.includes(entry.name) ? ` · ${t("startLorebookSuggested")}` : ""
|
|
15293
|
+
] }, entry.name)),
|
|
15294
|
+
dialog.suggestedLorebooks.filter((name) => !dialog.lorebooks.some((entry) => entry.name === name)).map((name) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15295
|
+
className: StartSessionDialog_module_css_default.message,
|
|
15296
|
+
children: t("startLorebookMissing", { name })
|
|
15297
|
+
}, name)),
|
|
15298
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15299
|
+
className: StartSessionDialog_module_css_default.message,
|
|
15300
|
+
children: t("startLorebooksHelp")
|
|
15301
|
+
})
|
|
15302
|
+
]
|
|
15303
|
+
}),
|
|
12780
15304
|
dialog.status === "ready" && shown["clock.mode"] !== "real" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12781
15305
|
className: StartSessionDialog_module_css_default.field,
|
|
12782
15306
|
children: [
|
|
@@ -12900,6 +15424,15 @@ window.__ModuleLoader__.load({
|
|
|
12900
15424
|
const formId = (0, react.useId)();
|
|
12901
15425
|
const [folder, setFolder] = (0, react.useState)("");
|
|
12902
15426
|
const [name, setName] = (0, react.useState)("");
|
|
15427
|
+
const [preset, setPreset] = (0, react.useState)("");
|
|
15428
|
+
const [presets, setPresets] = (0, react.useState)([]);
|
|
15429
|
+
(0, react.useEffect)(() => {
|
|
15430
|
+
const abort = new AbortController();
|
|
15431
|
+
listPresets(abort.signal).then(setPresets, () => void 0);
|
|
15432
|
+
return () => {
|
|
15433
|
+
abort.abort();
|
|
15434
|
+
};
|
|
15435
|
+
}, []);
|
|
12903
15436
|
const [submitting, setSubmitting] = (0, react.useState)(false);
|
|
12904
15437
|
const [error, setError] = (0, react.useState)();
|
|
12905
15438
|
const create = async () => {
|
|
@@ -12913,7 +15446,8 @@ window.__ModuleLoader__.load({
|
|
|
12913
15446
|
headers: { "content-type": "application/json" },
|
|
12914
15447
|
body: JSON.stringify({
|
|
12915
15448
|
folder,
|
|
12916
|
-
name
|
|
15449
|
+
name,
|
|
15450
|
+
...preset === "" ? {} : { preset }
|
|
12917
15451
|
})
|
|
12918
15452
|
});
|
|
12919
15453
|
if (!response.ok) {
|
|
@@ -12987,6 +15521,34 @@ window.__ModuleLoader__.load({
|
|
|
12987
15521
|
}
|
|
12988
15522
|
})]
|
|
12989
15523
|
}),
|
|
15524
|
+
presets.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
15525
|
+
className: StartSessionDialog_module_css_default.field,
|
|
15526
|
+
children: [
|
|
15527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15528
|
+
className: StartSessionDialog_module_css_default.label,
|
|
15529
|
+
children: t("worldPreset")
|
|
15530
|
+
}),
|
|
15531
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
15532
|
+
value: preset,
|
|
15533
|
+
"data-testid": "roleplay-create-preset",
|
|
15534
|
+
onChange: (event) => {
|
|
15535
|
+
setPreset(event.target.value);
|
|
15536
|
+
},
|
|
15537
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
15538
|
+
value: "",
|
|
15539
|
+
children: t("worldPresetNone")
|
|
15540
|
+
}), presets.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
15541
|
+
value: entry.name,
|
|
15542
|
+
disabled: entry.problems.length > 0,
|
|
15543
|
+
children: entry.title
|
|
15544
|
+
}, entry.name))]
|
|
15545
|
+
}),
|
|
15546
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15547
|
+
className: StartSessionDialog_module_css_default.message,
|
|
15548
|
+
children: t("worldPresetHelp")
|
|
15549
|
+
})
|
|
15550
|
+
]
|
|
15551
|
+
}),
|
|
12990
15552
|
error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12991
15553
|
className: StartSessionDialog_module_css_default.error,
|
|
12992
15554
|
role: "alert",
|
|
@@ -13034,25 +15596,25 @@ window.__ModuleLoader__.load({
|
|
|
13034
15596
|
}
|
|
13035
15597
|
tag$8.textContent = css$8;
|
|
13036
15598
|
var WorldsPage_module_css_default = {
|
|
13037
|
-
"
|
|
13038
|
-
"
|
|
15599
|
+
"scrolls": "rp_FHUyRq_scrolls",
|
|
15600
|
+
"starter": "rp_FHUyRq_starter",
|
|
15601
|
+
"editHeader": "rp_FHUyRq_editHeader",
|
|
13039
15602
|
"fits": "rp_FHUyRq_fits",
|
|
13040
|
-
"
|
|
13041
|
-
"
|
|
15603
|
+
"spinning": "rp_FHUyRq_spinning",
|
|
15604
|
+
"editBody": "rp_FHUyRq_editBody",
|
|
13042
15605
|
"notice": "rp_FHUyRq_notice",
|
|
13043
|
-
"count": "rp_FHUyRq_count",
|
|
13044
15606
|
"grid": "rp_FHUyRq_grid",
|
|
13045
|
-
"editHeader": "rp_FHUyRq_editHeader",
|
|
13046
|
-
"starter": "rp_FHUyRq_starter",
|
|
13047
|
-
"message": "rp_FHUyRq_message",
|
|
13048
|
-
"authorButton": "rp_FHUyRq_authorButton",
|
|
13049
15607
|
"editTitle": "rp_FHUyRq_editTitle",
|
|
13050
|
-
"
|
|
13051
|
-
"
|
|
15608
|
+
"authorButton": "rp_FHUyRq_authorButton",
|
|
15609
|
+
"toolbarActions": "rp_FHUyRq_toolbarActions",
|
|
15610
|
+
"viewport": "rp_FHUyRq_viewport",
|
|
15611
|
+
"count": "rp_FHUyRq_count",
|
|
15612
|
+
"message": "rp_FHUyRq_message",
|
|
13052
15613
|
"starters": "rp_FHUyRq_starters",
|
|
13053
|
-
"
|
|
13054
|
-
"
|
|
13055
|
-
"page": "rp_FHUyRq_page"
|
|
15614
|
+
"spin": "rp_FHUyRq_spin",
|
|
15615
|
+
"toolbar": "rp_FHUyRq_toolbar",
|
|
15616
|
+
"page": "rp_FHUyRq_page",
|
|
15617
|
+
"cell": "rp_FHUyRq_cell"
|
|
13056
15618
|
};
|
|
13057
15619
|
//#endregion
|
|
13058
15620
|
//#region src/client/pages/worlds/StarterWorlds.tsx
|
|
@@ -13122,34 +15684,34 @@ window.__ModuleLoader__.load({
|
|
|
13122
15684
|
}
|
|
13123
15685
|
tag$7.textContent = css$7;
|
|
13124
15686
|
var ImportCardPage_module_css_default = {
|
|
13125
|
-
"
|
|
13126
|
-
"fieldMeta": "rp_DmG_oG_fieldMeta",
|
|
15687
|
+
"noPicture": "rp_DmG_oG_noPicture",
|
|
13127
15688
|
"about": "rp_DmG_oG_about",
|
|
13128
|
-
"fieldHead": "rp_DmG_oG_fieldHead",
|
|
13129
|
-
"row": "rp_DmG_oG_row",
|
|
13130
|
-
"entryHead": "rp_DmG_oG_entryHead",
|
|
13131
|
-
"section": "rp_DmG_oG_section",
|
|
13132
|
-
"header": "rp_DmG_oG_header",
|
|
13133
|
-
"label": "rp_DmG_oG_label",
|
|
13134
|
-
"field": "rp_DmG_oG_field",
|
|
13135
15689
|
"entryTitle": "rp_DmG_oG_entryTitle",
|
|
15690
|
+
"field": "rp_DmG_oG_field",
|
|
15691
|
+
"top": "rp_DmG_oG_top",
|
|
15692
|
+
"header": "rp_DmG_oG_header",
|
|
15693
|
+
"fieldTitle": "rp_DmG_oG_fieldTitle",
|
|
13136
15694
|
"text": "rp_DmG_oG_text",
|
|
13137
|
-
"choiceText": "rp_DmG_oG_choiceText",
|
|
13138
|
-
"page": "rp_DmG_oG_page",
|
|
13139
|
-
"space": "rp_DmG_oG_space",
|
|
13140
|
-
"title": "rp_DmG_oG_title",
|
|
13141
|
-
"preview": "rp_DmG_oG_preview",
|
|
13142
15695
|
"entryOff": "rp_DmG_oG_entryOff",
|
|
15696
|
+
"choice": "rp_DmG_oG_choice",
|
|
15697
|
+
"row": "rp_DmG_oG_row",
|
|
15698
|
+
"picture": "rp_DmG_oG_picture",
|
|
15699
|
+
"fieldMeta": "rp_DmG_oG_fieldMeta",
|
|
15700
|
+
"preview": "rp_DmG_oG_preview",
|
|
13143
15701
|
"error": "rp_DmG_oG_error",
|
|
13144
|
-
"note": "rp_DmG_oG_note",
|
|
13145
15702
|
"heading": "rp_DmG_oG_heading",
|
|
13146
|
-
"
|
|
15703
|
+
"tags": "rp_DmG_oG_tags",
|
|
15704
|
+
"section": "rp_DmG_oG_section",
|
|
15705
|
+
"space": "rp_DmG_oG_space",
|
|
15706
|
+
"label": "rp_DmG_oG_label",
|
|
15707
|
+
"note": "rp_DmG_oG_note",
|
|
15708
|
+
"title": "rp_DmG_oG_title",
|
|
15709
|
+
"page": "rp_DmG_oG_page",
|
|
13147
15710
|
"entry": "rp_DmG_oG_entry",
|
|
15711
|
+
"fieldHead": "rp_DmG_oG_fieldHead",
|
|
15712
|
+
"entryHead": "rp_DmG_oG_entryHead",
|
|
13148
15713
|
"body": "rp_DmG_oG_body",
|
|
13149
|
-
"
|
|
13150
|
-
"picture": "rp_DmG_oG_picture",
|
|
13151
|
-
"fieldTitle": "rp_DmG_oG_fieldTitle",
|
|
13152
|
-
"choice": "rp_DmG_oG_choice"
|
|
15714
|
+
"choiceText": "rp_DmG_oG_choiceText"
|
|
13153
15715
|
};
|
|
13154
15716
|
//#endregion
|
|
13155
15717
|
//#region src/client/pages/worlds/ImportCardPage.tsx
|
|
@@ -14183,6 +16745,18 @@ window.__ModuleLoader__.load({
|
|
|
14183
16745
|
startTitle: "Start a new session",
|
|
14184
16746
|
sessionName: "Session name",
|
|
14185
16747
|
playAs: "Play as",
|
|
16748
|
+
startLorebooks: "Lorebooks",
|
|
16749
|
+
startLorebookEntry: "{name} ({count} entries)",
|
|
16750
|
+
startLorebookBroken: "{name} (has problems)",
|
|
16751
|
+
startLorebookSuggested: "suggested by the world",
|
|
16752
|
+
startLorebookMissing: "The world suggests the lorebook \"{name}\", which is not in your library.",
|
|
16753
|
+
startLorebooksHelp: "The entries of the lorebooks you tick are copied into the story. Entries known to everyone are known to every character.",
|
|
16754
|
+
startPreset: "Writing preset",
|
|
16755
|
+
startPresetDefault: "Default style",
|
|
16756
|
+
startPresetWorld: "The world's suggestion ({name})",
|
|
16757
|
+
startPresetNone: "No preset",
|
|
16758
|
+
startPresetBroken: "{name} (has problems)",
|
|
16759
|
+
startPresetHelp: "A preset sets how the story is written. Presets are kept in the presets folder of your roleplay folder.",
|
|
14186
16760
|
startOpening: "Opening",
|
|
14187
16761
|
startOpeningDefault: "The world's own opening",
|
|
14188
16762
|
startTime: "Story starts at",
|
|
@@ -14202,6 +16776,9 @@ window.__ModuleLoader__.load({
|
|
|
14202
16776
|
worldFolder: "Folder name",
|
|
14203
16777
|
worldFolderHelp: "A new folder directly inside the roleplay worlds directory.",
|
|
14204
16778
|
worldName: "World name",
|
|
16779
|
+
worldPreset: "Suggested preset",
|
|
16780
|
+
worldPresetNone: "None",
|
|
16781
|
+
worldPresetHelp: "Writing instructions from your library for new stories of this world. It can be changed later in the editor.",
|
|
14205
16782
|
createWorldFailed: "Could not create the world: {message}",
|
|
14206
16783
|
importPreset: "Import narration preset",
|
|
14207
16784
|
presetOpening: "Opening…",
|
|
@@ -14292,6 +16869,18 @@ window.__ModuleLoader__.load({
|
|
|
14292
16869
|
startTitle: "开始新存档",
|
|
14293
16870
|
sessionName: "存档名称",
|
|
14294
16871
|
playAs: "扮演角色",
|
|
16872
|
+
startLorebooks: "世界书",
|
|
16873
|
+
startLorebookEntry: "{name}({count} 个条目)",
|
|
16874
|
+
startLorebookBroken: "{name}(有问题)",
|
|
16875
|
+
startLorebookSuggested: "世界建议",
|
|
16876
|
+
startLorebookMissing: "世界建议使用世界书“{name}”,但你的资料库里没有。",
|
|
16877
|
+
startLorebooksHelp: "勾选的世界书的条目会复制进故事。人人皆知的条目,每个角色都知道。",
|
|
16878
|
+
startPreset: "写作预设",
|
|
16879
|
+
startPresetDefault: "默认风格",
|
|
16880
|
+
startPresetWorld: "世界的建议({name})",
|
|
16881
|
+
startPresetNone: "不使用预设",
|
|
16882
|
+
startPresetBroken: "{name}(有问题)",
|
|
16883
|
+
startPresetHelp: "预设决定故事的写法。预设保存在角色扮演文件夹的 presets 文件夹中。",
|
|
14295
16884
|
startOpening: "开场",
|
|
14296
16885
|
startOpeningDefault: "世界自带的开场",
|
|
14297
16886
|
startTime: "故事开始于",
|
|
@@ -14311,6 +16900,9 @@ window.__ModuleLoader__.load({
|
|
|
14311
16900
|
worldFolder: "文件夹名称",
|
|
14312
16901
|
worldFolderHelp: "将在角色扮演 worlds 目录下直接创建这个文件夹。",
|
|
14313
16902
|
worldName: "世界名称",
|
|
16903
|
+
worldPreset: "建议的预设",
|
|
16904
|
+
worldPresetNone: "无",
|
|
16905
|
+
worldPresetHelp: "库中的写作指令,供这个世界的新故事使用;之后可在编辑器中修改。",
|
|
14314
16906
|
createWorldFailed: "无法创建世界:{message}",
|
|
14315
16907
|
importPreset: "导入叙述预设",
|
|
14316
16908
|
presetOpening: "正在打开…",
|
|
@@ -14339,7 +16931,7 @@ window.__ModuleLoader__.load({
|
|
|
14339
16931
|
startAvatars: "带上角色形象",
|
|
14340
16932
|
startAvatarsHelp: "勾选要带进这个存档的角色形象,它们会成为存档中的角色,你也可以扮演它们。世界本身不会改变。"
|
|
14341
16933
|
}
|
|
14342
|
-
}, dictionaries$6), dictionaries$
|
|
16934
|
+
}, dictionaries$6), dictionaries$11);
|
|
14343
16935
|
//#endregion
|
|
14344
16936
|
//#region src/client/pages/worlds/worlds-controller.ts
|
|
14345
16937
|
async function request$1(path, init, signal) {
|
|
@@ -14464,11 +17056,20 @@ window.__ModuleLoader__.load({
|
|
|
14464
17056
|
openings: [],
|
|
14465
17057
|
startingTime: "",
|
|
14466
17058
|
timeZone: "",
|
|
17059
|
+
presets: [],
|
|
17060
|
+
suggestedPreset: "",
|
|
17061
|
+
lorebooks: [],
|
|
17062
|
+
suggestedLorebooks: [],
|
|
14467
17063
|
submitting: false
|
|
14468
17064
|
};
|
|
14469
17065
|
});
|
|
14470
17066
|
try {
|
|
14471
|
-
const [{ characters, openings, startingTime, timeZone }, avatars] = await Promise.all([
|
|
17067
|
+
const [{ characters, openings, startingTime, timeZone, preset, lorebooks: suggested }, avatars, presets, books] = await Promise.all([
|
|
17068
|
+
request$1(`/worlds/characters?id=${encodeURIComponent(worldId)}`, {}, this.abort.signal),
|
|
17069
|
+
listAvatars(this.abort.signal).catch(() => []),
|
|
17070
|
+
request$1("/presets", {}, this.abort.signal).catch(() => []),
|
|
17071
|
+
request$1("/lorebooks", {}, this.abort.signal).catch(() => [])
|
|
17072
|
+
]);
|
|
14472
17073
|
this.updateDialog(token, (dialog) => {
|
|
14473
17074
|
dialog.status = "ready";
|
|
14474
17075
|
dialog.characters = characters;
|
|
@@ -14476,6 +17077,10 @@ window.__ModuleLoader__.load({
|
|
|
14476
17077
|
dialog.openings = openings;
|
|
14477
17078
|
dialog.startingTime = startingTime;
|
|
14478
17079
|
dialog.timeZone = timeZone;
|
|
17080
|
+
dialog.presets = presets;
|
|
17081
|
+
dialog.suggestedPreset = preset ?? "";
|
|
17082
|
+
dialog.lorebooks = books;
|
|
17083
|
+
dialog.suggestedLorebooks = suggested ?? [];
|
|
14479
17084
|
});
|
|
14480
17085
|
} catch (error) {
|
|
14481
17086
|
if (this.abort.signal.aborted) return;
|
|
@@ -14513,6 +17118,8 @@ window.__ModuleLoader__.load({
|
|
|
14513
17118
|
...options.avatars.length === 0 ? {} : { avatars: options.avatars },
|
|
14514
17119
|
...options.opening === void 0 ? {} : { opening: options.opening },
|
|
14515
17120
|
...options.startingTime === void 0 ? {} : { startingTime: options.startingTime },
|
|
17121
|
+
...options.preset === void 0 ? {} : { preset: options.preset },
|
|
17122
|
+
...options.lorebooks === void 0 ? {} : { lorebooks: options.lorebooks },
|
|
14516
17123
|
...options.settings === void 0 ? {} : { settings: options.settings }
|
|
14517
17124
|
})
|
|
14518
17125
|
}, this.abort.signal);
|
|
@@ -14698,10 +17305,10 @@ window.__ModuleLoader__.load({
|
|
|
14698
17305
|
}
|
|
14699
17306
|
tag$6.textContent = css$6;
|
|
14700
17307
|
var BranchDialog_module_css_default = {
|
|
14701
|
-
"
|
|
17308
|
+
"error": "rp_Dy1TaW_error",
|
|
14702
17309
|
"form": "rp_Dy1TaW_form",
|
|
14703
17310
|
"field": "rp_Dy1TaW_field",
|
|
14704
|
-
"
|
|
17311
|
+
"label": "rp_Dy1TaW_label"
|
|
14705
17312
|
};
|
|
14706
17313
|
//#endregion
|
|
14707
17314
|
//#region src/client/branch/BranchDialog.tsx
|
|
@@ -14844,7 +17451,7 @@ window.__ModuleLoader__.load({
|
|
|
14844
17451
|
/** Adds the Gallery tab beside Chat and World: every image of the session in a grid. */
|
|
14845
17452
|
function registerGallery(ctx) {
|
|
14846
17453
|
const t = ctx.locale.bind(NAMESPACE$5);
|
|
14847
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$
|
|
17454
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$5, dictionaries$15), "roleplay: gallery dictionaries");
|
|
14848
17455
|
ctx.inject(["uiConversation"], (scope) => {
|
|
14849
17456
|
scope.uiConversation.views.register(galleryTarget);
|
|
14850
17457
|
scope.slots.inject("conversation.view", () => scope.slots.register({
|
|
@@ -15170,17 +17777,17 @@ window.__ModuleLoader__.load({
|
|
|
15170
17777
|
}
|
|
15171
17778
|
tag$5.textContent = css$5;
|
|
15172
17779
|
var SidebarPage_module_css_default = {
|
|
15173
|
-
"title": "rp_Ptco8a_title",
|
|
15174
|
-
"page": "rp_Ptco8a_page",
|
|
15175
17780
|
"bar": "rp_Ptco8a_bar",
|
|
15176
|
-
"content": "rp_Ptco8a_content",
|
|
15177
|
-
"main": "rp_Ptco8a_main",
|
|
15178
|
-
"message": "rp_Ptco8a_message",
|
|
15179
17781
|
"name": "rp_Ptco8a_name",
|
|
17782
|
+
"page": "rp_Ptco8a_page",
|
|
15180
17783
|
"text": "rp_Ptco8a_text",
|
|
15181
17784
|
"description": "rp_Ptco8a_description",
|
|
17785
|
+
"content": "rp_Ptco8a_content",
|
|
15182
17786
|
"entry": "rp_Ptco8a_entry",
|
|
15183
|
-
"
|
|
17787
|
+
"title": "rp_Ptco8a_title",
|
|
17788
|
+
"main": "rp_Ptco8a_main",
|
|
17789
|
+
"icon": "rp_Ptco8a_icon",
|
|
17790
|
+
"message": "rp_Ptco8a_message"
|
|
15184
17791
|
};
|
|
15185
17792
|
//#endregion
|
|
15186
17793
|
//#region src/client/interface/SidebarPage.tsx
|
|
@@ -15483,7 +18090,7 @@ window.__ModuleLoader__.load({
|
|
|
15483
18090
|
/** Adds the World tab beside Chat: the state of the story, by the part of the world. */
|
|
15484
18091
|
function registerWorld(ctx) {
|
|
15485
18092
|
const t = ctx.locale.bind(NAMESPACE$3);
|
|
15486
|
-
ctx.effect(() => ctx.locale.register(NAMESPACE$3, dictionaries$
|
|
18093
|
+
ctx.effect(() => ctx.locale.register(NAMESPACE$3, dictionaries$11), "roleplay: world dictionaries");
|
|
15487
18094
|
ctx.inject(["uiConversation"], (scope) => {
|
|
15488
18095
|
scope.uiConversation.views.register(worldTarget);
|
|
15489
18096
|
scope.slots.inject("conversation.view", () => scope.slots.register({
|
|
@@ -15508,26 +18115,26 @@ window.__ModuleLoader__.load({
|
|
|
15508
18115
|
}
|
|
15509
18116
|
tag$4.textContent = css$4;
|
|
15510
18117
|
var ChatSettingsView_module_css_default = {
|
|
15511
|
-
"activity": "rp_wLpbxW_activity",
|
|
15512
18118
|
"error": "rp_wLpbxW_error",
|
|
18119
|
+
"saved": "rp_wLpbxW_saved",
|
|
18120
|
+
"activity": "rp_wLpbxW_activity",
|
|
15513
18121
|
"pre": "rp_wLpbxW_pre",
|
|
15514
|
-
"
|
|
18122
|
+
"description": "rp_wLpbxW_description",
|
|
15515
18123
|
"help": "rp_wLpbxW_help",
|
|
15516
|
-
"
|
|
15517
|
-
"
|
|
18124
|
+
"table": "rp_wLpbxW_table",
|
|
18125
|
+
"run": "rp_wLpbxW_run",
|
|
15518
18126
|
"select": "rp_wLpbxW_select",
|
|
15519
|
-
"description": "rp_wLpbxW_description",
|
|
15520
|
-
"saved": "rp_wLpbxW_saved",
|
|
15521
18127
|
"list": "rp_wLpbxW_list",
|
|
15522
|
-
"view": "rp_wLpbxW_view",
|
|
15523
|
-
"field": "rp_wLpbxW_field",
|
|
15524
18128
|
"row": "rp_wLpbxW_row",
|
|
15525
|
-
"
|
|
18129
|
+
"field": "rp_wLpbxW_field",
|
|
18130
|
+
"reasons": "rp_wLpbxW_reasons",
|
|
15526
18131
|
"message": "rp_wLpbxW_message",
|
|
15527
18132
|
"notice": "rp_wLpbxW_notice",
|
|
15528
|
-
"
|
|
18133
|
+
"label": "rp_wLpbxW_label",
|
|
18134
|
+
"link": "rp_wLpbxW_link",
|
|
15529
18135
|
"actions": "rp_wLpbxW_actions",
|
|
15530
|
-
"
|
|
18136
|
+
"view": "rp_wLpbxW_view",
|
|
18137
|
+
"title": "rp_wLpbxW_title"
|
|
15531
18138
|
};
|
|
15532
18139
|
//#endregion
|
|
15533
18140
|
//#region src/client/chat-settings/settings-api.ts
|
|
@@ -15631,7 +18238,7 @@ window.__ModuleLoader__.load({
|
|
|
15631
18238
|
}
|
|
15632
18239
|
//#endregion
|
|
15633
18240
|
//#region src/client/chat-settings/InterfaceSection.tsx
|
|
15634
|
-
const message = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
18241
|
+
const message$1 = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
15635
18242
|
/**
|
|
15636
18243
|
* The interface pack of the story: which one is in use or why none is, a choice of the packs the story could use (kept
|
|
15637
18244
|
* with the other settings, so it is saved with them), and, when the world's packs are not what the story copied, a way
|
|
@@ -15649,7 +18256,7 @@ window.__ModuleLoader__.load({
|
|
|
15649
18256
|
setStatus(next);
|
|
15650
18257
|
setFailure(void 0);
|
|
15651
18258
|
}, (error) => {
|
|
15652
|
-
if (!abort.signal.aborted) setFailure(message(error));
|
|
18259
|
+
if (!abort.signal.aborted) setFailure(message$1(error));
|
|
15653
18260
|
});
|
|
15654
18261
|
return () => {
|
|
15655
18262
|
abort.abort();
|
|
@@ -15670,7 +18277,7 @@ window.__ModuleLoader__.load({
|
|
|
15670
18277
|
setVersion((number) => number + 1);
|
|
15671
18278
|
}, (error) => {
|
|
15672
18279
|
setReport(void 0);
|
|
15673
|
-
setFailure(t("packSyncFailed", { message: message(error) }));
|
|
18280
|
+
setFailure(t("packSyncFailed", { message: message$1(error) }));
|
|
15674
18281
|
});
|
|
15675
18282
|
};
|
|
15676
18283
|
if (status === void 0) return failure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -15784,6 +18391,123 @@ window.__ModuleLoader__.load({
|
|
|
15784
18391
|
});
|
|
15785
18392
|
}
|
|
15786
18393
|
//#endregion
|
|
18394
|
+
//#region src/client/chat-settings/PresetSection.tsx
|
|
18395
|
+
const message = (failure) => failure instanceof Error ? failure.message : String(failure);
|
|
18396
|
+
/** The writing preset the story's prompts came from, whether it still matches the library, and a way to switch or take it out. */
|
|
18397
|
+
function PresetSection({ t, session, disabled }) {
|
|
18398
|
+
const [status, setStatus] = (0, react.useState)();
|
|
18399
|
+
const [choice, setChoice] = (0, react.useState)("");
|
|
18400
|
+
const [failure, setFailure] = (0, react.useState)();
|
|
18401
|
+
const [report, setReport] = (0, react.useState)();
|
|
18402
|
+
const [sure, setSure] = (0, react.useState)(false);
|
|
18403
|
+
const [version, setVersion] = (0, react.useState)(0);
|
|
18404
|
+
(0, react.useEffect)(() => {
|
|
18405
|
+
const abort = new AbortController();
|
|
18406
|
+
loadPresetStatus(session, abort.signal).then((next) => {
|
|
18407
|
+
setStatus(next);
|
|
18408
|
+
setFailure(void 0);
|
|
18409
|
+
}, (error) => {
|
|
18410
|
+
if (!abort.signal.aborted) setFailure(message(error));
|
|
18411
|
+
});
|
|
18412
|
+
return () => {
|
|
18413
|
+
abort.abort();
|
|
18414
|
+
};
|
|
18415
|
+
}, [session, version]);
|
|
18416
|
+
const run = (name) => {
|
|
18417
|
+
setSure(false);
|
|
18418
|
+
applyPreset(session, name, new AbortController().signal).then((done) => {
|
|
18419
|
+
setReport(t("presetApplied", { count: done.files.length }));
|
|
18420
|
+
setFailure(void 0);
|
|
18421
|
+
setChoice("");
|
|
18422
|
+
setVersion((number) => number + 1);
|
|
18423
|
+
}, (error) => {
|
|
18424
|
+
setReport(void 0);
|
|
18425
|
+
setFailure(t("presetFailed", { message: message(error) }));
|
|
18426
|
+
});
|
|
18427
|
+
};
|
|
18428
|
+
if (status === void 0) return failure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
18429
|
+
className: ChatSettingsView_module_css_default.error,
|
|
18430
|
+
role: "alert",
|
|
18431
|
+
children: t("presetLoadFailed", { message: failure })
|
|
18432
|
+
});
|
|
18433
|
+
if (status.applied === void 0 && status.available.length === 0) return null;
|
|
18434
|
+
const applied = status.applied;
|
|
18435
|
+
const library = applied === void 0 ? void 0 : status.available.find((entry) => entry.name === applied.name);
|
|
18436
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
18437
|
+
className: ChatSettingsView_module_css_default.activity,
|
|
18438
|
+
"data-testid": "roleplay-preset",
|
|
18439
|
+
children: [
|
|
18440
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("presetTitle") }),
|
|
18441
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
18442
|
+
className: ChatSettingsView_module_css_default.description,
|
|
18443
|
+
children: t("presetHelp")
|
|
18444
|
+
}),
|
|
18445
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
18446
|
+
className: ChatSettingsView_module_css_default.description,
|
|
18447
|
+
children: applied === void 0 ? t("presetNone") : t(`presetState_${applied.state}`, { name: library?.title ?? applied.name })
|
|
18448
|
+
}),
|
|
18449
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
18450
|
+
className: ChatSettingsView_module_css_default.field,
|
|
18451
|
+
style: { maxWidth: "none" },
|
|
18452
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
18453
|
+
className: ChatSettingsView_module_css_default.label,
|
|
18454
|
+
children: t("presetChoose")
|
|
18455
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
18456
|
+
className: ChatSettingsView_module_css_default.select,
|
|
18457
|
+
value: choice,
|
|
18458
|
+
disabled,
|
|
18459
|
+
onChange: (event) => {
|
|
18460
|
+
setChoice(event.target.value);
|
|
18461
|
+
setSure(false);
|
|
18462
|
+
},
|
|
18463
|
+
children: [
|
|
18464
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
18465
|
+
value: "",
|
|
18466
|
+
children: t("presetKeep")
|
|
18467
|
+
}),
|
|
18468
|
+
applied !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
18469
|
+
value: "__none",
|
|
18470
|
+
children: t("presetRemove")
|
|
18471
|
+
}),
|
|
18472
|
+
status.available.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
18473
|
+
value: entry.name,
|
|
18474
|
+
disabled: entry.problems.length > 0,
|
|
18475
|
+
children: entry.problems.length > 0 ? t("presetBroken", { name: entry.title }) : entry.title
|
|
18476
|
+
}, entry.name))
|
|
18477
|
+
]
|
|
18478
|
+
})]
|
|
18479
|
+
}),
|
|
18480
|
+
(choice !== "" || applied !== void 0 && applied.state === "changed") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
18481
|
+
variant: "ghost",
|
|
18482
|
+
size: "sm",
|
|
18483
|
+
disabled,
|
|
18484
|
+
onClick: () => {
|
|
18485
|
+
if (sure) run(choice === "" ? applied?.name : choice === "__none" ? void 0 : choice);
|
|
18486
|
+
else setSure(true);
|
|
18487
|
+
},
|
|
18488
|
+
children: sure ? t("presetConfirm") : choice === "__none" ? t("presetTakeOut") : choice === "" ? t("presetReapply") : t("presetSwitch")
|
|
18489
|
+
}), sure && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
18490
|
+
type: "button",
|
|
18491
|
+
className: ChatSettingsView_module_css_default.link,
|
|
18492
|
+
onClick: () => {
|
|
18493
|
+
setSure(false);
|
|
18494
|
+
},
|
|
18495
|
+
children: t("vectorsCancel")
|
|
18496
|
+
})] }),
|
|
18497
|
+
report !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
18498
|
+
className: ChatSettingsView_module_css_default.description,
|
|
18499
|
+
role: "status",
|
|
18500
|
+
children: report
|
|
18501
|
+
}),
|
|
18502
|
+
failure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
18503
|
+
className: ChatSettingsView_module_css_default.error,
|
|
18504
|
+
role: "alert",
|
|
18505
|
+
children: failure
|
|
18506
|
+
})
|
|
18507
|
+
]
|
|
18508
|
+
});
|
|
18509
|
+
}
|
|
18510
|
+
//#endregion
|
|
15787
18511
|
//#region src/client/chat-settings/ReflectionSection.tsx
|
|
15788
18512
|
const POLL_MS$1 = 3e3;
|
|
15789
18513
|
/** When the characters last sorted what they took in, and a way to have them do it now. */
|
|
@@ -16331,6 +19055,11 @@ window.__ModuleLoader__.load({
|
|
|
16331
19055
|
saved: payload.settings.interface.pack,
|
|
16332
19056
|
disabled: saving
|
|
16333
19057
|
}),
|
|
19058
|
+
session !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PresetSection, {
|
|
19059
|
+
t,
|
|
19060
|
+
session,
|
|
19061
|
+
disabled: saving
|
|
19062
|
+
}),
|
|
16334
19063
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolSwitches, {
|
|
16335
19064
|
board: payload.settings.tools,
|
|
16336
19065
|
onChange: setTools,
|
|
@@ -16498,6 +19227,24 @@ window.__ModuleLoader__.load({
|
|
|
16498
19227
|
reflectHelp: "Each character with something new sorts it into what it believes: beliefs are merged, firmed up or let go, each resting on events it took in. It runs in the background; you can keep playing.",
|
|
16499
19228
|
reflectFailed: "Could not start the reflection: {message}",
|
|
16500
19229
|
reflectError: "The last pass failed: {message}",
|
|
19230
|
+
presetTitle: "Writing preset",
|
|
19231
|
+
presetHelp: "The prose prompts this story copied from a preset. Changing it replaces those prompts from the next prompt used; the replaced copies are kept in the story's .trash folder. Prompts the world carried that a preset replaced are not brought back.",
|
|
19232
|
+
presetNone: "No preset is in use.",
|
|
19233
|
+
presetState_current: "Using {name}.",
|
|
19234
|
+
presetState_changed: "Using {name}, which has changed in the library since this story copied it.",
|
|
19235
|
+
presetState_edited: "Using {name}, but a copy was edited in this story. Re-applying replaces your edit.",
|
|
19236
|
+
presetState_missing: "Using {name}, which is no longer in the library; the story keeps its copies.",
|
|
19237
|
+
presetChoose: "Preset",
|
|
19238
|
+
presetKeep: "Keep the current one",
|
|
19239
|
+
presetRemove: "Take the preset out",
|
|
19240
|
+
presetBroken: "{name} (has problems)",
|
|
19241
|
+
presetConfirm: "Replace the story's copies?",
|
|
19242
|
+
presetTakeOut: "Take it out",
|
|
19243
|
+
presetReapply: "Re-apply from the library",
|
|
19244
|
+
presetSwitch: "Switch to it",
|
|
19245
|
+
presetApplied: "Done: {count} prompt(s) replaced.",
|
|
19246
|
+
presetFailed: "Could not change the preset: {message}",
|
|
19247
|
+
presetLoadFailed: "Could not read the preset: {message}",
|
|
16501
19248
|
packTitle: "Interface pack",
|
|
16502
19249
|
packHelp: "A pack changes how this story looks and can add a status strip, buttons, an opening card, a backdrop or a tab. A world can carry packs; yours go in the ui folder of your roleplay folder.",
|
|
16503
19250
|
packActive: "In use: {name}",
|
|
@@ -16616,6 +19363,24 @@ window.__ModuleLoader__.load({
|
|
|
16616
19363
|
reflectHelp: "每个有新见闻的角色会把它们整理成自己的信念:合并、巩固或放下,每一条都要依据它接收到的事件。反思在后台进行,你可以继续游玩。",
|
|
16617
19364
|
reflectFailed: "无法开始反思:{message}",
|
|
16618
19365
|
reflectError: "上一次反思失败:{message}",
|
|
19366
|
+
presetTitle: "写作预设",
|
|
19367
|
+
presetHelp: "这个故事从预设复制来的叙述类提示词。更换后,从下一次使用提示词起生效;被替换的副本保存在故事的 .trash 文件夹中。世界自带、但被预设替换过的提示词不会恢复。",
|
|
19368
|
+
presetNone: "未使用预设。",
|
|
19369
|
+
presetState_current: "正在使用 {name}。",
|
|
19370
|
+
presetState_changed: "正在使用 {name},库中的这个预设在故事复制之后已有改动。",
|
|
19371
|
+
presetState_edited: "正在使用 {name},但故事中的副本被修改过。重新应用会覆盖你的修改。",
|
|
19372
|
+
presetState_missing: "正在使用 {name},它已不在库中;故事保留自己的副本。",
|
|
19373
|
+
presetChoose: "预设",
|
|
19374
|
+
presetKeep: "保持当前",
|
|
19375
|
+
presetRemove: "移除预设",
|
|
19376
|
+
presetBroken: "{name}(有问题)",
|
|
19377
|
+
presetConfirm: "替换故事中的副本?",
|
|
19378
|
+
presetTakeOut: "移除",
|
|
19379
|
+
presetReapply: "从库中重新应用",
|
|
19380
|
+
presetSwitch: "切换到它",
|
|
19381
|
+
presetApplied: "完成:替换了 {count} 条提示词。",
|
|
19382
|
+
presetFailed: "无法更改预设:{message}",
|
|
19383
|
+
presetLoadFailed: "无法读取预设:{message}",
|
|
16619
19384
|
packTitle: "界面包",
|
|
16620
19385
|
packHelp: "界面包会改变此故事的外观,并可添加状态条、按钮、开场卡片、背景或标签页。世界可以自带界面包;你自己的放在角色扮演目录的 ui 文件夹中。",
|
|
16621
19386
|
packActive: "使用中:{name}",
|
|
@@ -16641,7 +19406,7 @@ window.__ModuleLoader__.load({
|
|
|
16641
19406
|
saved: "已保存。",
|
|
16642
19407
|
saveFailed: "无法保存设置:{message}"
|
|
16643
19408
|
}
|
|
16644
|
-
}, dictionaries$6), dictionaries$
|
|
19409
|
+
}, dictionaries$6), dictionaries$16);
|
|
16645
19410
|
//#endregion
|
|
16646
19411
|
//#region src/client/chat-settings/index.ts
|
|
16647
19412
|
const NAMESPACE$2 = "roleplay.chatSettings";
|
|
@@ -16736,15 +19501,15 @@ window.__ModuleLoader__.load({
|
|
|
16736
19501
|
}
|
|
16737
19502
|
tag$3.textContent = css$3;
|
|
16738
19503
|
var CatalogueSettings_module_css_default = {
|
|
19504
|
+
"problem": "rp_KPhXDa_problem",
|
|
19505
|
+
"actions": "rp_KPhXDa_actions",
|
|
16739
19506
|
"label": "rp_KPhXDa_label",
|
|
19507
|
+
"hint": "rp_KPhXDa_hint",
|
|
16740
19508
|
"field": "rp_KPhXDa_field",
|
|
16741
|
-
"problem": "rp_KPhXDa_problem",
|
|
16742
|
-
"keyHint": "rp_KPhXDa_keyHint",
|
|
16743
|
-
"row": "rp_KPhXDa_row",
|
|
16744
19509
|
"title": "rp_KPhXDa_title",
|
|
19510
|
+
"row": "rp_KPhXDa_row",
|
|
16745
19511
|
"section": "rp_KPhXDa_section",
|
|
16746
|
-
"
|
|
16747
|
-
"actions": "rp_KPhXDa_actions"
|
|
19512
|
+
"keyHint": "rp_KPhXDa_keyHint"
|
|
16748
19513
|
};
|
|
16749
19514
|
//#endregion
|
|
16750
19515
|
//#region src/client/settings/CatalogueSettings.tsx
|
|
@@ -17184,28 +19949,28 @@ window.__ModuleLoader__.load({
|
|
|
17184
19949
|
}
|
|
17185
19950
|
tag$2.textContent = css$2;
|
|
17186
19951
|
var NarrationView_module_css_default = {
|
|
17187
|
-
"
|
|
17188
|
-
"
|
|
17189
|
-
"
|
|
17190
|
-
"note": "rp_NFPimG_note",
|
|
17191
|
-
"line": "rp_NFPimG_line",
|
|
19952
|
+
"oocNote": "rp_NFPimG_oocNote",
|
|
19953
|
+
"words": "rp_NFPimG_words",
|
|
19954
|
+
"images": "rp_NFPimG_images",
|
|
17192
19955
|
"imageError": "rp_NFPimG_imageError",
|
|
17193
|
-
"name": "rp_NFPimG_name",
|
|
17194
|
-
"playLine": "rp_NFPimG_playLine",
|
|
17195
|
-
"sceneImage": "rp_NFPimG_sceneImage",
|
|
17196
19956
|
"dice": "rp_NFPimG_dice",
|
|
17197
|
-
"narration": "rp_NFPimG_narration",
|
|
17198
|
-
"output": "rp_NFPimG_output",
|
|
17199
|
-
"oocNote": "rp_NFPimG_oocNote",
|
|
17200
19957
|
"oocRefused": "rp_NFPimG_oocRefused",
|
|
17201
|
-
"
|
|
19958
|
+
"diceSummary": "rp_NFPimG_diceSummary",
|
|
19959
|
+
"narration": "rp_NFPimG_narration",
|
|
19960
|
+
"diceList": "rp_NFPimG_diceList",
|
|
19961
|
+
"name": "rp_NFPimG_name",
|
|
19962
|
+
"sceneImage": "rp_NFPimG_sceneImage",
|
|
19963
|
+
"line": "rp_NFPimG_line",
|
|
19964
|
+
"playAll": "rp_NFPimG_playAll",
|
|
19965
|
+
"playLine": "rp_NFPimG_playLine",
|
|
19966
|
+
"avatar": "rp_NFPimG_avatar",
|
|
19967
|
+
"speech": "rp_NFPimG_speech",
|
|
17202
19968
|
"preview": "rp_NFPimG_preview",
|
|
17203
|
-
"words": "rp_NFPimG_words",
|
|
17204
|
-
"images": "rp_NFPimG_images",
|
|
17205
|
-
"imageButton": "rp_NFPimG_imageButton",
|
|
17206
19969
|
"imageStatus": "rp_NFPimG_imageStatus",
|
|
17207
|
-
"
|
|
17208
|
-
"
|
|
19970
|
+
"output": "rp_NFPimG_output",
|
|
19971
|
+
"note": "rp_NFPimG_note",
|
|
19972
|
+
"oocLabel": "rp_NFPimG_oocLabel",
|
|
19973
|
+
"imageButton": "rp_NFPimG_imageButton"
|
|
17209
19974
|
};
|
|
17210
19975
|
//#endregion
|
|
17211
19976
|
//#region src/client/transcript/PreviewNode.tsx
|
|
@@ -17472,8 +20237,8 @@ window.__ModuleLoader__.load({
|
|
|
17472
20237
|
var SuggestionsDock_module_css_default = {
|
|
17473
20238
|
"dock": "rp_rWH4DG_dock",
|
|
17474
20239
|
"chip": "rp_rWH4DG_chip",
|
|
17475
|
-
"card": "rp_rWH4DG_card",
|
|
17476
20240
|
"label": "rp_rWH4DG_label",
|
|
20241
|
+
"card": "rp_rWH4DG_card",
|
|
17477
20242
|
"lines": "rp_rWH4DG_lines"
|
|
17478
20243
|
};
|
|
17479
20244
|
//#endregion
|
|
@@ -17594,12 +20359,12 @@ window.__ModuleLoader__.load({
|
|
|
17594
20359
|
}
|
|
17595
20360
|
tag.textContent = css;
|
|
17596
20361
|
var TurnsDock_module_css_default = {
|
|
17597
|
-
"error": "rp_f4YLlq_error",
|
|
17598
|
-
"select": "rp_f4YLlq_select",
|
|
17599
|
-
"button": "rp_f4YLlq_button",
|
|
17600
20362
|
"group": "rp_f4YLlq_group",
|
|
17601
20363
|
"dock": "rp_f4YLlq_dock",
|
|
17602
|
-
"
|
|
20364
|
+
"error": "rp_f4YLlq_error",
|
|
20365
|
+
"count": "rp_f4YLlq_count",
|
|
20366
|
+
"select": "rp_f4YLlq_select",
|
|
20367
|
+
"button": "rp_f4YLlq_button"
|
|
17603
20368
|
};
|
|
17604
20369
|
//#endregion
|
|
17605
20370
|
//#region src/client/transcript/withdrawn.ts
|
|
@@ -17967,6 +20732,8 @@ window.__ModuleLoader__.load({
|
|
|
17967
20732
|
registerPanel(ctx);
|
|
17968
20733
|
registerWorldsPage(ctx);
|
|
17969
20734
|
registerAvatarsPage(ctx);
|
|
20735
|
+
registerPresetsPage(ctx);
|
|
20736
|
+
registerLorebooksPage(ctx);
|
|
17970
20737
|
registerCataloguePage(ctx);
|
|
17971
20738
|
registerSessionsPage(ctx);
|
|
17972
20739
|
registerTranscript(ctx);
|