feat(ui): édition templates — nom d'agent par défaut, permissions système et MCP outils — #242
TemplateEditor/TemplatesPanel étendus aux nouveaux champs, projection useTemplates/adapters/ports, panneau Agents aligné, templatePresentation.ts extrait. Tests frontend étendus (templates, agents, routage chat WS).
This commit is contained in:
@ -118,6 +118,7 @@ import type {
|
||||
DeviceGateway,
|
||||
EmbedderGateway,
|
||||
CreateTemplateInput,
|
||||
UpdateTemplateInput,
|
||||
Gateways,
|
||||
InputGateway,
|
||||
LiveAgent,
|
||||
@ -2230,12 +2231,18 @@ export class MockTemplateGateway implements TemplateGateway {
|
||||
contentMd: input.content,
|
||||
version: 1,
|
||||
defaultProfileId: input.defaultProfileId,
|
||||
defaultAgentName: input.defaultAgentName ?? null,
|
||||
systemPermissions: input.systemPermissions ?? null,
|
||||
mcpToolPermissions: input.mcpToolPermissions ?? null,
|
||||
};
|
||||
this.templates.push(template);
|
||||
return structuredClone(template);
|
||||
}
|
||||
|
||||
async updateTemplate(templateId: string, content: string): Promise<Template> {
|
||||
async updateTemplate(
|
||||
templateId: string,
|
||||
input: UpdateTemplateInput | string,
|
||||
): Promise<Template> {
|
||||
const idx = this.templates.findIndex((t) => t.id === templateId);
|
||||
if (idx === -1) {
|
||||
const err: GatewayError = {
|
||||
@ -2244,10 +2251,27 @@ export class MockTemplateGateway implements TemplateGateway {
|
||||
};
|
||||
throw err;
|
||||
}
|
||||
const current = this.templates[idx];
|
||||
const update =
|
||||
typeof input === "string"
|
||||
? {
|
||||
name: current.name,
|
||||
content: input,
|
||||
defaultProfileId: current.defaultProfileId,
|
||||
defaultAgentName: current.defaultAgentName ?? null,
|
||||
systemPermissions: current.systemPermissions ?? null,
|
||||
mcpToolPermissions: current.mcpToolPermissions ?? null,
|
||||
}
|
||||
: input;
|
||||
this.templates[idx] = {
|
||||
...this.templates[idx],
|
||||
contentMd: content,
|
||||
version: this.templates[idx].version + 1,
|
||||
...current,
|
||||
name: update.name,
|
||||
contentMd: update.content,
|
||||
defaultProfileId: update.defaultProfileId,
|
||||
defaultAgentName: update.defaultAgentName ?? null,
|
||||
systemPermissions: update.systemPermissions ?? null,
|
||||
mcpToolPermissions: update.mcpToolPermissions ?? null,
|
||||
version: current.version + 1,
|
||||
};
|
||||
return structuredClone(this.templates[idx]);
|
||||
}
|
||||
@ -2279,7 +2303,7 @@ export class MockTemplateGateway implements TemplateGateway {
|
||||
}
|
||||
|
||||
const synchronized = opts?.synchronized ?? true;
|
||||
const name = opts?.name ?? template.name;
|
||||
const name = opts?.name ?? template.defaultAgentName ?? template.name;
|
||||
const slug = slugify(name) || "agent";
|
||||
|
||||
// Derive unique contextPath (same logic as MockAgentGateway)
|
||||
|
||||
Reference in New Issue
Block a user