@purpleschool/gptbot 0.13.5 → 0.13.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/api/controllers/http/agents/agent-ai-model.ts +6 -0
- package/api/controllers/http/agents/agent-channel.ts +10 -0
- package/api/controllers/http/agents/agent-dialog.ts +9 -0
- package/api/controllers/http/agents/agent-document.ts +8 -0
- package/api/controllers/http/agents/agent-lead-form.ts +7 -0
- package/api/controllers/http/agents/agent-lead.ts +8 -0
- package/api/controllers/http/agents/agent-template.ts +11 -0
- package/api/controllers/http/agents/agent-tool.ts +8 -0
- package/api/controllers/http/agents/agent.ts +17 -0
- package/api/controllers/http/agents/index.ts +9 -0
- package/api/controllers/http/index.ts +1 -0
- package/api/routes.ts +89 -0
- package/build/api/controllers/http/agents/agent-ai-model.js +8 -0
- package/build/api/controllers/http/agents/agent-channel.js +12 -0
- package/build/api/controllers/http/agents/agent-dialog.js +11 -0
- package/build/api/controllers/http/agents/agent-document.js +10 -0
- package/build/api/controllers/http/agents/agent-lead-form.js +9 -0
- package/build/api/controllers/http/agents/agent-lead.js +10 -0
- package/build/api/controllers/http/agents/agent-template.js +13 -0
- package/build/api/controllers/http/agents/agent-tool.js +10 -0
- package/build/api/controllers/http/agents/agent.js +17 -0
- package/build/api/controllers/http/agents/index.js +25 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/routes.js +60 -0
- package/build/commands/agents/agent-ai-model/find-agent-ai-models.command.js +11 -0
- package/build/commands/agents/agent-ai-model/get-agent-ai-model-by-id.command.js +14 -0
- package/build/commands/agents/agent-ai-model/index.js +18 -0
- package/build/commands/agents/agent-channel/create-agent-channel.command.js +20 -0
- package/build/commands/agents/agent-channel/delete-agent-channel.command.js +14 -0
- package/build/commands/agents/agent-channel/find-agent-channels-catalog.command.js +11 -0
- package/build/commands/agents/agent-channel/find-agent-channels.command.js +14 -0
- package/build/commands/agents/agent-channel/index.js +21 -0
- package/build/commands/agents/agent-channel/update-agent-channel.command.js +31 -0
- package/build/commands/agents/agent-dialog/clear-agent-dialog-history.command.js +14 -0
- package/build/commands/agents/agent-dialog/find-agent-dialogs.command.js +21 -0
- package/build/commands/agents/agent-dialog/get-agent-dialog-by-id.command.js +15 -0
- package/build/commands/agents/agent-dialog/index.js +23 -0
- package/build/commands/agents/agent-dialog/send-agent-dialog-admin-reply.command.js +22 -0
- package/build/commands/agents/agent-dialog/send-cabinet-message.command.js +28 -0
- package/build/commands/agents/agent-dialog/start-cabinet-dialog.command.js +18 -0
- package/build/commands/agents/agent-dialog/update-agent-dialog-status.command.js +19 -0
- package/build/commands/agents/agent-document/delete-agent-document.command.js +14 -0
- package/build/commands/agents/agent-document/find-agent-documents.command.js +18 -0
- package/build/commands/agents/agent-document/index.js +20 -0
- package/build/commands/agents/agent-document/search-agent-documents.command.js +19 -0
- package/build/commands/agents/agent-document/upload-agent-document.command.js +19 -0
- package/build/commands/agents/agent-lead/create-agent-lead.command.js +16 -0
- package/build/commands/agents/agent-lead/delete-agent-lead.command.js +13 -0
- package/build/commands/agents/agent-lead/find-agent-leads.command.js +16 -0
- package/build/commands/agents/agent-lead/get-agent-lead-by-id.command.js +14 -0
- package/build/commands/agents/agent-lead/index.js +21 -0
- package/build/commands/agents/agent-lead/update-agent-lead.command.js +19 -0
- package/build/commands/agents/agent-lead-form/delete-agent-lead-form.command.js +14 -0
- package/build/commands/agents/agent-lead-form/find-agent-lead-forms.command.js +16 -0
- package/build/commands/agents/agent-lead-form/get-agent-lead-form-by-agent.command.js +14 -0
- package/build/commands/agents/agent-lead-form/get-agent-lead-form-by-id.command.js +14 -0
- package/build/commands/agents/agent-lead-form/index.js +21 -0
- package/build/commands/agents/agent-lead-form/upsert-agent-lead-form.command.js +19 -0
- package/build/commands/agents/agent-template/create-agent-template-category.command.js +17 -0
- package/build/commands/agents/agent-template/create-agent-template-instruction.command.js +20 -0
- package/build/commands/agents/agent-template/create-agent-template.command.js +21 -0
- package/build/commands/agents/agent-template/delete-agent-template-category.command.js +13 -0
- package/build/commands/agents/agent-template/delete-agent-template-instruction.command.js +14 -0
- package/build/commands/agents/agent-template/delete-agent-template.command.js +13 -0
- package/build/commands/agents/agent-template/find-agent-template-catalog.command.js +11 -0
- package/build/commands/agents/agent-template/find-agent-template-categories.command.js +19 -0
- package/build/commands/agents/agent-template/find-agent-template-instructions.command.js +20 -0
- package/build/commands/agents/agent-template/find-agent-templates.command.js +19 -0
- package/build/commands/agents/agent-template/index.js +29 -0
- package/build/commands/agents/agent-template/update-agent-template-category.command.js +21 -0
- package/build/commands/agents/agent-template/update-agent-template-instruction.command.js +22 -0
- package/build/commands/agents/agent-template/update-agent-template.command.js +25 -0
- package/build/commands/agents/agent-tool/connect-agent-tool.command.js +20 -0
- package/build/commands/agents/agent-tool/disconnect-agent-tool.command.js +14 -0
- package/build/commands/agents/agent-tool/find-agent-tools-catalog.command.js +15 -0
- package/build/commands/agents/agent-tool/find-agent-tools.command.js +14 -0
- package/build/commands/agents/agent-tool/index.js +21 -0
- package/build/commands/agents/agent-tool/update-agent-tool.command.js +21 -0
- package/build/commands/agents/agents/create-agent.command.js +24 -0
- package/build/commands/agents/agents/delete-agent.command.js +13 -0
- package/build/commands/agents/agents/find-agents.command.js +18 -0
- package/build/commands/agents/agents/get-agent-by-id.command.js +14 -0
- package/build/commands/agents/agents/get-agent-public-info.command.js +19 -0
- package/build/commands/agents/agents/index.js +22 -0
- package/build/commands/agents/agents/update-agent.command.js +30 -0
- package/build/commands/agents/index.js +25 -0
- package/build/commands/index.js +1 -0
- package/build/constants/agents/enums/agent-channel-status.enum.js +9 -0
- package/build/constants/agents/enums/agent-channel-type.enum.js +9 -0
- package/build/constants/agents/enums/agent-document-status.enum.js +9 -0
- package/build/constants/agents/enums/agent-interaction-mode.enum.js +8 -0
- package/build/constants/agents/enums/agent-status.enum.js +9 -0
- package/build/constants/agents/enums/agent-tool-status.enum.js +9 -0
- package/build/constants/agents/enums/agent-tool-type.enum.js +9 -0
- package/build/constants/agents/enums/dialog-status.enum.js +11 -0
- package/build/constants/agents/enums/index.js +24 -0
- package/build/constants/agents/index.js +17 -0
- package/build/constants/index.js +1 -0
- package/build/models/agents/agent-ai-model.schema.js +14 -0
- package/build/models/agents/agent-channel-credentials.schema.js +23 -0
- package/build/models/agents/agent-channel.schema.js +17 -0
- package/build/models/agents/agent-dialog-lead.schema.js +13 -0
- package/build/models/agents/agent-dialog-message.schema.js +13 -0
- package/build/models/agents/agent-document-chunk.schema.js +15 -0
- package/build/models/agents/agent-document-find-result.schema.js +11 -0
- package/build/models/agents/agent-document-search-result.schema.js +13 -0
- package/build/models/agents/agent-document.schema.js +18 -0
- package/build/models/agents/agent-lead-find-result.schema.js +11 -0
- package/build/models/agents/agent-lead-form-field.schema.js +10 -0
- package/build/models/agents/agent-lead-form.schema.js +14 -0
- package/build/models/agents/agent-lead.schema.js +13 -0
- package/build/models/agents/agent-template-catalog.schema.js +16 -0
- package/build/models/agents/agent-template-category.schema.js +14 -0
- package/build/models/agents/agent-template-instruction.schema.js +15 -0
- package/build/models/agents/agent-template.schema.js +18 -0
- package/build/models/agents/agent-tool-catalog.schema.js +16 -0
- package/build/models/agents/agent-tool-credentials.schema.js +24 -0
- package/build/models/agents/agent-tool.schema.js +15 -0
- package/build/models/agents/agent.schema.js +25 -0
- package/build/models/agents/channel.schema.js +15 -0
- package/build/models/agents/dialog-find-result.schema.js +9 -0
- package/build/models/agents/dialog-with-messages.schema.js +9 -0
- package/build/models/agents/dialog.schema.js +32 -0
- package/build/models/agents/index.js +41 -0
- package/build/models/index.js +1 -0
- package/commands/agents/agent-ai-model/find-agent-ai-models.command.ts +9 -0
- package/commands/agents/agent-ai-model/get-agent-ai-model-by-id.command.ts +14 -0
- package/commands/agents/agent-ai-model/index.ts +2 -0
- package/commands/agents/agent-channel/create-agent-channel.command.ts +22 -0
- package/commands/agents/agent-channel/delete-agent-channel.command.ts +14 -0
- package/commands/agents/agent-channel/find-agent-channels-catalog.command.ts +9 -0
- package/commands/agents/agent-channel/find-agent-channels.command.ts +14 -0
- package/commands/agents/agent-channel/index.ts +5 -0
- package/commands/agents/agent-channel/update-agent-channel.command.ts +36 -0
- package/commands/agents/agent-dialog/clear-agent-dialog-history.command.ts +16 -0
- package/commands/agents/agent-dialog/find-agent-dialogs.command.ts +21 -0
- package/commands/agents/agent-dialog/get-agent-dialog-by-id.command.ts +17 -0
- package/commands/agents/agent-dialog/index.ts +7 -0
- package/commands/agents/agent-dialog/send-agent-dialog-admin-reply.command.ts +26 -0
- package/commands/agents/agent-dialog/send-cabinet-message.command.ts +34 -0
- package/commands/agents/agent-dialog/start-cabinet-dialog.command.ts +20 -0
- package/commands/agents/agent-dialog/update-agent-dialog-status.command.ts +23 -0
- package/commands/agents/agent-document/delete-agent-document.command.ts +14 -0
- package/commands/agents/agent-document/find-agent-documents.command.ts +20 -0
- package/commands/agents/agent-document/index.ts +4 -0
- package/commands/agents/agent-document/search-agent-documents.command.ts +21 -0
- package/commands/agents/agent-document/upload-agent-document.command.ts +21 -0
- package/commands/agents/agent-lead/create-agent-lead.command.ts +16 -0
- package/commands/agents/agent-lead/delete-agent-lead.command.ts +13 -0
- package/commands/agents/agent-lead/find-agent-leads.command.ts +16 -0
- package/commands/agents/agent-lead/get-agent-lead-by-id.command.ts +14 -0
- package/commands/agents/agent-lead/index.ts +5 -0
- package/commands/agents/agent-lead/update-agent-lead.command.ts +21 -0
- package/commands/agents/agent-lead-form/delete-agent-lead-form.command.ts +14 -0
- package/commands/agents/agent-lead-form/find-agent-lead-forms.command.ts +16 -0
- package/commands/agents/agent-lead-form/get-agent-lead-form-by-agent.command.ts +14 -0
- package/commands/agents/agent-lead-form/get-agent-lead-form-by-id.command.ts +14 -0
- package/commands/agents/agent-lead-form/index.ts +5 -0
- package/commands/agents/agent-lead-form/upsert-agent-lead-form.command.ts +21 -0
- package/commands/agents/agent-template/create-agent-template-category.command.ts +17 -0
- package/commands/agents/agent-template/create-agent-template-instruction.command.ts +22 -0
- package/commands/agents/agent-template/create-agent-template.command.ts +21 -0
- package/commands/agents/agent-template/delete-agent-template-category.command.ts +13 -0
- package/commands/agents/agent-template/delete-agent-template-instruction.command.ts +14 -0
- package/commands/agents/agent-template/delete-agent-template.command.ts +13 -0
- package/commands/agents/agent-template/find-agent-template-catalog.command.ts +9 -0
- package/commands/agents/agent-template/find-agent-template-categories.command.ts +19 -0
- package/commands/agents/agent-template/find-agent-template-instructions.command.ts +22 -0
- package/commands/agents/agent-template/find-agent-templates.command.ts +19 -0
- package/commands/agents/agent-template/index.ts +13 -0
- package/commands/agents/agent-template/update-agent-template-category.command.ts +23 -0
- package/commands/agents/agent-template/update-agent-template-instruction.command.ts +24 -0
- package/commands/agents/agent-template/update-agent-template.command.ts +27 -0
- package/commands/agents/agent-tool/connect-agent-tool.command.ts +22 -0
- package/commands/agents/agent-tool/disconnect-agent-tool.command.ts +14 -0
- package/commands/agents/agent-tool/find-agent-tools-catalog.command.ts +15 -0
- package/commands/agents/agent-tool/find-agent-tools.command.ts +14 -0
- package/commands/agents/agent-tool/index.ts +5 -0
- package/commands/agents/agent-tool/update-agent-tool.command.ts +23 -0
- package/commands/agents/agents/create-agent.command.ts +24 -0
- package/commands/agents/agents/delete-agent.command.ts +13 -0
- package/commands/agents/agents/find-agents.command.ts +18 -0
- package/commands/agents/agents/get-agent-by-id.command.ts +14 -0
- package/commands/agents/agents/get-agent-public-info.command.ts +22 -0
- package/commands/agents/agents/index.ts +6 -0
- package/commands/agents/agents/update-agent.command.ts +32 -0
- package/commands/agents/index.ts +9 -0
- package/commands/index.ts +1 -0
- package/constants/agents/enums/agent-channel-status.enum.ts +5 -0
- package/constants/agents/enums/agent-channel-type.enum.ts +5 -0
- package/constants/agents/enums/agent-document-status.enum.ts +5 -0
- package/constants/agents/enums/agent-interaction-mode.enum.ts +4 -0
- package/constants/agents/enums/agent-status.enum.ts +5 -0
- package/constants/agents/enums/agent-tool-status.enum.ts +5 -0
- package/constants/agents/enums/agent-tool-type.enum.ts +5 -0
- package/constants/agents/enums/dialog-status.enum.ts +7 -0
- package/constants/agents/enums/index.ts +8 -0
- package/constants/agents/index.ts +1 -0
- package/constants/index.ts +1 -0
- package/models/agents/agent-ai-model.schema.ts +14 -0
- package/models/agents/agent-channel-credentials.schema.ts +32 -0
- package/models/agents/agent-channel.schema.ts +17 -0
- package/models/agents/agent-dialog-lead.schema.ts +13 -0
- package/models/agents/agent-dialog-message.schema.ts +13 -0
- package/models/agents/agent-document-chunk.schema.ts +15 -0
- package/models/agents/agent-document-find-result.schema.ts +11 -0
- package/models/agents/agent-document-search-result.schema.ts +16 -0
- package/models/agents/agent-document.schema.ts +18 -0
- package/models/agents/agent-lead-find-result.schema.ts +11 -0
- package/models/agents/agent-lead-form-field.schema.ts +10 -0
- package/models/agents/agent-lead-form.schema.ts +14 -0
- package/models/agents/agent-lead.schema.ts +13 -0
- package/models/agents/agent-template-catalog.schema.ts +22 -0
- package/models/agents/agent-template-category.schema.ts +14 -0
- package/models/agents/agent-template-instruction.schema.ts +15 -0
- package/models/agents/agent-template.schema.ts +18 -0
- package/models/agents/agent-tool-catalog.schema.ts +16 -0
- package/models/agents/agent-tool-credentials.schema.ts +33 -0
- package/models/agents/agent-tool.schema.ts +15 -0
- package/models/agents/agent.schema.ts +25 -0
- package/models/agents/channel.schema.ts +15 -0
- package/models/agents/dialog-find-result.schema.ts +9 -0
- package/models/agents/dialog-with-messages.schema.ts +9 -0
- package/models/agents/dialog.schema.ts +32 -0
- package/models/agents/index.ts +25 -0
- package/models/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_TOOL_TYPE } from '../../../constants/agents/enums';
|
|
3
|
+
import { AgentToolCredentialsSchema } from '../../../models/agents/agent-tool-credentials.schema';
|
|
4
|
+
import { AgentToolSchema } from '../../../models/agents/agent-tool.schema';
|
|
5
|
+
|
|
6
|
+
export namespace ConnectAgentToolCommand {
|
|
7
|
+
export const RequestParamsSchema = z.object({
|
|
8
|
+
agentId: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
11
|
+
|
|
12
|
+
export const RequestBodySchema = z.object({
|
|
13
|
+
toolType: z.nativeEnum(AGENT_TOOL_TYPE),
|
|
14
|
+
credentials: AgentToolCredentialsSchema.nullable().optional(),
|
|
15
|
+
});
|
|
16
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
17
|
+
|
|
18
|
+
export const ResponseSchema = z.object({
|
|
19
|
+
data: AgentToolSchema,
|
|
20
|
+
});
|
|
21
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DisconnectAgentToolCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
agentId: z.string().uuid(),
|
|
6
|
+
id: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
success: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_TOOL_TYPE } from '../../../constants/agents/enums';
|
|
3
|
+
import { AgentToolCatalogSchema } from '../../../models/agents/agent-tool-catalog.schema';
|
|
4
|
+
|
|
5
|
+
export namespace FindAgentToolsCatalogCommand {
|
|
6
|
+
export const RequestQuerySchema = z.object({
|
|
7
|
+
type: z.nativeEnum(AGENT_TOOL_TYPE).optional(),
|
|
8
|
+
});
|
|
9
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(AgentToolCatalogSchema),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentToolSchema } from '../../../models/agents/agent-tool.schema';
|
|
3
|
+
|
|
4
|
+
export namespace FindAgentToolsCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
agentId: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: z.array(AgentToolSchema),
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_TOOL_STATUS } from '../../../constants/agents/enums';
|
|
3
|
+
import { AgentToolCredentialsSchema } from '../../../models/agents/agent-tool-credentials.schema';
|
|
4
|
+
import { AgentToolSchema } from '../../../models/agents/agent-tool.schema';
|
|
5
|
+
|
|
6
|
+
export namespace UpdateAgentToolCommand {
|
|
7
|
+
export const RequestParamsSchema = z.object({
|
|
8
|
+
agentId: z.string().uuid(),
|
|
9
|
+
id: z.string().uuid(),
|
|
10
|
+
});
|
|
11
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
12
|
+
|
|
13
|
+
export const RequestBodySchema = z.object({
|
|
14
|
+
credentials: AgentToolCredentialsSchema.nullable().optional(),
|
|
15
|
+
status: z.nativeEnum(AGENT_TOOL_STATUS).optional(),
|
|
16
|
+
});
|
|
17
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: AgentToolSchema,
|
|
21
|
+
});
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_INTERACTION_MODE } from '../../../constants/agents/enums/agent-interaction-mode.enum';
|
|
3
|
+
import { AgentSchema } from '../../../models/agents/agent.schema';
|
|
4
|
+
|
|
5
|
+
export namespace CreateAgentCommand {
|
|
6
|
+
export const RequestBodySchema = z.object({
|
|
7
|
+
templateId: z.string().uuid().nullable().optional(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
icon: z.string().nullable().optional(),
|
|
10
|
+
avatar: z.string().nullable().optional(),
|
|
11
|
+
greetingPhrase: z.string().nullable().optional(),
|
|
12
|
+
instructions: z.string().nullable().optional(),
|
|
13
|
+
aiModelId: z.string().uuid(),
|
|
14
|
+
interactionMode: z.nativeEnum(AGENT_INTERACTION_MODE).optional(),
|
|
15
|
+
isHumanHelp: z.boolean().optional(),
|
|
16
|
+
useDocuments: z.boolean().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = z.object({
|
|
21
|
+
data: AgentSchema,
|
|
22
|
+
});
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeleteAgentCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
id: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
success: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentSchema } from '../../../models/agents/agent.schema';
|
|
3
|
+
|
|
4
|
+
export namespace FindAgentsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
id: z.string().uuid().optional(),
|
|
7
|
+
name: z.string().optional(),
|
|
8
|
+
isHumanHelp: z.coerce.boolean().optional(),
|
|
9
|
+
page: z.coerce.number().optional(),
|
|
10
|
+
limit: z.coerce.number().optional(),
|
|
11
|
+
});
|
|
12
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.array(AgentSchema),
|
|
16
|
+
});
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentSchema } from '../../../models/agents/agent.schema';
|
|
3
|
+
|
|
4
|
+
export namespace GetAgentByIdCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
id: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: AgentSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentPublicInfoSchema = z.object({
|
|
4
|
+
greetingPhrase: z.string().nullable(),
|
|
5
|
+
activity: z.boolean(),
|
|
6
|
+
icon: z.string().nullable(),
|
|
7
|
+
avatar: z.string().nullable(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type AgentPublicInfo = z.infer<typeof AgentPublicInfoSchema>;
|
|
11
|
+
|
|
12
|
+
export namespace GetAgentPublicInfoCommand {
|
|
13
|
+
export const RequestParamsSchema = z.object({
|
|
14
|
+
id: z.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
17
|
+
|
|
18
|
+
export const ResponseSchema = z.object({
|
|
19
|
+
data: AgentPublicInfoSchema,
|
|
20
|
+
});
|
|
21
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_INTERACTION_MODE } from '../../../constants/agents/enums/agent-interaction-mode.enum';
|
|
3
|
+
import { AGENT_STATUS } from '../../../constants/agents/enums/agent-status.enum';
|
|
4
|
+
import { AgentSchema } from '../../../models/agents/agent.schema';
|
|
5
|
+
|
|
6
|
+
export namespace UpdateAgentCommand {
|
|
7
|
+
export const RequestParamsSchema = z.object({
|
|
8
|
+
id: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
11
|
+
|
|
12
|
+
export const RequestBodySchema = z.object({
|
|
13
|
+
templateId: z.string().uuid().nullable().optional(),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
description: z.string().optional(),
|
|
16
|
+
icon: z.string().nullable().optional(),
|
|
17
|
+
avatar: z.string().nullable().optional(),
|
|
18
|
+
greetingPhrase: z.string().nullable().optional(),
|
|
19
|
+
instructions: z.string().nullable().optional(),
|
|
20
|
+
aiModelId: z.string().uuid().optional(),
|
|
21
|
+
isHumanHelp: z.boolean().optional(),
|
|
22
|
+
useDocuments: z.boolean().optional(),
|
|
23
|
+
interactionMode: z.nativeEnum(AGENT_INTERACTION_MODE).optional(),
|
|
24
|
+
status: z.nativeEnum(AGENT_STATUS).optional(),
|
|
25
|
+
});
|
|
26
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
27
|
+
|
|
28
|
+
export const ResponseSchema = z.object({
|
|
29
|
+
data: AgentSchema,
|
|
30
|
+
});
|
|
31
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './agent-ai-model';
|
|
2
|
+
export * from './agent-channel';
|
|
3
|
+
export * from './agent-dialog';
|
|
4
|
+
export * from './agent-lead-form';
|
|
5
|
+
export * from './agent-lead';
|
|
6
|
+
export * from './agent-tool';
|
|
7
|
+
export * from './agent-document';
|
|
8
|
+
export * from './agent-template';
|
|
9
|
+
export * from './agents';
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './agent-channel-status.enum';
|
|
2
|
+
export * from './agent-channel-type.enum';
|
|
3
|
+
export * from './agent-interaction-mode.enum';
|
|
4
|
+
export * from './agent-status.enum';
|
|
5
|
+
export * from './agent-tool-type.enum';
|
|
6
|
+
export * from './agent-tool-status.enum';
|
|
7
|
+
export * from './agent-document-status.enum';
|
|
8
|
+
export * from './dialog-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentAiModelSchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
model: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
icon: z.string().nullable(),
|
|
8
|
+
isActive: z.boolean(),
|
|
9
|
+
order: z.number(),
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type AgentAiModel = z.infer<typeof AgentAiModelSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_CHANNEL_TYPE } from '../../constants/agents/enums';
|
|
3
|
+
|
|
4
|
+
export const TelegramChannelCredentialsSchema = z.object({
|
|
5
|
+
type: z.literal(AGENT_CHANNEL_TYPE.TELEGRAM),
|
|
6
|
+
token: z.string().min(1),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type TelegramChannelCredentials = z.infer<typeof TelegramChannelCredentialsSchema>;
|
|
10
|
+
|
|
11
|
+
export const WebChannelCredentialsSchema = z.object({
|
|
12
|
+
type: z.literal(AGENT_CHANNEL_TYPE.WEB),
|
|
13
|
+
domain: z.string().url().optional(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type WebChannelCredentials = z.infer<typeof WebChannelCredentialsSchema>;
|
|
17
|
+
|
|
18
|
+
export const AvitoChannelCredentialsSchema = z.object({
|
|
19
|
+
type: z.literal(AGENT_CHANNEL_TYPE.AVITO),
|
|
20
|
+
clientId: z.string().min(1),
|
|
21
|
+
clientSecret: z.string().min(1),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type AvitoChannelCredentials = z.infer<typeof AvitoChannelCredentialsSchema>;
|
|
25
|
+
|
|
26
|
+
export const AgentChannelCredentialsSchema = z.discriminatedUnion('type', [
|
|
27
|
+
TelegramChannelCredentialsSchema,
|
|
28
|
+
WebChannelCredentialsSchema,
|
|
29
|
+
AvitoChannelCredentialsSchema,
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export type AgentChannelCredentials = z.infer<typeof AgentChannelCredentialsSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_CHANNEL_STATUS, AGENT_CHANNEL_TYPE } from '../../constants/agents/enums';
|
|
3
|
+
import { AgentChannelCredentialsSchema } from './agent-channel-credentials.schema';
|
|
4
|
+
|
|
5
|
+
export const AgentChannelSchema = z.object({
|
|
6
|
+
id: z.string().uuid(),
|
|
7
|
+
agentId: z.string().uuid(),
|
|
8
|
+
channelType: z.nativeEnum(AGENT_CHANNEL_TYPE),
|
|
9
|
+
status: z.nativeEnum(AGENT_CHANNEL_STATUS),
|
|
10
|
+
credentials: AgentChannelCredentialsSchema,
|
|
11
|
+
lastCheckedAt: z.date().nullable(),
|
|
12
|
+
lastError: z.string().nullable(),
|
|
13
|
+
createdAt: z.date(),
|
|
14
|
+
updatedAt: z.date(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type AgentChannel = z.infer<typeof AgentChannelSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentDialogLeadSchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
dialogId: z.string().uuid(),
|
|
6
|
+
leadFormId: z.string().uuid(),
|
|
7
|
+
data: z.record(z.string(), z.string()),
|
|
8
|
+
isDeleted: z.boolean(),
|
|
9
|
+
createdAt: z.date(),
|
|
10
|
+
updatedAt: z.date(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type AgentDialogLead = z.infer<typeof AgentDialogLeadSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentDialogMessageSchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
text: z.string().optional(),
|
|
6
|
+
images: z.array(z.string()),
|
|
7
|
+
attachments: z.array(z.string()),
|
|
8
|
+
tokensUsed: z.number().optional(),
|
|
9
|
+
isFromUser: z.boolean(),
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type AgentDialogMessage = z.infer<typeof AgentDialogMessageSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentDocumentChunkSchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
documentId: z.string().uuid(),
|
|
6
|
+
content: z.string(),
|
|
7
|
+
chunkIndex: z.number(),
|
|
8
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
9
|
+
similarity: z.number().optional(),
|
|
10
|
+
isDeleted: z.boolean(),
|
|
11
|
+
createdAt: z.date(),
|
|
12
|
+
updatedAt: z.date(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type AgentDocumentChunk = z.infer<typeof AgentDocumentChunkSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentDocumentSchema } from './agent-document.schema';
|
|
3
|
+
|
|
4
|
+
export const AgentDocumentFindResultSchema = z.object({
|
|
5
|
+
data: z.array(AgentDocumentSchema),
|
|
6
|
+
total: z.number(),
|
|
7
|
+
limit: z.number(),
|
|
8
|
+
offset: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type AgentDocumentFindResult = z.infer<typeof AgentDocumentFindResultSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentDocumentChunkSchema } from './agent-document-chunk.schema';
|
|
3
|
+
|
|
4
|
+
export const AgentDocumentSearchResultItemSchema = z.object({
|
|
5
|
+
chunk: AgentDocumentChunkSchema,
|
|
6
|
+
similarity: z.number(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type AgentDocumentSearchResultItem = z.infer<typeof AgentDocumentSearchResultItemSchema>;
|
|
10
|
+
|
|
11
|
+
export const AgentDocumentSearchResultSchema = z.object({
|
|
12
|
+
results: z.array(AgentDocumentSearchResultItemSchema),
|
|
13
|
+
context: z.string(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type AgentDocumentSearchResult = z.infer<typeof AgentDocumentSearchResultSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_DOCUMENT_STATUS } from '../../constants/agents/enums';
|
|
3
|
+
|
|
4
|
+
export const AgentDocumentSchema = z.object({
|
|
5
|
+
id: z.string().uuid(),
|
|
6
|
+
agentId: z.string().uuid(),
|
|
7
|
+
filename: z.string(),
|
|
8
|
+
originalUrl: z.string().optional(),
|
|
9
|
+
fileSize: z.number().optional(),
|
|
10
|
+
contentType: z.string(),
|
|
11
|
+
status: z.nativeEnum(AGENT_DOCUMENT_STATUS),
|
|
12
|
+
chunksCount: z.number().optional(),
|
|
13
|
+
isDeleted: z.boolean(),
|
|
14
|
+
createdAt: z.date(),
|
|
15
|
+
updatedAt: z.date(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type AgentDocument = z.infer<typeof AgentDocumentSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentLeadSchema } from './agent-lead.schema';
|
|
3
|
+
|
|
4
|
+
export const AgentLeadFindResultSchema = z.object({
|
|
5
|
+
data: z.array(AgentLeadSchema),
|
|
6
|
+
total: z.number(),
|
|
7
|
+
limit: z.number(),
|
|
8
|
+
offset: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type AgentLeadFindResult = z.infer<typeof AgentLeadFindResultSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentLeadFormFieldSchema = z.object({
|
|
4
|
+
key: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
integrationName: z.string().optional(),
|
|
7
|
+
required: z.boolean().optional(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type AgentLeadFormField = z.infer<typeof AgentLeadFormFieldSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentLeadFormFieldSchema } from './agent-lead-form-field.schema';
|
|
3
|
+
|
|
4
|
+
export const AgentLeadFormSchema = z.object({
|
|
5
|
+
id: z.string().uuid(),
|
|
6
|
+
agentId: z.string().uuid(),
|
|
7
|
+
fields: z.array(AgentLeadFormFieldSchema),
|
|
8
|
+
collectionTrigger: z.string().nullable().optional(),
|
|
9
|
+
isDeleted: z.boolean(),
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type AgentLeadForm = z.infer<typeof AgentLeadFormSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentLeadSchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
dialogId: z.string().uuid(),
|
|
6
|
+
leadFormId: z.string().uuid(),
|
|
7
|
+
data: z.record(z.string(), z.string()),
|
|
8
|
+
isDeleted: z.boolean(),
|
|
9
|
+
createdAt: z.date(),
|
|
10
|
+
updatedAt: z.date(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type AgentLead = z.infer<typeof AgentLeadSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentTemplateCategorySchema } from './agent-template-category.schema';
|
|
3
|
+
import { AgentTemplateInstructionSchema } from './agent-template-instruction.schema';
|
|
4
|
+
import { AgentTemplateSchema } from './agent-template.schema';
|
|
5
|
+
|
|
6
|
+
export const CatalogAgentTemplateSchema = AgentTemplateSchema.extend({
|
|
7
|
+
instructions: z.array(AgentTemplateInstructionSchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type CatalogAgentTemplate = z.infer<typeof CatalogAgentTemplateSchema>;
|
|
11
|
+
|
|
12
|
+
export const CatalogAgentTemplateCategorySchema = AgentTemplateCategorySchema.extend({
|
|
13
|
+
templates: z.array(CatalogAgentTemplateSchema),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type CatalogAgentTemplateCategory = z.infer<typeof CatalogAgentTemplateCategorySchema>;
|
|
17
|
+
|
|
18
|
+
export const AgentTemplateCatalogSchema = z.object({
|
|
19
|
+
categories: z.array(CatalogAgentTemplateCategorySchema),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type AgentTemplateCatalog = z.infer<typeof AgentTemplateCatalogSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentTemplateCategorySchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
slug: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
order: z.number(),
|
|
9
|
+
isActive: z.boolean(),
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type AgentTemplateCategory = z.infer<typeof AgentTemplateCategorySchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const AgentTemplateInstructionSchema = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
templateId: z.string().uuid(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
prompt: z.string(),
|
|
9
|
+
order: z.number(),
|
|
10
|
+
isActive: z.boolean(),
|
|
11
|
+
createdAt: z.date(),
|
|
12
|
+
updatedAt: z.date(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type AgentTemplateInstruction = z.infer<typeof AgentTemplateInstructionSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_INTERACTION_MODE } from '../../constants/agents/enums/agent-interaction-mode.enum';
|
|
3
|
+
|
|
4
|
+
export const AgentTemplateSchema = z.object({
|
|
5
|
+
id: z.string().uuid(),
|
|
6
|
+
categoryId: z.string().uuid(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
description: z.string(),
|
|
9
|
+
iconUrl: z.string().nullable(),
|
|
10
|
+
systemPrompt: z.string().nullable(),
|
|
11
|
+
interactionMode: z.nativeEnum(AGENT_INTERACTION_MODE),
|
|
12
|
+
order: z.number(),
|
|
13
|
+
isActive: z.boolean(),
|
|
14
|
+
createdAt: z.date(),
|
|
15
|
+
updatedAt: z.date(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type AgentTemplate = z.infer<typeof AgentTemplateSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AGENT_TOOL_TYPE } from '../../constants/agents/enums';
|
|
3
|
+
|
|
4
|
+
export const AgentToolCatalogSchema = z.object({
|
|
5
|
+
type: z.nativeEnum(AGENT_TOOL_TYPE),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
displayName: z.string(),
|
|
8
|
+
description: z.string().nullable().optional(),
|
|
9
|
+
icon: z.string(),
|
|
10
|
+
connectionInstruction: z.string().nullable().optional(),
|
|
11
|
+
order: z.number(),
|
|
12
|
+
createdAt: z.date(),
|
|
13
|
+
updatedAt: z.date(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type AgentToolCatalog = z.infer<typeof AgentToolCatalogSchema>;
|