briyah 1.2.4 → 1.2.5
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/README.md +55 -6
- package/data/common/config/image_models.json +160 -97
- package/data/common/config/markup +1 -1
- package/data/common/config/story_models.json +15 -3
- package/data/common/config/story_models_full.json +2 -2
- package/data/common/prompts/character/create_user_character.prompt +3 -12
- package/data/common/prompts/character/introduce_character.json +18 -0
- package/data/common/prompts/character/introduce_character.mock +4 -0
- package/data/common/prompts/character/introduce_character.prompt +58 -0
- package/data/common/prompts/character/perceive.prompt +3 -0
- package/data/common/prompts/character/progress_character.json +8 -4
- package/data/common/prompts/character/progress_character.mock +1 -0
- package/data/common/prompts/character/progress_character.prompt +20 -2
- package/data/common/prompts/character/update_portrait.json +18 -0
- package/data/common/prompts/character/update_portrait.mock +4 -0
- package/data/common/prompts/character/update_portrait.prompt +17 -1
- package/data/common/prompts/narrator/create_simple_plot.json +0 -0
- package/data/common/prompts/narrator/create_simple_plot.mock +13 -0
- package/data/common/prompts/narrator/create_simple_plot.prompt +35 -0
- package/data/common/prompts/narrator/perceive.prompt +12 -9
- package/data/common/prompts/narrator/progress_simple_plot.json +0 -0
- package/data/common/prompts/narrator/progress_simple_plot.mock +13 -0
- package/data/common/prompts/narrator/progress_simple_plot.prompt +40 -0
- package/data/common/prompts/perceive.json +1 -1
- package/data/common/prompts/perceive.prompt +82 -20
- package/data/common/prompts/story_moderator/moderate.json +1 -1
- package/data/common/prompts/story_moderator/moderate.prompt +26 -6
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +1 -1
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +13 -42
- package/dist-sdk/server/src/ai/LLM/deepseek.service.js +9 -0
- package/dist-sdk/server/src/ai/LLM/fal.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/googleai.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/grok.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/openai.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/together.service.js +1 -2
- package/dist-sdk/server/src/ai/agent-config.d.ts +2 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +8 -0
- package/dist-sdk/server/src/ai/agent.d.ts +2 -0
- package/dist-sdk/server/src/ai/agent.js +2 -0
- package/dist-sdk/server/src/ai/model_prices.js +2 -1
- package/dist-sdk/server/src/app/user-service-factory.js +7 -3
- package/dist-sdk/server/src/app.controller.d.ts +15 -4
- package/dist-sdk/server/src/app.controller.js +171 -5
- package/dist-sdk/server/src/app.service.d.ts +19 -5
- package/dist-sdk/server/src/app.service.js +50 -4
- package/dist-sdk/server/src/room/message.js +5 -1
- package/dist-sdk/server/src/room/room-factory.d.ts +5 -1
- package/dist-sdk/server/src/room/room-factory.js +6 -1
- package/dist-sdk/server/src/room/room-store.service.d.ts +5 -1
- package/dist-sdk/server/src/room/room-store.service.js +13 -2
- package/dist-sdk/server/src/room/room.d.ts +25 -4
- package/dist-sdk/server/src/room/room.js +379 -95
- package/dist-sdk/server/src/sdk/index.d.ts +1 -1
- package/dist-sdk/server/src/story/story.service.d.ts +5 -4
- package/dist-sdk/server/src/story/story.service.js +207 -120
- package/dist-sdk/server/src/tools/tool-execution.service.d.ts +19 -0
- package/dist-sdk/server/src/tools/tool-execution.service.js +100 -0
- package/dist-sdk/server/src/tools/tool-store.service.d.ts +17 -0
- package/dist-sdk/server/src/tools/tool-store.service.js +143 -0
- package/dist-sdk/shared/types/app.types.d.ts +44 -5
- package/dist-sdk/shared/types/app.types.js +3 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +0 -7
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Agent.html +22 -14
- package/docs/classes/Briyah.html +10 -10
- package/docs/classes/BriyahConfigService.html +5 -5
- package/docs/classes/Room.html +32 -26
- package/docs/classes/RoomMessage.html +10 -10
- package/docs/enums/MessageAction.html +6 -3
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +12 -5
- package/docs/interfaces/AgentInfo.html +3 -2
- package/docs/interfaces/AgentMessagesResponse.html +2 -2
- package/docs/interfaces/AppService.html +184 -149
- package/docs/interfaces/Artifact.html +3 -3
- package/docs/interfaces/ArtifactMetadata.html +2 -2
- package/docs/interfaces/AttachDocumentResponse.html +2 -2
- package/docs/interfaces/BriyahConfigOptions.html +7 -7
- package/docs/interfaces/ChapterInfo.html +2 -2
- package/docs/interfaces/Character.html +2 -2
- package/docs/interfaces/CreateAgentResponse.html +2 -2
- package/docs/interfaces/CreateRoomResponse.html +2 -2
- package/docs/interfaces/CreateStoryResponse.html +2 -2
- package/docs/interfaces/FileList.html +2 -2
- package/docs/interfaces/FileMetadata.html +3 -3
- package/docs/interfaces/IConfigService.html +3 -3
- package/docs/interfaces/LoggingOptions.html +6 -6
- package/docs/interfaces/Message.html +2 -2
- package/docs/interfaces/ModelInfo.html +2 -3
- package/docs/interfaces/PreparedPromptResponse.html +2 -2
- package/docs/interfaces/ProcessTextResponse.html +2 -2
- package/docs/interfaces/PromptFile.html +2 -2
- package/docs/interfaces/PromptFileContent.html +2 -2
- package/docs/interfaces/PromptFilesResponse.html +2 -2
- package/docs/interfaces/PromptFolder.html +2 -2
- package/docs/interfaces/PromptFoldersResponse.html +2 -2
- package/docs/interfaces/RoomDetails.html +2 -2
- package/docs/interfaces/RoomInfo.html +2 -2
- package/docs/interfaces/RoomMessagesResponse.html +2 -2
- package/docs/interfaces/StoryErrorEvent.html +3 -3
- package/docs/interfaces/StoryIdea.html +2 -2
- package/docs/interfaces/StoryInfo.html +5 -4
- package/docs/interfaces/StoryIntroduceCharacterEvent.html +3 -3
- package/docs/interfaces/StoryProgressChapterEvent.html +3 -3
- package/docs/interfaces/StoryState.html +5 -5
- package/docs/interfaces/StoryStateEvent.html +3 -3
- package/docs/interfaces/ToolDefinition.html +6 -0
- package/docs/interfaces/ToolParameter.html +5 -0
- package/docs/interfaces/ToolsResponse.html +2 -0
- package/docs/interfaces/Transaction.html +2 -2
- package/docs/interfaces/TransactionHistoryResponse.html +2 -2
- package/docs/modules.html +1 -1
- package/docs/types/PromptScope.html +1 -1
- package/docs/types/ToolRunResult.html +1 -0
- package/package.json +2 -1
|
@@ -13,6 +13,7 @@ exports.DeepSeekAiService = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const deepseek_1 = require("@ai-sdk/deepseek");
|
|
15
15
|
const ai_1 = require("ai");
|
|
16
|
+
const jsonrepair_1 = require("jsonrepair");
|
|
16
17
|
const base_ai_service_1 = require("./base-ai.service");
|
|
17
18
|
const zod_1 = require("zod");
|
|
18
19
|
const model_prices_1 = require("../model_prices");
|
|
@@ -201,6 +202,14 @@ let DeepSeekAiService = class DeepSeekAiService extends base_ai_service_1.BaseAi
|
|
|
201
202
|
messages: messages,
|
|
202
203
|
temperature: 0,
|
|
203
204
|
schema: this.jsonSchemaToZod(jsonSchema),
|
|
205
|
+
experimental_repairText: async ({ text }) => {
|
|
206
|
+
try {
|
|
207
|
+
return (0, jsonrepair_1.jsonrepair)(text);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
},
|
|
204
213
|
providerOptions: {
|
|
205
214
|
deepseek: {
|
|
206
215
|
reasoningEffort: reasoningEffort,
|
|
@@ -151,7 +151,6 @@ let FalAiService = class FalAiService extends base_ai_service_1.BaseAiService {
|
|
|
151
151
|
estimatedOutputTokens = Math.ceil(responseText.length / 4);
|
|
152
152
|
if (jsonSchema) {
|
|
153
153
|
responseText = this.trimToJson(responseText);
|
|
154
|
-
responseText = this.sanitizeJsonString(responseText);
|
|
155
154
|
}
|
|
156
155
|
else {
|
|
157
156
|
responseText = this.trimResponseText(responseText);
|
|
@@ -179,7 +178,7 @@ let FalAiService = class FalAiService extends base_ai_service_1.BaseAiService {
|
|
|
179
178
|
}
|
|
180
179
|
if (jsonSchema) {
|
|
181
180
|
try {
|
|
182
|
-
return
|
|
181
|
+
return this.parseStructuredResponse(responseText);
|
|
183
182
|
}
|
|
184
183
|
catch (parseError) {
|
|
185
184
|
logger_1.logger.error('Failed to parse JSON response:', parseError);
|
|
@@ -133,7 +133,6 @@ let GoogleAiService = class GoogleAiService extends base_ai_service_1.BaseAiServ
|
|
|
133
133
|
}
|
|
134
134
|
if (jsonSchema) {
|
|
135
135
|
responseText = this.trimToJson(responseText);
|
|
136
|
-
responseText = this.sanitizeJsonString(responseText);
|
|
137
136
|
}
|
|
138
137
|
else {
|
|
139
138
|
responseText = this.trimResponseText(responseText);
|
|
@@ -152,7 +151,7 @@ let GoogleAiService = class GoogleAiService extends base_ai_service_1.BaseAiServ
|
|
|
152
151
|
this.addToConversationHistory(agent, responseText, true);
|
|
153
152
|
}
|
|
154
153
|
if (jsonSchema) {
|
|
155
|
-
return
|
|
154
|
+
return this.parseStructuredResponse(responseText);
|
|
156
155
|
}
|
|
157
156
|
return responseText;
|
|
158
157
|
}
|
|
@@ -194,7 +194,6 @@ let GrokAiService = class GrokAiService extends base_ai_service_1.BaseAiService
|
|
|
194
194
|
}
|
|
195
195
|
if (jsonSchema) {
|
|
196
196
|
responseText = this.trimToJson(responseText);
|
|
197
|
-
responseText = this.sanitizeJsonString(responseText);
|
|
198
197
|
}
|
|
199
198
|
this.debugLogResponse(agent.agentName, responseText);
|
|
200
199
|
if (response.usage) {
|
|
@@ -210,7 +209,7 @@ let GrokAiService = class GrokAiService extends base_ai_service_1.BaseAiService
|
|
|
210
209
|
this.addToConversationHistory(agent, responseText, true);
|
|
211
210
|
}
|
|
212
211
|
if (jsonSchema)
|
|
213
|
-
return
|
|
212
|
+
return this.parseStructuredResponse(responseText);
|
|
214
213
|
return responseText;
|
|
215
214
|
}
|
|
216
215
|
addToConversationHistory(agent, message, fromSelf = false, developer = false) {
|
|
@@ -211,7 +211,6 @@ let OpenAiService = class OpenAiService extends base_ai_service_1.BaseAiService
|
|
|
211
211
|
response = await this.openai.responses.create(requestParams);
|
|
212
212
|
if (jsonSchema) {
|
|
213
213
|
responseText = this.trimToJson(response.output_text);
|
|
214
|
-
responseText = this.sanitizeJsonString(responseText);
|
|
215
214
|
}
|
|
216
215
|
else {
|
|
217
216
|
responseText = response.output_text;
|
|
@@ -230,7 +229,7 @@ let OpenAiService = class OpenAiService extends base_ai_service_1.BaseAiService
|
|
|
230
229
|
this.addToConversationHistory(agent, responseText, true);
|
|
231
230
|
}
|
|
232
231
|
if (jsonSchema)
|
|
233
|
-
return
|
|
232
|
+
return this.parseStructuredResponse(responseText);
|
|
234
233
|
return responseText;
|
|
235
234
|
}
|
|
236
235
|
async attachDocument(agent, fileName, fileData) {
|
|
@@ -138,7 +138,6 @@ let TogetherAiService = class TogetherAiService extends base_ai_service_1.BaseAi
|
|
|
138
138
|
}
|
|
139
139
|
if (jsonSchema) {
|
|
140
140
|
responseText = this.trimToJson(responseText);
|
|
141
|
-
responseText = this.sanitizeJsonString(responseText);
|
|
142
141
|
}
|
|
143
142
|
else {
|
|
144
143
|
responseText = this.trimResponseText(responseText);
|
|
@@ -157,7 +156,7 @@ let TogetherAiService = class TogetherAiService extends base_ai_service_1.BaseAi
|
|
|
157
156
|
this.addToConversationHistory(agent, responseText, true);
|
|
158
157
|
}
|
|
159
158
|
if (jsonSchema) {
|
|
160
|
-
return
|
|
159
|
+
return this.parseStructuredResponse(responseText);
|
|
161
160
|
}
|
|
162
161
|
return responseText;
|
|
163
162
|
}
|
|
@@ -4,6 +4,7 @@ export interface AgentConfig {
|
|
|
4
4
|
agentName: string;
|
|
5
5
|
agentNickname: string;
|
|
6
6
|
description: string;
|
|
7
|
+
privateContext?: string;
|
|
7
8
|
promptFolder: string;
|
|
8
9
|
systemInstruction: string;
|
|
9
10
|
modelName: string;
|
|
@@ -30,4 +31,5 @@ export interface AgentConfig {
|
|
|
30
31
|
beginInstruction?: string;
|
|
31
32
|
promptCacheTTL?: number;
|
|
32
33
|
ownerRoomId?: string;
|
|
34
|
+
toolNames?: string[];
|
|
33
35
|
}
|
|
@@ -140,12 +140,14 @@ let AgentStoreService = class AgentStoreService {
|
|
|
140
140
|
instance.totalOutputTokens = 0;
|
|
141
141
|
instance.totalCost = 0;
|
|
142
142
|
instance.totalMarkup = 0;
|
|
143
|
+
instance.privateContext = template.privateContext;
|
|
143
144
|
instance.attachedFiles = [...template.attachedFiles];
|
|
144
145
|
instance.attachedArtifacts = [...template.attachedArtifacts];
|
|
145
146
|
instance.maxHistoryMessages = template.maxHistoryMessages;
|
|
146
147
|
instance.promptCacheTTL = template.promptCacheTTL;
|
|
147
148
|
instance.markupRate = template.markupRate;
|
|
148
149
|
instance.smallModelName = template.smallModelName;
|
|
150
|
+
instance.toolNames = [...template.toolNames];
|
|
149
151
|
this.storeAgent(instance);
|
|
150
152
|
return instanceId;
|
|
151
153
|
}
|
|
@@ -173,6 +175,7 @@ let AgentStoreService = class AgentStoreService {
|
|
|
173
175
|
throw new Error(`Instance ${instanceId} does not belong to template ${templateId}`);
|
|
174
176
|
}
|
|
175
177
|
instance.description = template.description;
|
|
178
|
+
instance.privateContext = template.privateContext;
|
|
176
179
|
instance.agentNickname = template.agentNickname;
|
|
177
180
|
instance.promptFolder = template.promptFolder;
|
|
178
181
|
instance.systemInstruction = template.systemInstruction;
|
|
@@ -188,6 +191,7 @@ let AgentStoreService = class AgentStoreService {
|
|
|
188
191
|
instance.maxHistoryMessages = template.maxHistoryMessages;
|
|
189
192
|
instance.promptCacheTTL = template.promptCacheTTL;
|
|
190
193
|
instance.markupRate = template.markupRate;
|
|
194
|
+
instance.toolNames = [...template.toolNames];
|
|
191
195
|
instance.history = [];
|
|
192
196
|
instance.totalInputTokens = 0;
|
|
193
197
|
instance.totalOutputTokens = 0;
|
|
@@ -236,6 +240,7 @@ let AgentStoreService = class AgentStoreService {
|
|
|
236
240
|
const aiService = this.aiFactoryService.createAiService(config.serviceName);
|
|
237
241
|
const finalArtifactService = artifactService || this.artifactService;
|
|
238
242
|
const agent = new agent_1.Agent(config.id, this.userPaths, this.configService, this, this.balanceService, finalArtifactService, config.agentName, config.agentNickname || config.agentName, config.description, config.promptFolder, config.systemInstruction, config.history || [], config.modelName, config.serviceName, aiService, config.reasoningEffort, config.allowSearch, config.maxOutputTokens, config.beginInstruction || '', storageDir);
|
|
243
|
+
agent.privateContext = config.privateContext || '';
|
|
239
244
|
agent.createdAt = new Date(config.createdAt);
|
|
240
245
|
agent.userPaths = this.userPaths;
|
|
241
246
|
agent.smallModelName = config.smallModelName;
|
|
@@ -255,6 +260,7 @@ let AgentStoreService = class AgentStoreService {
|
|
|
255
260
|
agent.beginInstruction = config.beginInstruction || '';
|
|
256
261
|
agent.maxHistoryMessages = config.maxHistoryMessages || undefined;
|
|
257
262
|
agent.promptCacheTTL = Number(config.promptCacheTTL) ?? 0;
|
|
263
|
+
agent.toolNames = config.toolNames || [];
|
|
258
264
|
agent.id = config.id;
|
|
259
265
|
this.agents.set(config.id, agent);
|
|
260
266
|
if (config.attachedFiles && config.attachedFiles.length > 0) {
|
|
@@ -305,6 +311,7 @@ let AgentStoreService = class AgentStoreService {
|
|
|
305
311
|
agentName: agent.agentName,
|
|
306
312
|
agentNickname: agent.agentNickname,
|
|
307
313
|
description: agent.description,
|
|
314
|
+
privateContext: agent.privateContext,
|
|
308
315
|
promptFolder: agent.promptFolder,
|
|
309
316
|
systemInstruction: agent.systemInstruction,
|
|
310
317
|
modelName: agent.modelName,
|
|
@@ -331,6 +338,7 @@ let AgentStoreService = class AgentStoreService {
|
|
|
331
338
|
beginInstruction: agent.beginInstruction,
|
|
332
339
|
promptCacheTTL: agent.promptCacheTTL,
|
|
333
340
|
ownerRoomId: agent.ownerRoomId,
|
|
341
|
+
toolNames: agent.toolNames,
|
|
334
342
|
};
|
|
335
343
|
const filePath = path.join(storageDir, `${agent.id}.json`);
|
|
336
344
|
fs.writeFileSync(filePath, JSON.stringify(config, null, 2), 'utf-8');
|
|
@@ -36,6 +36,7 @@ export declare class Agent {
|
|
|
36
36
|
configService: IConfigService;
|
|
37
37
|
balanceService?: BalanceService;
|
|
38
38
|
description: string;
|
|
39
|
+
privateContext: string;
|
|
39
40
|
promptFolder: string;
|
|
40
41
|
systemInstruction: string;
|
|
41
42
|
maxHistoryMessages?: number;
|
|
@@ -49,6 +50,7 @@ export declare class Agent {
|
|
|
49
50
|
attachedArtifacts: string[];
|
|
50
51
|
isControlledByHuman: boolean;
|
|
51
52
|
beginInstruction: string;
|
|
53
|
+
toolNames: string[];
|
|
52
54
|
promptCacheTTL: number;
|
|
53
55
|
private onStateChange;
|
|
54
56
|
storageDir: string;
|
|
@@ -34,6 +34,7 @@ class Agent {
|
|
|
34
34
|
configService;
|
|
35
35
|
balanceService;
|
|
36
36
|
description;
|
|
37
|
+
privateContext = '';
|
|
37
38
|
promptFolder;
|
|
38
39
|
systemInstruction;
|
|
39
40
|
maxHistoryMessages;
|
|
@@ -47,6 +48,7 @@ class Agent {
|
|
|
47
48
|
attachedArtifacts = [];
|
|
48
49
|
isControlledByHuman = false;
|
|
49
50
|
beginInstruction = '';
|
|
51
|
+
toolNames = [];
|
|
50
52
|
promptCacheTTL = 0;
|
|
51
53
|
onStateChange = null;
|
|
52
54
|
storageDir;
|
|
@@ -89,5 +89,6 @@ function resolveModelInfo(modelName, prefix) {
|
|
|
89
89
|
function isKnownModel(modelName, prefix) {
|
|
90
90
|
if (resolveModelInfo(modelName, prefix) !== null)
|
|
91
91
|
return true;
|
|
92
|
-
return getImageModels().some((m) => m.model === modelName && m.centsPerImage != null)
|
|
92
|
+
return getImageModels().some((m) => (m.generation?.model === modelName && m.generation?.centsPerImage != null) ||
|
|
93
|
+
(m.editing?.model === modelName && m.editing?.centsPerImage != null));
|
|
93
94
|
}
|
|
@@ -33,6 +33,8 @@ const balance_message_service_1 = require("./balance-message.service");
|
|
|
33
33
|
const transaction_service_1 = require("./transaction.service");
|
|
34
34
|
const agent_factory_1 = require("../ai/agent-factory");
|
|
35
35
|
const room_factory_1 = require("../room/room-factory");
|
|
36
|
+
const tool_store_service_1 = require("../tools/tool-store.service");
|
|
37
|
+
const tool_execution_service_1 = require("../tools/tool-execution.service");
|
|
36
38
|
let UserServiceFactory = class UserServiceFactory {
|
|
37
39
|
aiFactoryService;
|
|
38
40
|
agentMessageService;
|
|
@@ -63,11 +65,13 @@ let UserServiceFactory = class UserServiceFactory {
|
|
|
63
65
|
const agentStore = new agent_store_service_1.AgentStoreService(this.aiFactoryService, userPaths, attachedFileService, balanceService, artifactService, this.configService);
|
|
64
66
|
const agentFactory = new agent_factory_1.AgentFactory(this.aiFactoryService, agentStore, userPaths, balanceService, artifactService, this.configService);
|
|
65
67
|
const artifactStore = new artifact_store_service_1.ArtifactStoreService();
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
+
const toolStore = new tool_store_service_1.ToolStoreService(userPaths);
|
|
69
|
+
const toolExecution = new tool_execution_service_1.ToolExecutionService(toolStore);
|
|
70
|
+
const roomStore = new room_store_service_1.RoomStoreService(userPaths, agentStore, attachedFileService, artifactStore, toolStore, toolExecution);
|
|
71
|
+
const roomFactory = new room_factory_1.RoomFactory(roomStore, toolStore, toolExecution);
|
|
68
72
|
const storyStore = new story_store_service_1.StoryStoreService(userPaths, roomStore);
|
|
69
73
|
const storyService = new story_service_1.StoryService(storyStore, agentStore, roomStore, this.storyProgressService, this.storyMessageService, userPaths, agentFactory, roomFactory);
|
|
70
|
-
return new app_service_1.AppService(this.aiFactoryService, agentStore, this.agentMessageService, roomStore, this.roomMessageService, userPaths, attachedFileService, artifactService, storyStore, storyService, this.publishedAgentsService, this.publishedRoomsService, balanceService, this.balanceMessageService, transactionService, agentFactory, roomFactory);
|
|
74
|
+
return new app_service_1.AppService(this.aiFactoryService, agentStore, this.agentMessageService, roomStore, this.roomMessageService, userPaths, attachedFileService, artifactService, storyStore, storyService, this.publishedAgentsService, this.publishedRoomsService, balanceService, this.balanceMessageService, transactionService, agentFactory, roomFactory, toolStore, toolExecution);
|
|
71
75
|
}
|
|
72
76
|
};
|
|
73
77
|
exports.UserServiceFactory = UserServiceFactory;
|
|
@@ -5,7 +5,7 @@ import { UserServiceManager } from './app/user-service-manager';
|
|
|
5
5
|
import { PublishedAgentsService } from './ai/published-agents.service';
|
|
6
6
|
import { PublishedRoomsService } from './room/published-rooms.service';
|
|
7
7
|
import { LibraryService } from './library/library.service';
|
|
8
|
-
import { AgentInfo, CreateAgentResponse, UpdateAgentRequest, RoomInfo, RoomDetails, CreateRoomResponse, AgentMessagesResponse, RoomMessagesResponse, FileList, PromptFileContent, PromptFoldersResponse, PromptFilesResponse, PromptScope, CreatePromptFolderRequest, CreatePromptFileRequest, UpdatePromptFileRequest, ProcessTextResponse, PreparedPromptResponse, AttachDocumentResponse, StoryInfo, StoryState, Character, ModelInfo, StoryModelDefaults, ChapterInfo, StoryIdea, LibraryPromptsResponse, LibraryFilesResponse, LibraryFileContent, LibraryDefaultUrlResponse, CopyFromLibraryRequest } from '../../shared/types/app.types';
|
|
8
|
+
import { AgentInfo, CreateAgentResponse, UpdateAgentRequest, RoomInfo, RoomDetails, CreateRoomResponse, AgentMessagesResponse, RoomMessagesResponse, FileList, PromptFileContent, PromptFoldersResponse, PromptFilesResponse, PromptScope, CreatePromptFolderRequest, CreatePromptFileRequest, UpdatePromptFileRequest, ProcessTextResponse, PreparedPromptResponse, AttachDocumentResponse, StoryInfo, StoryState, Character, ModelInfo, ImageModelOption, StoryModelDefaults, ChapterInfo, StoryIdea, LibraryPromptsResponse, LibraryFilesResponse, LibraryFileContent, LibraryDefaultUrlResponse, CopyFromLibraryRequest, ToolDefinition, ToolsResponse, ToolRunResult, ToolTestRequest } from '../../shared/types/app.types';
|
|
9
9
|
import { RoomMessage } from './room/message';
|
|
10
10
|
export declare class AppController {
|
|
11
11
|
private readonly userServiceManager;
|
|
@@ -16,9 +16,9 @@ export declare class AppController {
|
|
|
16
16
|
private getAppService;
|
|
17
17
|
listServices(req: ExpressRequest): string[];
|
|
18
18
|
listModels(req: ExpressRequest, aiServiceName: string): Promise<ModelInfo[]>;
|
|
19
|
-
listImageModels(req: ExpressRequest): Promise<
|
|
19
|
+
listImageModels(req: ExpressRequest): Promise<ImageModelOption[]>;
|
|
20
20
|
listStoryModels(req: ExpressRequest): Promise<ModelInfo[]>;
|
|
21
|
-
listStoryModelDefaults(
|
|
21
|
+
listStoryModelDefaults(req: ExpressRequest): Promise<StoryModelDefaults>;
|
|
22
22
|
createAgent(req: ExpressRequest, body: {
|
|
23
23
|
aiServiceName: string;
|
|
24
24
|
agentName: string;
|
|
@@ -46,6 +46,11 @@ export declare class AppController {
|
|
|
46
46
|
createPromptFile(req: ExpressRequest, folderName: string, body: CreatePromptFileRequest): Promise<void>;
|
|
47
47
|
updatePromptFile(req: ExpressRequest, folderName: string, fileName: string, body: UpdatePromptFileRequest): Promise<void>;
|
|
48
48
|
deletePromptFile(req: ExpressRequest, folderName: string, fileName: string): Promise<void>;
|
|
49
|
+
getTools(req: ExpressRequest): Promise<ToolsResponse>;
|
|
50
|
+
createTool(req: ExpressRequest, body: ToolDefinition): Promise<ToolDefinition>;
|
|
51
|
+
updateTool(req: ExpressRequest, name: string, body: ToolDefinition): Promise<ToolDefinition>;
|
|
52
|
+
deleteTool(req: ExpressRequest, name: string): Promise<void>;
|
|
53
|
+
testTool(req: ExpressRequest, name: string, body: ToolTestRequest): Promise<ToolRunResult>;
|
|
49
54
|
listLibraryPrompts(): LibraryPromptsResponse;
|
|
50
55
|
listLibraryFiles(folder: string): LibraryFilesResponse;
|
|
51
56
|
getLibraryFile(folder: string, file: string): LibraryFileContent;
|
|
@@ -155,7 +160,7 @@ export declare class AppController {
|
|
|
155
160
|
storyModel?: string;
|
|
156
161
|
isImport?: boolean;
|
|
157
162
|
imageModelName?: string;
|
|
158
|
-
|
|
163
|
+
skipDetailedPlot?: boolean;
|
|
159
164
|
}): Promise<StoryInfo>;
|
|
160
165
|
importStoryZip(req: ExpressRequest, file: Express.Multer.File): Promise<StoryInfo>;
|
|
161
166
|
deleteStory(req: ExpressRequest, storyId: string): Promise<void>;
|
|
@@ -197,6 +202,12 @@ export declare class AppController {
|
|
|
197
202
|
saveCharacter(req: ExpressRequest, storyId: string, characterName: string, body: {
|
|
198
203
|
content: string;
|
|
199
204
|
}): Promise<void>;
|
|
205
|
+
getCharacterInventory(req: ExpressRequest, storyId: string, characterName: string): Promise<{
|
|
206
|
+
content: string;
|
|
207
|
+
}>;
|
|
208
|
+
saveCharacterInventory(req: ExpressRequest, storyId: string, characterName: string, body: {
|
|
209
|
+
content: string;
|
|
210
|
+
}): Promise<void>;
|
|
200
211
|
getPlotPlan(req: ExpressRequest, storyId: string): Promise<{
|
|
201
212
|
content: string;
|
|
202
213
|
}>;
|
|
@@ -128,11 +128,23 @@ let AppController = class AppController {
|
|
|
128
128
|
throw new common_1.HttpException('Failed to list story models', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
listStoryModelDefaults(
|
|
131
|
+
async listStoryModelDefaults(req) {
|
|
132
|
+
const appService = this.getAppService(req);
|
|
133
|
+
const imageModels = await appService.listImageModels();
|
|
134
|
+
const resolveImageDefault = (envName) => {
|
|
135
|
+
const exact = imageModels.find((m) => m.name === envName);
|
|
136
|
+
if (exact)
|
|
137
|
+
return exact.name;
|
|
138
|
+
if (envName) {
|
|
139
|
+
const ci = imageModels.find((m) => m.name.toLowerCase() === envName.toLowerCase());
|
|
140
|
+
if (ci)
|
|
141
|
+
return ci.name;
|
|
142
|
+
}
|
|
143
|
+
return imageModels[0]?.name ?? '';
|
|
144
|
+
};
|
|
132
145
|
return {
|
|
133
146
|
selectedStoryModel: process.env.DEFAULT_STORY_MODEL,
|
|
134
|
-
selectedImageModel: process.env.DEFAULT_IMAGE_MODEL,
|
|
135
|
-
selectedImageEditModel: process.env.DEFAULT_IMAGE_EDIT_MODEL,
|
|
147
|
+
selectedImageModel: resolveImageDefault(process.env.DEFAULT_IMAGE_MODEL),
|
|
136
148
|
enforceDefaultModels: process.env.ENFORCE_DEFAULT_MODELS === 'true',
|
|
137
149
|
};
|
|
138
150
|
}
|
|
@@ -350,6 +362,68 @@ let AppController = class AppController {
|
|
|
350
362
|
throw new common_1.HttpException('Failed to delete prompt file', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
351
363
|
}
|
|
352
364
|
}
|
|
365
|
+
async getTools(req) {
|
|
366
|
+
try {
|
|
367
|
+
const appService = this.getAppService(req);
|
|
368
|
+
return { tools: await appService.listTools() };
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
logger_1.logger.error(`[${req.user?.sub}] Error listing tools:`, error);
|
|
372
|
+
return { tools: [] };
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async createTool(req, body) {
|
|
376
|
+
if (!body.name) {
|
|
377
|
+
throw new common_1.BadRequestException('Tool name is required');
|
|
378
|
+
}
|
|
379
|
+
try {
|
|
380
|
+
const appService = this.getAppService(req);
|
|
381
|
+
return await appService.createTool(body);
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
logger_1.logger.error(`[${req.user?.sub}] Error creating tool ${body.name}:`, error);
|
|
385
|
+
if (error instanceof errors_1.OperationFailedError) {
|
|
386
|
+
throw new common_1.ConflictException(error.message);
|
|
387
|
+
}
|
|
388
|
+
throw new common_1.HttpException(error.message || 'Failed to create tool', common_1.HttpStatus.BAD_REQUEST);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
async updateTool(req, name, body) {
|
|
392
|
+
try {
|
|
393
|
+
const appService = this.getAppService(req);
|
|
394
|
+
return await appService.updateTool(name, body);
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
logger_1.logger.error(`[${req.user?.sub}] Error updating tool ${name}:`, error);
|
|
398
|
+
if (error instanceof errors_1.NotFoundError) {
|
|
399
|
+
throw new common_1.NotFoundException(error.message);
|
|
400
|
+
}
|
|
401
|
+
throw new common_1.HttpException(error.message || 'Failed to update tool', common_1.HttpStatus.BAD_REQUEST);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
async deleteTool(req, name) {
|
|
405
|
+
try {
|
|
406
|
+
const appService = this.getAppService(req);
|
|
407
|
+
await appService.deleteTool(name);
|
|
408
|
+
}
|
|
409
|
+
catch (error) {
|
|
410
|
+
logger_1.logger.error(`[${req.user?.sub}] Error deleting tool ${name}:`, error);
|
|
411
|
+
if (error instanceof errors_1.NotFoundError) {
|
|
412
|
+
throw new common_1.NotFoundException(error.message);
|
|
413
|
+
}
|
|
414
|
+
throw new common_1.HttpException('Failed to delete tool', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
async testTool(req, name, body) {
|
|
418
|
+
try {
|
|
419
|
+
const appService = this.getAppService(req);
|
|
420
|
+
return await appService.testTool(name, body?.args || {});
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
logger_1.logger.error(`[${req.user?.sub}] Error testing tool ${name}:`, error);
|
|
424
|
+
return { ok: false, error: error.message || 'Tool test failed' };
|
|
425
|
+
}
|
|
426
|
+
}
|
|
353
427
|
listLibraryPrompts() {
|
|
354
428
|
return { prompts: this.libraryService.listLocalPrompts() };
|
|
355
429
|
}
|
|
@@ -1154,7 +1228,7 @@ let AppController = class AppController {
|
|
|
1154
1228
|
}
|
|
1155
1229
|
try {
|
|
1156
1230
|
const appService = this.getAppService(req);
|
|
1157
|
-
return appService.createStory(body.name, body.idea, body.userCharacterDesc, body.otherCharactersDesc, body.illustrateStory ?? true, body.storyModel, body.isImport, body.imageModelName, body.
|
|
1231
|
+
return appService.createStory(body.name, body.idea, body.userCharacterDesc, body.otherCharactersDesc, body.illustrateStory ?? true, body.storyModel, body.isImport, body.imageModelName, body.skipDetailedPlot ?? false);
|
|
1158
1232
|
}
|
|
1159
1233
|
catch (error) {
|
|
1160
1234
|
logger_1.logger.error(`[${req.user?.sub}] Error creating story ${body.name}:`, error);
|
|
@@ -1476,6 +1550,35 @@ let AppController = class AppController {
|
|
|
1476
1550
|
throw new common_1.HttpException('Failed to save character', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
1477
1551
|
}
|
|
1478
1552
|
}
|
|
1553
|
+
async getCharacterInventory(req, storyId, characterName) {
|
|
1554
|
+
try {
|
|
1555
|
+
const appService = this.getAppService(req);
|
|
1556
|
+
return await appService.getCharacterInventory(storyId, characterName);
|
|
1557
|
+
}
|
|
1558
|
+
catch (error) {
|
|
1559
|
+
logger_1.logger.error(`[${req.user?.sub}] Error getting inventory for character ${characterName} in story ${storyId}:`, error);
|
|
1560
|
+
return { content: '' };
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
async saveCharacterInventory(req, storyId, characterName, body) {
|
|
1564
|
+
if (body.content === undefined || body.content === null) {
|
|
1565
|
+
throw new common_1.BadRequestException('Content is required');
|
|
1566
|
+
}
|
|
1567
|
+
try {
|
|
1568
|
+
const appService = this.getAppService(req);
|
|
1569
|
+
await appService.saveCharacterInventory(storyId, characterName, body.content);
|
|
1570
|
+
}
|
|
1571
|
+
catch (error) {
|
|
1572
|
+
logger_1.logger.error(`[${req.user?.sub}] Error saving inventory for character ${characterName} in story ${storyId}:`, error);
|
|
1573
|
+
if (error instanceof errors_1.NotFoundError) {
|
|
1574
|
+
throw new common_1.NotFoundException(error.message);
|
|
1575
|
+
}
|
|
1576
|
+
if (error instanceof errors_1.OperationFailedError) {
|
|
1577
|
+
throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
1578
|
+
}
|
|
1579
|
+
throw new common_1.HttpException('Failed to save inventory', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1479
1582
|
async getPlotPlan(req, storyId) {
|
|
1480
1583
|
try {
|
|
1481
1584
|
const appService = this.getAppService(req);
|
|
@@ -1861,7 +1964,7 @@ __decorate([
|
|
|
1861
1964
|
__param(0, (0, common_1.Request)()),
|
|
1862
1965
|
__metadata("design:type", Function),
|
|
1863
1966
|
__metadata("design:paramtypes", [Object]),
|
|
1864
|
-
__metadata("design:returntype",
|
|
1967
|
+
__metadata("design:returntype", Promise)
|
|
1865
1968
|
], AppController.prototype, "listStoryModelDefaults", null);
|
|
1866
1969
|
__decorate([
|
|
1867
1970
|
(0, common_1.Post)('agents'),
|
|
@@ -1976,6 +2079,49 @@ __decorate([
|
|
|
1976
2079
|
__metadata("design:paramtypes", [Object, String, String]),
|
|
1977
2080
|
__metadata("design:returntype", Promise)
|
|
1978
2081
|
], AppController.prototype, "deletePromptFile", null);
|
|
2082
|
+
__decorate([
|
|
2083
|
+
(0, common_1.Get)('tools'),
|
|
2084
|
+
__param(0, (0, common_1.Request)()),
|
|
2085
|
+
__metadata("design:type", Function),
|
|
2086
|
+
__metadata("design:paramtypes", [Object]),
|
|
2087
|
+
__metadata("design:returntype", Promise)
|
|
2088
|
+
], AppController.prototype, "getTools", null);
|
|
2089
|
+
__decorate([
|
|
2090
|
+
(0, common_1.Post)('tools'),
|
|
2091
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
|
2092
|
+
__param(0, (0, common_1.Request)()),
|
|
2093
|
+
__param(1, (0, common_1.Body)()),
|
|
2094
|
+
__metadata("design:type", Function),
|
|
2095
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
2096
|
+
__metadata("design:returntype", Promise)
|
|
2097
|
+
], AppController.prototype, "createTool", null);
|
|
2098
|
+
__decorate([
|
|
2099
|
+
(0, common_1.Put)('tools/:name'),
|
|
2100
|
+
__param(0, (0, common_1.Request)()),
|
|
2101
|
+
__param(1, (0, common_1.Param)('name')),
|
|
2102
|
+
__param(2, (0, common_1.Body)()),
|
|
2103
|
+
__metadata("design:type", Function),
|
|
2104
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
2105
|
+
__metadata("design:returntype", Promise)
|
|
2106
|
+
], AppController.prototype, "updateTool", null);
|
|
2107
|
+
__decorate([
|
|
2108
|
+
(0, common_1.Delete)('tools/:name'),
|
|
2109
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
2110
|
+
__param(0, (0, common_1.Request)()),
|
|
2111
|
+
__param(1, (0, common_1.Param)('name')),
|
|
2112
|
+
__metadata("design:type", Function),
|
|
2113
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
2114
|
+
__metadata("design:returntype", Promise)
|
|
2115
|
+
], AppController.prototype, "deleteTool", null);
|
|
2116
|
+
__decorate([
|
|
2117
|
+
(0, common_1.Post)('tools/:name/test'),
|
|
2118
|
+
__param(0, (0, common_1.Request)()),
|
|
2119
|
+
__param(1, (0, common_1.Param)('name')),
|
|
2120
|
+
__param(2, (0, common_1.Body)()),
|
|
2121
|
+
__metadata("design:type", Function),
|
|
2122
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
2123
|
+
__metadata("design:returntype", Promise)
|
|
2124
|
+
], AppController.prototype, "testTool", null);
|
|
1979
2125
|
__decorate([
|
|
1980
2126
|
(0, common_1.Get)('library/prompts'),
|
|
1981
2127
|
(0, public_decorator_1.Public)(),
|
|
@@ -2611,6 +2757,26 @@ __decorate([
|
|
|
2611
2757
|
__metadata("design:paramtypes", [Object, String, String, Object]),
|
|
2612
2758
|
__metadata("design:returntype", Promise)
|
|
2613
2759
|
], AppController.prototype, "saveCharacter", null);
|
|
2760
|
+
__decorate([
|
|
2761
|
+
(0, common_1.Get)('stories/:storyId/characters/:characterName/inventory'),
|
|
2762
|
+
__param(0, (0, common_1.Request)()),
|
|
2763
|
+
__param(1, (0, common_1.Param)('storyId')),
|
|
2764
|
+
__param(2, (0, common_1.Param)('characterName')),
|
|
2765
|
+
__metadata("design:type", Function),
|
|
2766
|
+
__metadata("design:paramtypes", [Object, String, String]),
|
|
2767
|
+
__metadata("design:returntype", Promise)
|
|
2768
|
+
], AppController.prototype, "getCharacterInventory", null);
|
|
2769
|
+
__decorate([
|
|
2770
|
+
(0, common_1.Put)('stories/:storyId/characters/:characterName/inventory'),
|
|
2771
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
2772
|
+
__param(0, (0, common_1.Request)()),
|
|
2773
|
+
__param(1, (0, common_1.Param)('storyId')),
|
|
2774
|
+
__param(2, (0, common_1.Param)('characterName')),
|
|
2775
|
+
__param(3, (0, common_1.Body)()),
|
|
2776
|
+
__metadata("design:type", Function),
|
|
2777
|
+
__metadata("design:paramtypes", [Object, String, String, Object]),
|
|
2778
|
+
__metadata("design:returntype", Promise)
|
|
2779
|
+
], AppController.prototype, "saveCharacterInventory", null);
|
|
2614
2780
|
__decorate([
|
|
2615
2781
|
(0, common_1.Get)('stories/:storyId/plot-plan'),
|
|
2616
2782
|
__param(0, (0, common_1.Request)()),
|
|
@@ -12,7 +12,7 @@ import { StoryService } from './story/story.service';
|
|
|
12
12
|
import { UserPathsService } from './config/user-paths.service';
|
|
13
13
|
import { AttachedFileService } from './ai/attached-file.service';
|
|
14
14
|
import { ArtifactService } from './ai/artifact.service';
|
|
15
|
-
import { ArtifactMetadata, ModelInfo, ChapterInfo, StoryIdea } from '../../shared/types/app.types';
|
|
15
|
+
import { ArtifactMetadata, ModelInfo, ImageModelOption, ChapterInfo, StoryIdea } from '../../shared/types/app.types';
|
|
16
16
|
import { PublishedAgentsService } from './ai/published-agents.service';
|
|
17
17
|
import { PublishedRoomsService } from './room/published-rooms.service';
|
|
18
18
|
import { BalanceService } from './app/balance.service';
|
|
@@ -21,8 +21,10 @@ import { TransactionService } from './app/transaction.service';
|
|
|
21
21
|
import { AgentFactory } from './ai/agent-factory';
|
|
22
22
|
import { RoomFactory } from './room/room-factory';
|
|
23
23
|
import { EventEmitter } from 'events';
|
|
24
|
-
import { AgentInfo, RoomInfo, RoomDetails, CreateRoomResponse, FileList, PromptFileContent, PromptFoldersResponse, PromptFilesResponse, PromptScope, ProcessTextResponse, PreparedPromptResponse, AttachDocumentResponse, AgentMessagesResponse, RoomMessagesResponse, StoryInfo, StoryState, Character, Transaction, TransactionHistoryResponse } from '../../shared/types/app.types';
|
|
24
|
+
import { AgentInfo, RoomInfo, RoomDetails, CreateRoomResponse, FileList, PromptFileContent, PromptFoldersResponse, PromptFilesResponse, PromptScope, ProcessTextResponse, PreparedPromptResponse, AttachDocumentResponse, AgentMessagesResponse, RoomMessagesResponse, StoryInfo, StoryState, Character, Transaction, TransactionHistoryResponse, ToolDefinition, ToolRunResult } from '../../shared/types/app.types';
|
|
25
25
|
import { RoomMessage } from './room/message';
|
|
26
|
+
import { ToolStoreService } from './tools/tool-store.service';
|
|
27
|
+
import { ToolExecutionService } from './tools/tool-execution.service';
|
|
26
28
|
export declare class AppService {
|
|
27
29
|
private readonly aiFactoryService;
|
|
28
30
|
private readonly agentStore;
|
|
@@ -41,13 +43,15 @@ export declare class AppService {
|
|
|
41
43
|
private readonly transactionService;
|
|
42
44
|
private readonly agentFactory;
|
|
43
45
|
private readonly roomFactory;
|
|
46
|
+
private readonly toolStore;
|
|
47
|
+
private readonly toolExecution;
|
|
44
48
|
private aiServices;
|
|
45
49
|
private readonly userPreferencesFile;
|
|
46
|
-
constructor(aiFactoryService: AiFactoryService, agentStore: AgentStoreService, agentMessageService: AgentMessageService, roomStore: RoomStoreService, roomMessageService: RoomMessageService, userPaths: UserPathsService, attachedFileService: AttachedFileService, artifactService: ArtifactService, storyStore: StoryStoreService, storyService: StoryService, publishedAgentsService: PublishedAgentsService, publishedRoomsService: PublishedRoomsService, balanceService: BalanceService, balanceMessageService: BalanceMessageService, transactionService: TransactionService, agentFactory: AgentFactory, roomFactory: RoomFactory);
|
|
50
|
+
constructor(aiFactoryService: AiFactoryService, agentStore: AgentStoreService, agentMessageService: AgentMessageService, roomStore: RoomStoreService, roomMessageService: RoomMessageService, userPaths: UserPathsService, attachedFileService: AttachedFileService, artifactService: ArtifactService, storyStore: StoryStoreService, storyService: StoryService, publishedAgentsService: PublishedAgentsService, publishedRoomsService: PublishedRoomsService, balanceService: BalanceService, balanceMessageService: BalanceMessageService, transactionService: TransactionService, agentFactory: AgentFactory, roomFactory: RoomFactory, toolStore: ToolStoreService, toolExecution: ToolExecutionService);
|
|
47
51
|
getAiServiceNames(): string[];
|
|
48
52
|
getAiServiceFromServiceName(serviceName: string): BaseAiService;
|
|
49
53
|
listAiModels(aiServiceName: string): Promise<ModelInfo[]>;
|
|
50
|
-
listImageModels(): Promise<
|
|
54
|
+
listImageModels(): Promise<ImageModelOption[]>;
|
|
51
55
|
listStoryModels(): Promise<ModelInfo[]>;
|
|
52
56
|
listStoryGenres(): string[];
|
|
53
57
|
getRandomStoryIdeaByGenre(genreName: string): StoryIdea | null;
|
|
@@ -107,7 +111,13 @@ export declare class AppService {
|
|
|
107
111
|
maxOutputTokens?: number;
|
|
108
112
|
allowSearch?: boolean;
|
|
109
113
|
beginInstruction?: string;
|
|
114
|
+
toolNames?: string[];
|
|
110
115
|
}): Promise<void>;
|
|
116
|
+
listTools(): Promise<ToolDefinition[]>;
|
|
117
|
+
createTool(tool: ToolDefinition): Promise<ToolDefinition>;
|
|
118
|
+
updateTool(name: string, tool: ToolDefinition): Promise<ToolDefinition>;
|
|
119
|
+
deleteTool(name: string): Promise<void>;
|
|
120
|
+
testTool(name: string, args: Record<string, any>): Promise<ToolRunResult>;
|
|
111
121
|
listAttachedFiles(agentId: string): Promise<FileList>;
|
|
112
122
|
deleteAttachedFile(agentId: string, fileName: string): Promise<void>;
|
|
113
123
|
deleteAttachedFileById(documentId: string): Promise<void>;
|
|
@@ -116,7 +126,7 @@ export declare class AppService {
|
|
|
116
126
|
resetRoom(roomId: string): Promise<void>;
|
|
117
127
|
resetStory(storyId: string): Promise<void>;
|
|
118
128
|
revertStoryChapter(storyId: string): Promise<void>;
|
|
119
|
-
createStory(name: string, idea: string, userCharacterDesc: string, otherCharactersDesc: string, illustrateStory: boolean, storyModel?: string, isImport?: boolean, imageModelName?: string,
|
|
129
|
+
createStory(name: string, idea: string, userCharacterDesc: string, otherCharactersDesc: string, illustrateStory: boolean, storyModel?: string, isImport?: boolean, imageModelName?: string, skipDetailedPlot?: boolean): Promise<StoryInfo>;
|
|
120
130
|
importStoryFromZip(zipBuffer: Buffer): Promise<StoryInfo>;
|
|
121
131
|
getStoryProgressEmitter(storyId: string): EventEmitter<any>;
|
|
122
132
|
getStoryMessageEmitter(storyId: string): EventEmitter<any>;
|
|
@@ -156,6 +166,10 @@ export declare class AppService {
|
|
|
156
166
|
content: string;
|
|
157
167
|
}>;
|
|
158
168
|
saveCharacter(storyId: string, characterName: string, content: string): void;
|
|
169
|
+
getCharacterInventory(storyId: string, characterName: string): Promise<{
|
|
170
|
+
content: string;
|
|
171
|
+
}>;
|
|
172
|
+
saveCharacterInventory(storyId: string, characterName: string, content: string): Promise<void>;
|
|
159
173
|
getPlotPlan(storyId: string): Promise<{
|
|
160
174
|
content: string;
|
|
161
175
|
}>;
|