@musnows/scriverse 0.8.1 → 0.8.2
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/dist/ai-conversation-export.js +3 -1
- package/dist/ai-conversation-export.js.map +1 -1
- package/dist/ai.js +50 -4
- package/dist/ai.js.map +1 -1
- package/dist/app.js +9 -4
- package/dist/app.js.map +1 -1
- package/dist/database.js +26 -2
- package/dist/database.js.map +1 -1
- package/dist/public/app.js +165 -19
- package/dist/public/index.html +10 -5
- package/dist/public/relationship-graph.js +11 -3
- package/dist/public/styles.css +14 -4
- package/dist/store.js +40 -6
- package/dist/store.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -964,7 +964,9 @@ function redactAiConversationMessage(item, permissions) {
|
|
|
964
964
|
}
|
|
965
965
|
/** 无正文读取权限时隐藏对话预览与消息正文,避免历史对话泄露章节原文。 */
|
|
966
966
|
function redactAiConversation(record, permissions) {
|
|
967
|
-
const readableRecord = permissions.characters === "none"
|
|
967
|
+
const readableRecord = permissions.characters === "none"
|
|
968
|
+
? { ...record, roleplayCharacter: null, roleplayUserCharacter: null }
|
|
969
|
+
: record;
|
|
968
970
|
const scopedRecord = redactAiCallContext(readableRecord, permissions);
|
|
969
971
|
const result = {
|
|
970
972
|
...scopedRecord
|
|
@@ -2461,7 +2463,7 @@ export function createRuntime(options) {
|
|
|
2461
2463
|
}).strict(), request.body);
|
|
2462
2464
|
const sourceConversation = store.getAiConversationSummary(request.params.conversationId);
|
|
2463
2465
|
const permissions = requestPermissions(request, String(sourceConversation.workId));
|
|
2464
|
-
if (sourceConversation.roleplayCharacter && !canReadWorkModule(permissions, "characters")) {
|
|
2466
|
+
if ((sourceConversation.roleplayCharacter || sourceConversation.roleplayUserCharacter) && !canReadWorkModule(permissions, "characters")) {
|
|
2465
2467
|
throw new AppError(403, "WORK_MODULE_READ_DENIED", "你没有读取“角色”模块的权限");
|
|
2466
2468
|
}
|
|
2467
2469
|
const forked = store.forkAiConversation(request.params.conversationId, input.messageId, input.title, input.requestId);
|
|
@@ -2480,8 +2482,11 @@ export function createRuntime(options) {
|
|
|
2480
2482
|
data(response, redactAiConversation(updated, permissions));
|
|
2481
2483
|
});
|
|
2482
2484
|
app.patch("/api/ai-conversations/:conversationId/roleplay", (request, response) => {
|
|
2483
|
-
const input = parse(z.object({
|
|
2484
|
-
|
|
2485
|
+
const input = parse(z.object({
|
|
2486
|
+
characterId: identifier.nullable(),
|
|
2487
|
+
userCharacterId: identifier.nullable().optional()
|
|
2488
|
+
}).strict(), request.body);
|
|
2489
|
+
const updated = store.setAiConversationRoleplayCharacter(request.params.conversationId, input.characterId, input.userCharacterId);
|
|
2485
2490
|
const permissions = requestPermissions(request, String(updated.workId));
|
|
2486
2491
|
data(response, redactAiConversation(updated, permissions));
|
|
2487
2492
|
});
|