@musnows/scriverse 0.5.11 → 0.5.12
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.js +23 -1
- package/dist/ai.js.map +1 -1
- package/dist/app.js +19 -1
- package/dist/app.js.map +1 -1
- package/dist/database.js +18 -0
- package/dist/database.js.map +1 -1
- package/dist/public/app.js +280 -63
- package/dist/public/index.html +2 -2
- package/dist/public/module-request-cache.d.ts +17 -0
- package/dist/public/module-request-cache.js +35 -0
- package/dist/public/stream-typewriter.d.ts +1 -1
- package/dist/public/stream-typewriter.js +16 -12
- package/dist/public/styles.css +10 -5
- package/dist/store.js +56 -16
- package/dist/store.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/writing-progress-time.js +71 -0
- package/dist/writing-progress-time.js.map +1 -0
- package/package.json +1 -1
package/dist/ai.js
CHANGED
|
@@ -1888,7 +1888,29 @@ export class AiManager {
|
|
|
1888
1888
|
const suggestionId = id("suggestion");
|
|
1889
1889
|
this.store.db.run(`INSERT INTO ai_suggestions (id, call_id, work_id, chapter_id, chapter_version, task_type, instruction,
|
|
1890
1890
|
source_text, content, action, status, created_at, created_by_user_id) VALUES (?, ?, ?, ?, ?, 'chat', ?, ?, ?, 'note', 'pending', ?, ?)`, suggestionId, generated.callId, input.workId, chapter ? String(chapter.id) : null, chapter ? Number(chapter.versionNo) : null, input.instruction, input.scope.selection ?? "", generated.content, now(), currentRequestActor()?.userId ?? null);
|
|
1891
|
-
|
|
1891
|
+
const modelDisplayName = typeof generated.model.displayName === "string" ? generated.model.displayName : undefined;
|
|
1892
|
+
const conversationMessage = input.conversationId && input.assistantMessageRequestId
|
|
1893
|
+
? this.store.addAiConversationMessage(input.conversationId, {
|
|
1894
|
+
role: "assistant",
|
|
1895
|
+
content: generated.content,
|
|
1896
|
+
requestId: input.assistantMessageRequestId,
|
|
1897
|
+
metadata: {
|
|
1898
|
+
...(modelDisplayName ? { modelDisplayName } : {}),
|
|
1899
|
+
outputTokens: generated.outputTokens,
|
|
1900
|
+
...(generated.cacheHitPercent === undefined ? {} : { cacheHitPercent: generated.cacheHitPercent }),
|
|
1901
|
+
toolCalls: generated.toolCalls,
|
|
1902
|
+
processSteps: generated.processSteps
|
|
1903
|
+
}
|
|
1904
|
+
})
|
|
1905
|
+
: null;
|
|
1906
|
+
return {
|
|
1907
|
+
...this.getSuggestion(suggestionId),
|
|
1908
|
+
outputTokens: generated.outputTokens,
|
|
1909
|
+
...(generated.cacheHitPercent === undefined ? {} : { cacheHitPercent: generated.cacheHitPercent }),
|
|
1910
|
+
toolCalls: generated.toolCalls,
|
|
1911
|
+
processSteps: generated.processSteps,
|
|
1912
|
+
...(conversationMessage ? { conversationMessage } : {})
|
|
1913
|
+
};
|
|
1892
1914
|
}
|
|
1893
1915
|
async runSuggestionGuard(suggestionId, candidateContent) {
|
|
1894
1916
|
const suggestion = this.getSuggestion(suggestionId);
|