@purpleschool/gptbot 0.13.23 → 0.14.2-stage-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/api/controllers/http/agents/agent-dialog.ts +1 -9
- package/api/controllers/http/agents/agent-lead-form.ts +0 -2
- package/api/controllers/http/agents/agent-lead.ts +0 -1
- package/api/controllers/http/agents/agent-template.ts +0 -4
- package/api/controllers/http/agents/agent-tool.ts +1 -2
- package/api/controllers/http/agents/agent.ts +3 -0
- package/api/controllers/http/agents/index.ts +0 -1
- package/api/controllers/http/b2b-compatible.ts +14 -0
- package/api/controllers/http/b2b-usage-log.ts +5 -0
- package/api/controllers/http/diagrams.ts +0 -1
- package/api/controllers/http/html-page-builder.ts +0 -1
- package/api/controllers/http/image-editor.ts +0 -1
- package/api/controllers/http/image-generation.ts +0 -1
- package/api/controllers/http/index.ts +3 -2
- package/api/controllers/http/interior-design.ts +0 -1
- package/api/controllers/http/marketplace-card.ts +0 -1
- package/api/controllers/http/model-page.ts +39 -0
- package/api/controllers/http/music.ts +0 -1
- package/api/controllers/http/paraphrase.ts +0 -1
- package/api/controllers/http/presentation.ts +0 -1
- package/api/controllers/http/solving-edu-task.ts +0 -1
- package/api/controllers/http/spell-corrector.ts +0 -1
- package/api/controllers/http/stt.ts +0 -1
- package/api/controllers/http/tts.ts +0 -1
- package/api/controllers/http/video-editor.ts +0 -1
- package/api/controllers/http/video.ts +0 -1
- package/api/controllers/http/writer.ts +0 -1
- package/api/routes.ts +72 -127
- package/build/api/controllers/http/agents/agent-dialog.js +1 -7
- package/build/api/controllers/http/agents/agent-lead-form.js +0 -2
- package/build/api/controllers/http/agents/agent-lead.js +0 -1
- package/build/api/controllers/http/agents/agent-template.js +0 -4
- package/build/api/controllers/http/agents/agent-tool.js +1 -2
- package/build/api/controllers/http/agents/agent.js +2 -0
- package/build/api/controllers/http/agents/index.js +0 -1
- package/build/api/controllers/http/b2b-compatible.js +15 -0
- package/build/api/controllers/http/b2b-usage-log.js +7 -0
- package/build/api/controllers/http/diagrams.js +0 -1
- package/build/api/controllers/http/html-page-builder.js +0 -1
- package/build/api/controllers/http/image-editor.js +0 -1
- package/build/api/controllers/http/image-generation.js +0 -1
- package/build/api/controllers/http/index.js +3 -2
- package/build/api/controllers/http/interior-design.js +0 -1
- package/build/api/controllers/http/marketplace-card.js +0 -1
- package/build/api/controllers/http/model-page.js +34 -0
- package/build/api/controllers/http/music.js +0 -1
- package/build/api/controllers/http/paraphrase.js +0 -1
- package/build/api/controllers/http/presentation.js +0 -1
- package/build/api/controllers/http/solving-edu-task.js +0 -1
- package/build/api/controllers/http/spell-corrector.js +0 -1
- package/build/api/controllers/http/stt.js +0 -1
- package/build/api/controllers/http/tts.js +0 -1
- package/build/api/controllers/http/video-editor.js +0 -1
- package/build/api/controllers/http/video.js +0 -1
- package/build/api/controllers/http/writer.js +0 -1
- package/build/api/routes.js +49 -69
- 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 +0 -1
- package/build/commands/agents/agent-dialog/index.js +1 -6
- package/build/commands/agents/agent-dialog/send-cabinet-message.command.js +11 -4
- package/build/commands/agents/agent-lead/find-agent-leads.command.js +4 -2
- package/build/commands/agents/agent-template/index.js +0 -1
- package/build/commands/agents/agent-tool/find-agent-tools-catalog.command.js +0 -2
- package/build/commands/agents/agent-tool/find-agent-tools.command.js +0 -2
- package/build/commands/agents/agents/index.js +0 -1
- package/build/commands/ai-studio/canvas-tool/index.js +0 -1
- package/build/commands/b2b/send-text-request.command.js +8 -1
- package/build/commands/b2b-compatible/anthropic-files.command.js +21 -0
- package/build/commands/b2b-compatible/anthropic-messages.command.js +217 -0
- package/build/commands/b2b-compatible/anthropic-models.command.js +26 -0
- package/build/commands/b2b-compatible/common.schemas.js +46 -0
- package/build/commands/b2b-compatible/index.js +23 -0
- package/build/commands/b2b-compatible/openai-files.command.js +26 -0
- package/build/commands/b2b-compatible/openai-models.command.js +24 -0
- package/build/commands/b2b-compatible/openai-responses.command.js +171 -0
- package/build/commands/b2b-usage-log/get-b2b-usage-statistics.command.js +111 -0
- package/build/{constants/photo-studio/enums → commands/b2b-usage-log}/index.js +1 -1
- package/build/commands/index.js +3 -1
- package/build/commands/model-page/base/create-model-page.command.js +13 -0
- package/build/commands/model-page/base/delete-model-page.command.js +9 -0
- package/build/commands/model-page/base/find-model-page-admin.command.js +13 -0
- package/build/commands/model-page/base/find-model-pages-admin.command.js +22 -0
- package/build/commands/model-page/base/index.js +21 -0
- package/build/commands/model-page/base/update-model-page.command.js +63 -0
- package/build/commands/model-page/common.schemas.js +62 -0
- package/build/{models/photo-studio → commands/model-page}/index.js +5 -4
- package/build/commands/model-page/public/find-model-page-answer-detail.command.js +14 -0
- package/build/commands/model-page/public/find-model-page-detail.command.js +12 -0
- package/build/commands/model-page/public/find-model-page-hub.command.js +19 -0
- package/build/commands/model-page/public/find-model-page-question-type.command.js +13 -0
- package/build/commands/model-page/public/index.js +20 -0
- package/build/commands/model-page/question/create-model-page-question.command.js +16 -0
- package/build/commands/model-page/question/delete-model-page-question.command.js +9 -0
- package/build/commands/model-page/question/find-model-page-question-admin.command.js +13 -0
- package/build/commands/model-page/question/find-model-page-questions-admin.command.js +21 -0
- package/build/commands/model-page/question/index.js +21 -0
- package/build/commands/model-page/question/update-model-page-question.command.js +18 -0
- package/build/commands/model-page/question-translation/create-model-page-question-translation.command.js +17 -0
- package/build/commands/model-page/question-translation/delete-model-page-question-translation.command.js +9 -0
- package/build/commands/model-page/question-translation/find-model-page-question-translation.command.js +13 -0
- package/build/commands/model-page/question-translation/find-model-page-question-translations.command.js +13 -0
- package/build/commands/model-page/question-translation/index.js +21 -0
- package/build/commands/model-page/question-translation/update-model-page-question-translation.command.js +16 -0
- package/build/commands/model-page/translation/create-model-page-translation.command.js +18 -0
- package/build/commands/model-page/translation/delete-model-page-translation.command.js +9 -0
- package/build/commands/model-page/translation/find-model-page-translation.command.js +13 -0
- package/build/commands/model-page/translation/find-model-page-translations.command.js +13 -0
- package/build/commands/model-page/translation/index.js +21 -0
- package/build/commands/model-page/translation/update-model-page-translation.command.js +17 -0
- package/build/commands/question/create-question.command.js +15 -4
- package/build/commands/question/update-question.command.js +12 -7
- package/build/commands/tools/diagrams/find-diagrams-jobs.command.js +0 -5
- package/build/commands/tools/diagrams/index.js +0 -1
- package/build/commands/tools/html-page-builder/find-html-page-builder-sessions.command.js +0 -5
- package/build/commands/tools/html-page-builder/index.js +0 -1
- package/build/commands/tools/image-editor/find-image-editor-jobs.command.js +0 -5
- package/build/commands/tools/image-editor/index.js +0 -1
- package/build/commands/tools/image-generation/find-image-generation-jobs.command.js +0 -5
- package/build/commands/tools/image-generation/index.js +0 -1
- package/build/commands/tools/interior-design/find-interior-design-jobs.command.js +0 -5
- package/build/commands/tools/interior-design/index.js +0 -1
- package/build/commands/tools/marketplace-card/find-marketplace-card-jobs.command.js +0 -5
- package/build/commands/tools/marketplace-card/index.js +0 -1
- package/build/commands/tools/music/find-music-jobs.command.js +0 -5
- package/build/commands/tools/music/index.js +0 -1
- package/build/commands/tools/paraphrase/find-paraphrase-jobs.command.js +0 -5
- package/build/commands/tools/paraphrase/index.js +0 -1
- package/build/commands/tools/presentation/find-presentations.command.js +0 -5
- package/build/commands/tools/presentation/index.js +0 -1
- package/build/commands/tools/solving-edu-task/find-solving-edu-task-jobs.command.js +0 -5
- package/build/commands/tools/solving-edu-task/index.js +0 -1
- package/build/commands/tools/spell-corrector/find-spell-corrector-jobs.command.js +0 -5
- package/build/commands/tools/spell-corrector/index.js +0 -1
- package/build/commands/tools/stt/find-stt-jobs.command.js +0 -5
- package/build/commands/tools/stt/index.js +0 -1
- package/build/commands/tools/tts/find-tts-jobs.command.js +0 -5
- package/build/commands/tools/tts/index.js +0 -1
- package/build/commands/tools/video/find-video-jobs.command.js +0 -5
- package/build/commands/tools/video/index.js +0 -1
- package/build/commands/tools/video-editor/find-video-editor-jobs.command.js +0 -5
- package/build/commands/tools/video-editor/index.js +0 -1
- package/build/commands/tools/writer/find-writer-documents.command.js +0 -5
- package/build/commands/tools/writer/index.js +0 -1
- package/build/constants/b2b/enums/b2b-debit-status.enum.js +9 -0
- package/build/constants/b2b/enums/b2b-endpoint-family.enum.js +9 -0
- package/build/constants/b2b/enums/b2b-statistics-granularity.enum.js +8 -0
- package/build/constants/b2b/enums/b2b-statistics-period.enum.js +13 -0
- package/build/constants/b2b/enums/b2b-usage-operation.enum.js +8 -0
- package/build/constants/b2b/enums/b2b-usage-spend-component.enum.js +12 -0
- package/build/constants/b2b/enums/b2b-usage-status.enum.js +8 -0
- package/build/constants/b2b/enums/index.js +23 -0
- package/build/constants/cabinet/enums/statistics-request-type.enum.js +0 -1
- package/build/constants/index.js +2 -1
- package/build/{commands/ai-studio/canvas-tool/var-gen → constants/model-page/enums}/index.js +3 -3
- package/build/constants/model-page/enums/model-page-question-type.enum.js +13 -0
- package/build/constants/model-page/enums/model-page-sort-by.enum.js +8 -0
- package/build/constants/model-page/enums/model-page-type.enum.js +12 -0
- package/build/constants/model-page/index.js +17 -0
- package/build/constants/tool/enums/index.js +0 -1
- package/build/helpers/index.js +0 -1
- package/build/models/agents/index.js +0 -2
- package/build/models/b2b/b2b-usage-statistics.schema.js +69 -0
- package/build/models/b2b/index.js +1 -0
- package/build/models/canvas-node.schema.js +2 -2
- package/build/models/file.schema.js +1 -7
- package/build/models/index.js +1 -1
- package/build/models/model-page/index.js +22 -0
- package/build/models/model-page/model-page-public.schema.js +63 -0
- package/build/models/model-page/model-page-question-translation.schema.js +13 -0
- package/build/models/model-page/model-page-question.schema.js +13 -0
- package/build/models/model-page/model-page-technical-model.schema.js +80 -0
- package/build/models/model-page/model-page-translation.schema.js +14 -0
- package/build/models/model-page/model-page.schema.js +15 -0
- package/build/models/question.schema.js +2 -1
- package/build/models/tool-job.schema.js +0 -1
- package/build/models/tools/diagrams/diagrams-job.schema.js +0 -1
- package/build/models/tools/html-page-builder/html-page-builder-session.schema.js +0 -1
- package/build/models/tools/image-generation/image-generation-job.schema.js +0 -3
- package/build/models/tools/presentation/presentation.schema.js +0 -1
- package/build/models/tools/solving-edu-task/solving-edu-task-job.schema.js +0 -1
- package/build/models/tools/video/video-model.schema.js +0 -1
- package/build/models/tools/writer/writer-document.schema.js +0 -1
- package/commands/agents/agent-dialog/{delete-dialog.command.ts → clear-agent-dialog-history.command.ts} +5 -5
- package/commands/agents/agent-dialog/find-agent-dialogs.command.ts +0 -1
- package/commands/agents/agent-dialog/index.ts +1 -6
- package/commands/agents/agent-dialog/send-cabinet-message.command.ts +18 -17
- package/commands/agents/agent-lead/find-agent-leads.command.ts +4 -2
- package/commands/agents/agent-template/index.ts +0 -1
- package/commands/agents/agent-tool/find-agent-tools-catalog.command.ts +0 -2
- package/commands/agents/agent-tool/find-agent-tools.command.ts +0 -2
- package/commands/agents/agents/index.ts +0 -1
- package/commands/ai-studio/canvas-tool/index.ts +0 -1
- package/commands/b2b/send-text-request.command.ts +10 -1
- package/commands/b2b-compatible/anthropic-files.command.ts +29 -0
- package/commands/b2b-compatible/anthropic-messages.command.ts +244 -0
- package/commands/b2b-compatible/anthropic-models.command.ts +31 -0
- package/commands/b2b-compatible/common.schemas.ts +55 -0
- package/commands/b2b-compatible/index.ts +7 -0
- package/commands/b2b-compatible/openai-files.command.ts +37 -0
- package/commands/b2b-compatible/openai-models.command.ts +29 -0
- package/commands/b2b-compatible/openai-responses.command.ts +191 -0
- package/commands/b2b-usage-log/get-b2b-usage-statistics.command.ts +128 -0
- package/commands/b2b-usage-log/index.ts +1 -0
- package/commands/index.ts +3 -1
- package/commands/model-page/base/create-model-page.command.ts +15 -0
- package/commands/model-page/base/delete-model-page.command.ts +10 -0
- package/commands/model-page/base/find-model-page-admin.command.ts +14 -0
- package/commands/model-page/base/find-model-pages-admin.command.ts +24 -0
- package/commands/model-page/base/index.ts +5 -0
- package/commands/model-page/base/update-model-page.command.ts +69 -0
- package/commands/model-page/common.schemas.ts +64 -0
- package/commands/model-page/index.ts +5 -0
- package/commands/model-page/public/find-model-page-answer-detail.command.ts +15 -0
- package/commands/model-page/public/find-model-page-detail.command.ts +13 -0
- package/commands/model-page/public/find-model-page-hub.command.ts +20 -0
- package/commands/model-page/public/find-model-page-question-type.command.ts +14 -0
- package/commands/model-page/public/index.ts +4 -0
- package/commands/model-page/question/create-model-page-question.command.ts +18 -0
- package/commands/model-page/question/delete-model-page-question.command.ts +10 -0
- package/commands/model-page/question/find-model-page-question-admin.command.ts +14 -0
- package/commands/model-page/question/find-model-page-questions-admin.command.ts +23 -0
- package/commands/model-page/question/index.ts +5 -0
- package/commands/model-page/question/update-model-page-question.command.ts +22 -0
- package/commands/model-page/question-translation/create-model-page-question-translation.command.ts +21 -0
- package/commands/model-page/question-translation/delete-model-page-question-translation.command.ts +10 -0
- package/commands/model-page/question-translation/find-model-page-question-translation.command.ts +14 -0
- package/commands/model-page/question-translation/find-model-page-question-translations.command.ts +14 -0
- package/commands/model-page/question-translation/index.ts +5 -0
- package/commands/model-page/question-translation/update-model-page-question-translation.command.ts +20 -0
- package/commands/model-page/translation/create-model-page-translation.command.ts +22 -0
- package/commands/model-page/translation/delete-model-page-translation.command.ts +10 -0
- package/commands/model-page/translation/find-model-page-translation.command.ts +14 -0
- package/commands/model-page/translation/find-model-page-translations.command.ts +14 -0
- package/commands/model-page/translation/index.ts +5 -0
- package/commands/model-page/translation/update-model-page-translation.command.ts +21 -0
- package/commands/question/create-question.command.ts +17 -3
- package/commands/question/update-question.command.ts +14 -7
- package/commands/tools/diagrams/find-diagrams-jobs.command.ts +0 -5
- package/commands/tools/diagrams/index.ts +0 -1
- package/commands/tools/html-page-builder/find-html-page-builder-sessions.command.ts +0 -5
- package/commands/tools/html-page-builder/index.ts +0 -1
- package/commands/tools/image-editor/find-image-editor-jobs.command.ts +0 -5
- package/commands/tools/image-editor/index.ts +0 -1
- package/commands/tools/image-generation/find-image-generation-jobs.command.ts +0 -5
- package/commands/tools/image-generation/index.ts +0 -1
- package/commands/tools/interior-design/find-interior-design-jobs.command.ts +0 -5
- package/commands/tools/interior-design/index.ts +0 -1
- package/commands/tools/marketplace-card/find-marketplace-card-jobs.command.ts +0 -5
- package/commands/tools/marketplace-card/index.ts +0 -1
- package/commands/tools/music/find-music-jobs.command.ts +0 -5
- package/commands/tools/music/index.ts +0 -1
- package/commands/tools/paraphrase/find-paraphrase-jobs.command.ts +0 -5
- package/commands/tools/paraphrase/index.ts +0 -1
- package/commands/tools/presentation/find-presentations.command.ts +0 -5
- package/commands/tools/presentation/index.ts +0 -1
- package/commands/tools/solving-edu-task/find-solving-edu-task-jobs.command.ts +0 -5
- package/commands/tools/solving-edu-task/index.ts +0 -1
- package/commands/tools/spell-corrector/find-spell-corrector-jobs.command.ts +0 -5
- package/commands/tools/spell-corrector/index.ts +0 -1
- package/commands/tools/stt/find-stt-jobs.command.ts +0 -5
- package/commands/tools/stt/index.ts +0 -1
- package/commands/tools/tts/find-tts-jobs.command.ts +0 -5
- package/commands/tools/tts/index.ts +0 -1
- package/commands/tools/video/find-video-jobs.command.ts +0 -5
- package/commands/tools/video/index.ts +0 -1
- package/commands/tools/video-editor/find-video-editor-jobs.command.ts +0 -5
- package/commands/tools/video-editor/index.ts +0 -1
- package/commands/tools/writer/find-writer-documents.command.ts +0 -5
- package/commands/tools/writer/index.ts +0 -1
- package/constants/b2b/enums/b2b-debit-status.enum.ts +5 -0
- package/constants/b2b/enums/b2b-endpoint-family.enum.ts +5 -0
- package/constants/b2b/enums/b2b-statistics-granularity.enum.ts +4 -0
- package/constants/b2b/enums/b2b-statistics-period.enum.ts +9 -0
- package/constants/b2b/enums/b2b-usage-operation.enum.ts +4 -0
- package/constants/b2b/enums/b2b-usage-spend-component.enum.ts +8 -0
- package/constants/b2b/enums/b2b-usage-status.enum.ts +4 -0
- package/constants/b2b/enums/index.ts +7 -0
- package/constants/cabinet/enums/statistics-request-type.enum.ts +0 -1
- package/constants/index.ts +2 -1
- package/constants/model-page/enums/index.ts +3 -0
- package/constants/model-page/enums/model-page-question-type.enum.ts +9 -0
- package/constants/model-page/enums/model-page-sort-by.enum.ts +4 -0
- package/constants/model-page/enums/model-page-type.enum.ts +8 -0
- package/constants/model-page/index.ts +1 -0
- package/constants/tool/enums/index.ts +0 -1
- package/helpers/index.ts +0 -1
- package/models/agents/index.ts +0 -2
- package/models/b2b/b2b-usage-statistics.schema.ts +81 -0
- package/models/b2b/index.ts +1 -0
- package/models/canvas-node.schema.ts +2 -2
- package/models/file.schema.ts +0 -8
- package/models/index.ts +1 -1
- package/models/model-page/index.ts +6 -0
- package/models/model-page/model-page-public.schema.ts +94 -0
- package/models/model-page/model-page-question-translation.schema.ts +13 -0
- package/models/model-page/model-page-question.schema.ts +13 -0
- package/models/model-page/model-page-technical-model.schema.ts +109 -0
- package/models/model-page/model-page-translation.schema.ts +14 -0
- package/models/model-page/model-page.schema.ts +15 -0
- package/models/question.schema.ts +2 -1
- package/models/tool-job.schema.ts +0 -1
- package/models/tools/diagrams/diagrams-job.schema.ts +0 -1
- package/models/tools/html-page-builder/html-page-builder-session.schema.ts +0 -1
- package/models/tools/image-generation/image-generation-job.schema.ts +0 -3
- package/models/tools/presentation/presentation.schema.ts +0 -1
- package/models/tools/solving-edu-task/solving-edu-task-job.schema.ts +0 -1
- package/models/tools/video/video-model.schema.ts +0 -1
- package/models/tools/writer/writer-document.schema.ts +0 -1
- package/package.json +1 -1
- package/api/controllers/http/agents/agent-statistics.ts +0 -5
- package/api/controllers/http/canvas-var-generation.ts +0 -7
- package/api/controllers/http/photo-studio.ts +0 -21
- package/build/api/controllers/http/agents/agent-statistics.js +0 -7
- package/build/api/controllers/http/canvas-var-generation.js +0 -9
- package/build/api/controllers/http/photo-studio.js +0 -21
- package/build/commands/agents/agent-dialog/delete-dialog.command.js +0 -16
- package/build/commands/agents/agent-dialog/get-cabinet-config.command.js +0 -12
- package/build/commands/agents/agent-dialog/get-cabinet-price-preview.command.js +0 -24
- package/build/commands/agents/agent-dialog/get-dialog-context-length.command.js +0 -32
- package/build/commands/agents/agent-dialog/rename-agent-dialog.command.js +0 -17
- package/build/commands/agents/agent-dialog/stop-cabinet-stream.command.js +0 -15
- package/build/commands/agents/agent-template/get-agent-template-instructions-by-template.command.js +0 -14
- package/build/commands/agents/agents/get-agent-statistics.command.js +0 -20
- package/build/commands/ai-studio/canvas-tool/var-gen/generate-variables.command.js +0 -18
- package/build/commands/ai-studio/canvas-tool/var-gen/get-var-gen-config.command.js +0 -11
- package/build/commands/ai-studio/canvas-tool/var-gen/get-var-gen-price.command.js +0 -18
- package/build/commands/photo-studio/add-photo-studio-checkpoint.command.js +0 -17
- package/build/commands/photo-studio/clear-photo-studio-checkpoints.command.js +0 -12
- package/build/commands/photo-studio/create-photo-studio-canvas.command.js +0 -15
- package/build/commands/photo-studio/delete-photo-studio-canvas.command.js +0 -11
- package/build/commands/photo-studio/delete-photo-studio-checkpoint.command.js +0 -14
- package/build/commands/photo-studio/execute-photo-studio-action.command.js +0 -47
- package/build/commands/photo-studio/find-photo-studio-canvas-by-uuid.query.js +0 -12
- package/build/commands/photo-studio/find-photo-studio-canvases.query.js +0 -18
- package/build/commands/photo-studio/find-photo-studio-checkpoints.query.js +0 -12
- package/build/commands/photo-studio/find-photo-studio-job-by-id.query.js +0 -32
- package/build/commands/photo-studio/find-photo-studio-jobs.query.js +0 -18
- package/build/commands/photo-studio/get-photo-studio-actions.query.js +0 -11
- package/build/commands/photo-studio/index.js +0 -31
- package/build/commands/photo-studio/save-photo-studio-canvas.command.js +0 -18
- package/build/commands/photo-studio/update-photo-studio-canvas.command.js +0 -15
- package/build/commands/photo-studio/update-photo-studio-checkpoint.command.js +0 -19
- package/build/commands/tools/diagrams/update-diagrams-job-favorite.command.js +0 -17
- package/build/commands/tools/html-page-builder/update-html-page-builder-session-favorite.command.js +0 -11
- package/build/commands/tools/image-editor/update-image-editor-job-favorite.command.js +0 -17
- package/build/commands/tools/image-generation/update-image-generation-job-favorite.command.js +0 -17
- package/build/commands/tools/interior-design/update-interior-design-job-favorite.command.js +0 -17
- package/build/commands/tools/marketplace-card/update-marketplace-card-job-favorite.command.js +0 -17
- package/build/commands/tools/music/update-music-job-favorite.command.js +0 -17
- package/build/commands/tools/paraphrase/update-paraphrase-job-favorite.command.js +0 -17
- package/build/commands/tools/presentation/update-presentation-favorite.command.js +0 -11
- package/build/commands/tools/solving-edu-task/update-solving-edu-task-job-favorite.command.js +0 -17
- package/build/commands/tools/spell-corrector/update-spell-corrector-job-favorite.command.js +0 -17
- package/build/commands/tools/stt/update-stt-job-favorite.command.js +0 -17
- package/build/commands/tools/tts/update-tts-job-favorite.command.js +0 -17
- package/build/commands/tools/video/update-video-job-favorite.command.js +0 -17
- package/build/commands/tools/video-editor/update-video-editor-job-favorite.command.js +0 -17
- package/build/commands/tools/writer/update-writer-document-favorite.command.js +0 -11
- package/build/constants/photo-studio/enums/photo-studio-checkpoint-action-type.enum.js +0 -11
- package/build/constants/tool/enums/job-sort.enum.js +0 -8
- package/build/helpers/query-boolean.schema.js +0 -13
- package/build/models/agents/agent-statistics.schema.js +0 -33
- package/build/models/agents/message-attachment.schema.js +0 -21
- package/build/models/photo-studio/photo-studio-action.schema.js +0 -17
- package/build/models/photo-studio/photo-studio-checkpoint.schema.js +0 -21
- package/build/models/photo-studio/photo-studio-image-node.schema.js +0 -19
- package/build/models/photo-studio/photo-studio.schema.js +0 -15
- package/commands/agents/agent-dialog/get-cabinet-config.command.ts +0 -11
- package/commands/agents/agent-dialog/get-cabinet-price-preview.command.ts +0 -26
- package/commands/agents/agent-dialog/get-dialog-context-length.command.ts +0 -35
- package/commands/agents/agent-dialog/rename-agent-dialog.command.ts +0 -19
- package/commands/agents/agent-dialog/stop-cabinet-stream.command.ts +0 -15
- package/commands/agents/agent-template/get-agent-template-instructions-by-template.command.ts +0 -14
- package/commands/agents/agents/get-agent-statistics.command.ts +0 -28
- package/commands/ai-studio/canvas-tool/var-gen/generate-variables.command.ts +0 -20
- package/commands/ai-studio/canvas-tool/var-gen/get-var-gen-config.command.ts +0 -9
- package/commands/ai-studio/canvas-tool/var-gen/get-var-gen-price.command.ts +0 -18
- package/commands/ai-studio/canvas-tool/var-gen/index.ts +0 -3
- package/commands/photo-studio/add-photo-studio-checkpoint.command.ts +0 -23
- package/commands/photo-studio/clear-photo-studio-checkpoints.command.ts +0 -12
- package/commands/photo-studio/create-photo-studio-canvas.command.ts +0 -16
- package/commands/photo-studio/delete-photo-studio-canvas.command.ts +0 -11
- package/commands/photo-studio/delete-photo-studio-checkpoint.command.ts +0 -14
- package/commands/photo-studio/execute-photo-studio-action.command.ts +0 -49
- package/commands/photo-studio/find-photo-studio-canvas-by-uuid.query.ts +0 -12
- package/commands/photo-studio/find-photo-studio-canvases.query.ts +0 -20
- package/commands/photo-studio/find-photo-studio-checkpoints.query.ts +0 -12
- package/commands/photo-studio/find-photo-studio-job-by-id.query.ts +0 -36
- package/commands/photo-studio/find-photo-studio-jobs.query.ts +0 -20
- package/commands/photo-studio/get-photo-studio-actions.query.ts +0 -10
- package/commands/photo-studio/index.ts +0 -15
- package/commands/photo-studio/save-photo-studio-canvas.command.ts +0 -24
- package/commands/photo-studio/update-photo-studio-canvas.command.ts +0 -17
- package/commands/photo-studio/update-photo-studio-checkpoint.command.ts +0 -25
- package/commands/tools/diagrams/update-diagrams-job-favorite.command.ts +0 -19
- package/commands/tools/html-page-builder/update-html-page-builder-session-favorite.command.ts +0 -13
- package/commands/tools/image-editor/update-image-editor-job-favorite.command.ts +0 -19
- package/commands/tools/image-generation/update-image-generation-job-favorite.command.ts +0 -19
- package/commands/tools/interior-design/update-interior-design-job-favorite.command.ts +0 -19
- package/commands/tools/marketplace-card/update-marketplace-card-job-favorite.command.ts +0 -19
- package/commands/tools/music/update-music-job-favorite.command.ts +0 -19
- package/commands/tools/paraphrase/update-paraphrase-job-favorite.command.ts +0 -19
- package/commands/tools/presentation/update-presentation-favorite.command.ts +0 -13
- package/commands/tools/solving-edu-task/update-solving-edu-task-job-favorite.command.ts +0 -19
- package/commands/tools/spell-corrector/update-spell-corrector-job-favorite.command.ts +0 -19
- package/commands/tools/stt/update-stt-job-favorite.command.ts +0 -19
- package/commands/tools/tts/update-tts-job-favorite.command.ts +0 -19
- package/commands/tools/video/update-video-job-favorite.command.ts +0 -19
- package/commands/tools/video-editor/update-video-editor-job-favorite.command.ts +0 -19
- package/commands/tools/writer/update-writer-document-favorite.command.ts +0 -13
- package/constants/photo-studio/enums/index.ts +0 -1
- package/constants/photo-studio/enums/photo-studio-checkpoint-action-type.enum.ts +0 -7
- package/constants/tool/enums/job-sort.enum.ts +0 -4
- package/helpers/query-boolean.schema.ts +0 -13
- package/models/agents/agent-statistics.schema.ts +0 -38
- package/models/agents/message-attachment.schema.ts +0 -22
- package/models/photo-studio/index.ts +0 -4
- package/models/photo-studio/photo-studio-action.schema.ts +0 -18
- package/models/photo-studio/photo-studio-checkpoint.schema.ts +0 -22
- package/models/photo-studio/photo-studio-image-node.schema.ts +0 -22
- package/models/photo-studio/photo-studio.schema.ts +0 -16
- /package/build/constants/{photo-studio → b2b}/index.js +0 -0
- /package/constants/{photo-studio → b2b}/index.ts +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AnthropicErrorResponseSchema, AnthropicHeadersSchema } from './common.schemas';
|
|
3
|
+
|
|
4
|
+
export namespace AnthropicModelsCommand {
|
|
5
|
+
export const HeadersSchema = AnthropicHeadersSchema;
|
|
6
|
+
|
|
7
|
+
export const ModelSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
type: z.literal('model'),
|
|
11
|
+
display_name: z.string(),
|
|
12
|
+
created_at: z.string().datetime(),
|
|
13
|
+
})
|
|
14
|
+
.strict();
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
data: z.array(ModelSchema),
|
|
19
|
+
first_id: z.string().nullable(),
|
|
20
|
+
last_id: z.string().nullable(),
|
|
21
|
+
has_more: z.boolean(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
|
|
25
|
+
export const ErrorResponseSchema = AnthropicErrorResponseSchema;
|
|
26
|
+
|
|
27
|
+
export type Headers = z.infer<typeof HeadersSchema>;
|
|
28
|
+
export type Model = z.infer<typeof ModelSchema>;
|
|
29
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
30
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const NullableStringSchema = z.string().nullable();
|
|
4
|
+
|
|
5
|
+
export const OpenAIHeadersSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
authorization: z.string(),
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
10
|
+
|
|
11
|
+
export const AnthropicHeadersSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
'x-api-key': z.string(),
|
|
14
|
+
'anthropic-version': z.string().optional(),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
|
|
18
|
+
export const OpenAIErrorResponseSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
error: z
|
|
21
|
+
.object({
|
|
22
|
+
message: z.string(),
|
|
23
|
+
type: z.string(),
|
|
24
|
+
param: NullableStringSchema,
|
|
25
|
+
code: NullableStringSchema,
|
|
26
|
+
})
|
|
27
|
+
.strict(),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
|
|
31
|
+
export const AnthropicErrorResponseSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
type: z.literal('error'),
|
|
34
|
+
error: z
|
|
35
|
+
.object({
|
|
36
|
+
type: z.string(),
|
|
37
|
+
message: z.string(),
|
|
38
|
+
})
|
|
39
|
+
.strict(),
|
|
40
|
+
})
|
|
41
|
+
.strict();
|
|
42
|
+
|
|
43
|
+
export const CompatibleFileUploadMetadataSchema = z
|
|
44
|
+
.object({
|
|
45
|
+
filename: z.string(),
|
|
46
|
+
mimetype: z.string(),
|
|
47
|
+
size: z.number().int().nonnegative(),
|
|
48
|
+
})
|
|
49
|
+
.strict();
|
|
50
|
+
|
|
51
|
+
export type OpenAIHeaders = z.infer<typeof OpenAIHeadersSchema>;
|
|
52
|
+
export type AnthropicHeaders = z.infer<typeof AnthropicHeadersSchema>;
|
|
53
|
+
export type OpenAIErrorResponse = z.infer<typeof OpenAIErrorResponseSchema>;
|
|
54
|
+
export type AnthropicErrorResponse = z.infer<typeof AnthropicErrorResponseSchema>;
|
|
55
|
+
export type CompatibleFileUploadMetadata = z.infer<typeof CompatibleFileUploadMetadataSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './anthropic-files.command';
|
|
2
|
+
export * from './anthropic-messages.command';
|
|
3
|
+
export * from './anthropic-models.command';
|
|
4
|
+
export * from './common.schemas';
|
|
5
|
+
export * from './openai-files.command';
|
|
6
|
+
export * from './openai-models.command';
|
|
7
|
+
export * from './openai-responses.command';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
CompatibleFileUploadMetadataSchema,
|
|
4
|
+
OpenAIErrorResponseSchema,
|
|
5
|
+
OpenAIHeadersSchema,
|
|
6
|
+
} from './common.schemas';
|
|
7
|
+
|
|
8
|
+
export namespace OpenAIFilesCommand {
|
|
9
|
+
export const HeadersSchema = OpenAIHeadersSchema;
|
|
10
|
+
|
|
11
|
+
export const BodySchema = z
|
|
12
|
+
.object({
|
|
13
|
+
purpose: z.enum(['assistants', 'batch', 'fine-tune', 'vision', 'user_data', 'evals']),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
|
|
17
|
+
export const FileMetadataSchema = CompatibleFileUploadMetadataSchema;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
id: z.string().uuid(),
|
|
22
|
+
object: z.literal('file'),
|
|
23
|
+
bytes: z.number().int().nonnegative(),
|
|
24
|
+
created_at: z.number().int(),
|
|
25
|
+
filename: z.string(),
|
|
26
|
+
purpose: BodySchema.shape.purpose,
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
|
|
30
|
+
export const ErrorResponseSchema = OpenAIErrorResponseSchema;
|
|
31
|
+
|
|
32
|
+
export type Headers = z.infer<typeof HeadersSchema>;
|
|
33
|
+
export type Body = z.infer<typeof BodySchema>;
|
|
34
|
+
export type FileMetadata = z.infer<typeof FileMetadataSchema>;
|
|
35
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
36
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OpenAIErrorResponseSchema, OpenAIHeadersSchema } from './common.schemas';
|
|
3
|
+
|
|
4
|
+
export namespace OpenAIModelsCommand {
|
|
5
|
+
export const HeadersSchema = OpenAIHeadersSchema;
|
|
6
|
+
|
|
7
|
+
export const ModelSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
object: z.literal('model'),
|
|
11
|
+
created: z.number().int(),
|
|
12
|
+
owned_by: z.literal('rugpt'),
|
|
13
|
+
})
|
|
14
|
+
.strict();
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
object: z.literal('list'),
|
|
19
|
+
data: z.array(ModelSchema),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
|
|
23
|
+
export const ErrorResponseSchema = OpenAIErrorResponseSchema;
|
|
24
|
+
|
|
25
|
+
export type Headers = z.infer<typeof HeadersSchema>;
|
|
26
|
+
export type Model = z.infer<typeof ModelSchema>;
|
|
27
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
28
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OpenAIErrorResponseSchema, OpenAIHeadersSchema } from './common.schemas';
|
|
3
|
+
|
|
4
|
+
const OpenAIInputTextContentPartSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
type: z.enum(['input_text', 'text', 'output_text']),
|
|
7
|
+
text: z.string(),
|
|
8
|
+
})
|
|
9
|
+
.passthrough();
|
|
10
|
+
|
|
11
|
+
const OpenAIInputImageContentPartSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
type: z.literal('input_image'),
|
|
14
|
+
image_url: z.string().optional(),
|
|
15
|
+
file_id: z.string().optional(),
|
|
16
|
+
detail: z.enum(['auto', 'low', 'high']).optional(),
|
|
17
|
+
})
|
|
18
|
+
.passthrough();
|
|
19
|
+
|
|
20
|
+
const OpenAIInputFileContentPartSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
type: z.literal('input_file'),
|
|
23
|
+
file_id: z.string().optional(),
|
|
24
|
+
file_data: z.string().optional(),
|
|
25
|
+
file_url: z.string().optional(),
|
|
26
|
+
filename: z.string().optional(),
|
|
27
|
+
mime_type: z.string().optional(),
|
|
28
|
+
})
|
|
29
|
+
.passthrough();
|
|
30
|
+
|
|
31
|
+
export const OpenAIResponseInputContentPartSchema = z.discriminatedUnion('type', [
|
|
32
|
+
OpenAIInputTextContentPartSchema,
|
|
33
|
+
OpenAIInputImageContentPartSchema,
|
|
34
|
+
OpenAIInputFileContentPartSchema,
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
export const OpenAIResponseInputMessageSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
type: z.literal('message').optional(),
|
|
40
|
+
role: z.enum(['system', 'developer', 'user', 'assistant']),
|
|
41
|
+
content: z.union([z.string(), z.array(OpenAIResponseInputContentPartSchema)]),
|
|
42
|
+
})
|
|
43
|
+
.passthrough();
|
|
44
|
+
|
|
45
|
+
const OpenAIAnyToolSchema = z
|
|
46
|
+
.object({
|
|
47
|
+
type: z.string(),
|
|
48
|
+
})
|
|
49
|
+
.passthrough();
|
|
50
|
+
|
|
51
|
+
const OpenAIResponseMetadataSchema = z.record(z.string(), z.unknown());
|
|
52
|
+
|
|
53
|
+
const OpenAIResponseReasoningSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
effort: z.string().optional(),
|
|
56
|
+
summary: z.string().nullable().optional(),
|
|
57
|
+
})
|
|
58
|
+
.passthrough();
|
|
59
|
+
|
|
60
|
+
const OpenAIResponseTextOptionsSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
format: z.unknown().optional(),
|
|
63
|
+
verbosity: z.string().optional(),
|
|
64
|
+
})
|
|
65
|
+
.passthrough();
|
|
66
|
+
|
|
67
|
+
const OpenAIResponseUsageSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
input_tokens: z.number().int().nonnegative(),
|
|
70
|
+
output_tokens: z.number().int().nonnegative(),
|
|
71
|
+
total_tokens: z.number().int().nonnegative(),
|
|
72
|
+
input_tokens_details: z
|
|
73
|
+
.object({
|
|
74
|
+
cached_tokens: z.number().int().nonnegative().optional(),
|
|
75
|
+
})
|
|
76
|
+
.strict()
|
|
77
|
+
.optional(),
|
|
78
|
+
})
|
|
79
|
+
.strict();
|
|
80
|
+
|
|
81
|
+
const OpenAIResponseOutputTextSchema = z
|
|
82
|
+
.object({
|
|
83
|
+
type: z.literal('output_text'),
|
|
84
|
+
text: z.string(),
|
|
85
|
+
annotations: z.array(z.unknown()),
|
|
86
|
+
})
|
|
87
|
+
.strict();
|
|
88
|
+
|
|
89
|
+
const OpenAIResponseOutputMessageSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
id: z.string(),
|
|
92
|
+
type: z.literal('message'),
|
|
93
|
+
status: z.literal('completed'),
|
|
94
|
+
role: z.literal('assistant'),
|
|
95
|
+
content: z.array(OpenAIResponseOutputTextSchema),
|
|
96
|
+
})
|
|
97
|
+
.strict();
|
|
98
|
+
|
|
99
|
+
export namespace OpenAIResponsesCommand {
|
|
100
|
+
export const HeadersSchema = OpenAIHeadersSchema;
|
|
101
|
+
|
|
102
|
+
export const BodySchema = z
|
|
103
|
+
.object({
|
|
104
|
+
model: z.string(),
|
|
105
|
+
input: z.union([z.string(), z.array(OpenAIResponseInputMessageSchema).min(1)]),
|
|
106
|
+
instructions: z.string().optional(),
|
|
107
|
+
stream: z.boolean().optional(),
|
|
108
|
+
max_output_tokens: z.number().int().positive().optional(),
|
|
109
|
+
tools: z.array(OpenAIAnyToolSchema).optional(),
|
|
110
|
+
background: z.boolean().optional(),
|
|
111
|
+
include: z.array(z.string()).optional(),
|
|
112
|
+
max_tool_calls: z.number().int().positive().optional(),
|
|
113
|
+
metadata: OpenAIResponseMetadataSchema.nullable().optional(),
|
|
114
|
+
parallel_tool_calls: z.boolean().optional(),
|
|
115
|
+
previous_response_id: z.string().nullable().optional(),
|
|
116
|
+
prompt: z.unknown().optional(),
|
|
117
|
+
reasoning: OpenAIResponseReasoningSchema.nullable().optional(),
|
|
118
|
+
safety_identifier: z.string().optional(),
|
|
119
|
+
service_tier: z.string().optional(),
|
|
120
|
+
store: z.boolean().nullable().optional(),
|
|
121
|
+
stream_options: z.unknown().optional(),
|
|
122
|
+
temperature: z.number().optional(),
|
|
123
|
+
text: OpenAIResponseTextOptionsSchema.optional(),
|
|
124
|
+
tool_choice: z.unknown().optional(),
|
|
125
|
+
top_p: z.number().optional(),
|
|
126
|
+
truncation: z.string().optional(),
|
|
127
|
+
user: z.string().optional(),
|
|
128
|
+
})
|
|
129
|
+
.passthrough();
|
|
130
|
+
|
|
131
|
+
export const UsageSchema = OpenAIResponseUsageSchema;
|
|
132
|
+
|
|
133
|
+
export const ResponseSchema = z
|
|
134
|
+
.object({
|
|
135
|
+
id: z.string(),
|
|
136
|
+
object: z.literal('response'),
|
|
137
|
+
created_at: z.number().int(),
|
|
138
|
+
status: z.literal('completed'),
|
|
139
|
+
model: z.string(),
|
|
140
|
+
output: z.array(OpenAIResponseOutputMessageSchema),
|
|
141
|
+
output_text: z.string(),
|
|
142
|
+
usage: UsageSchema,
|
|
143
|
+
})
|
|
144
|
+
.strict();
|
|
145
|
+
|
|
146
|
+
export const StreamEventSchema = z.union([
|
|
147
|
+
z
|
|
148
|
+
.object({
|
|
149
|
+
type: z.literal('response.created'),
|
|
150
|
+
response: ResponseSchema.omit({ status: true }).extend({
|
|
151
|
+
status: z.literal('in_progress'),
|
|
152
|
+
output: z.array(z.never()),
|
|
153
|
+
output_text: z.literal(''),
|
|
154
|
+
}),
|
|
155
|
+
})
|
|
156
|
+
.strict(),
|
|
157
|
+
z
|
|
158
|
+
.object({
|
|
159
|
+
type: z.literal('response.output_text.delta'),
|
|
160
|
+
response_id: z.string(),
|
|
161
|
+
output_index: z.number().int(),
|
|
162
|
+
content_index: z.number().int(),
|
|
163
|
+
delta: z.string(),
|
|
164
|
+
})
|
|
165
|
+
.strict(),
|
|
166
|
+
z
|
|
167
|
+
.object({
|
|
168
|
+
type: z.literal('response.output_text.done'),
|
|
169
|
+
response_id: z.string(),
|
|
170
|
+
output_index: z.number().int(),
|
|
171
|
+
content_index: z.number().int(),
|
|
172
|
+
text: z.string(),
|
|
173
|
+
})
|
|
174
|
+
.strict(),
|
|
175
|
+
z
|
|
176
|
+
.object({
|
|
177
|
+
type: z.literal('response.completed'),
|
|
178
|
+
response: ResponseSchema,
|
|
179
|
+
})
|
|
180
|
+
.strict(),
|
|
181
|
+
OpenAIErrorResponseSchema,
|
|
182
|
+
]);
|
|
183
|
+
|
|
184
|
+
export const ErrorResponseSchema = OpenAIErrorResponseSchema;
|
|
185
|
+
|
|
186
|
+
export type Headers = z.infer<typeof HeadersSchema>;
|
|
187
|
+
export type Body = z.infer<typeof BodySchema>;
|
|
188
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
189
|
+
export type StreamEvent = z.infer<typeof StreamEventSchema>;
|
|
190
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
191
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { B2B_STATISTICS_PERIOD } from '../../constants';
|
|
3
|
+
import { B2bUsageStatisticsSchema } from '../../models/b2b';
|
|
4
|
+
|
|
5
|
+
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
6
|
+
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
7
|
+
|
|
8
|
+
const DateOnlySchema = z
|
|
9
|
+
.string()
|
|
10
|
+
.regex(DATE_ONLY_PATTERN)
|
|
11
|
+
.refine(
|
|
12
|
+
(value) => {
|
|
13
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
14
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
date.getUTCFullYear() === year &&
|
|
18
|
+
date.getUTCMonth() === month - 1 &&
|
|
19
|
+
date.getUTCDate() === day
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
{ message: 'Invalid calendar date' },
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const formatLocalDate = (date: Date): string => {
|
|
26
|
+
const year = date.getFullYear();
|
|
27
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
28
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
29
|
+
|
|
30
|
+
return `${year}-${month}-${day}`;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const toUtcCalendarTimestamp = (value: string): number => {
|
|
34
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
35
|
+
return Date.UTC(year, month - 1, day);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export namespace GetB2bUsageStatisticsCommand {
|
|
39
|
+
export const RequestQuerySchema = z
|
|
40
|
+
.object({
|
|
41
|
+
period: z.nativeEnum(B2B_STATISTICS_PERIOD).default(B2B_STATISTICS_PERIOD.THIRTY_DAYS),
|
|
42
|
+
dateFrom: DateOnlySchema.optional(),
|
|
43
|
+
dateTo: DateOnlySchema.optional(),
|
|
44
|
+
apiKeyId: z.string().uuid().optional(),
|
|
45
|
+
})
|
|
46
|
+
.superRefine((query, context) => {
|
|
47
|
+
const isCustom = query.period === B2B_STATISTICS_PERIOD.CUSTOM;
|
|
48
|
+
|
|
49
|
+
if (!isCustom) {
|
|
50
|
+
if (query.dateFrom !== undefined) {
|
|
51
|
+
context.addIssue({
|
|
52
|
+
code: z.ZodIssueCode.custom,
|
|
53
|
+
path: ['dateFrom'],
|
|
54
|
+
message: 'dateFrom is only allowed for custom period',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (query.dateTo !== undefined) {
|
|
58
|
+
context.addIssue({
|
|
59
|
+
code: z.ZodIssueCode.custom,
|
|
60
|
+
path: ['dateTo'],
|
|
61
|
+
message: 'dateTo is only allowed for custom period',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (query.dateFrom === undefined) {
|
|
68
|
+
context.addIssue({
|
|
69
|
+
code: z.ZodIssueCode.custom,
|
|
70
|
+
path: ['dateFrom'],
|
|
71
|
+
message: 'dateFrom is required for custom period',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (query.dateTo === undefined) {
|
|
75
|
+
context.addIssue({
|
|
76
|
+
code: z.ZodIssueCode.custom,
|
|
77
|
+
path: ['dateTo'],
|
|
78
|
+
message: 'dateTo is required for custom period',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (query.dateFrom === undefined || query.dateTo === undefined) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const today = formatLocalDate(new Date());
|
|
86
|
+
if (query.dateFrom > today) {
|
|
87
|
+
context.addIssue({
|
|
88
|
+
code: z.ZodIssueCode.custom,
|
|
89
|
+
path: ['dateFrom'],
|
|
90
|
+
message: 'dateFrom cannot be in the future',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (query.dateTo > today) {
|
|
94
|
+
context.addIssue({
|
|
95
|
+
code: z.ZodIssueCode.custom,
|
|
96
|
+
path: ['dateTo'],
|
|
97
|
+
message: 'dateTo cannot be in the future',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (query.dateFrom > query.dateTo) {
|
|
101
|
+
context.addIssue({
|
|
102
|
+
code: z.ZodIssueCode.custom,
|
|
103
|
+
path: ['dateTo'],
|
|
104
|
+
message: 'dateTo must be on or after dateFrom',
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const inclusiveDays =
|
|
110
|
+
(toUtcCalendarTimestamp(query.dateTo) - toUtcCalendarTimestamp(query.dateFrom)) /
|
|
111
|
+
MILLISECONDS_PER_DAY +
|
|
112
|
+
1;
|
|
113
|
+
if (inclusiveDays > 90) {
|
|
114
|
+
context.addIssue({
|
|
115
|
+
code: z.ZodIssueCode.custom,
|
|
116
|
+
path: ['dateTo'],
|
|
117
|
+
message: 'Custom period cannot exceed 90 calendar days',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export const ResponseSchema = z.object({
|
|
123
|
+
data: B2bUsageStatisticsSchema,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
127
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-b2b-usage-statistics.command';
|
package/commands/index.ts
CHANGED
|
@@ -18,10 +18,10 @@ export * from './form-submission';
|
|
|
18
18
|
export * from './key-value';
|
|
19
19
|
export * from './message';
|
|
20
20
|
export * from './midjourney';
|
|
21
|
+
export * from './model-page';
|
|
21
22
|
export * from './page';
|
|
22
23
|
export * from './order';
|
|
23
24
|
export * from './payment';
|
|
24
|
-
export * from './photo-studio';
|
|
25
25
|
export * from './product';
|
|
26
26
|
export * from './question';
|
|
27
27
|
export * from './referral';
|
|
@@ -50,6 +50,8 @@ export * from './cabinet';
|
|
|
50
50
|
export * from './webmaster';
|
|
51
51
|
export * from './webmaster-click';
|
|
52
52
|
export * from './b2b';
|
|
53
|
+
export * from './b2b-usage-log';
|
|
54
|
+
export * from './b2b-compatible';
|
|
53
55
|
export * from './community';
|
|
54
56
|
export * from './user-profile';
|
|
55
57
|
export * from './team-account';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ModelPageSchema } from '../../../models';
|
|
3
|
+
import { ModelPageSourceCreateSchema } from '../common.schemas';
|
|
4
|
+
|
|
5
|
+
export namespace CreateModelPageCommand {
|
|
6
|
+
export const RequestSchema = ModelPageSourceCreateSchema;
|
|
7
|
+
|
|
8
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: ModelPageSchema,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ModelPageDeleteResponseSchema, ModelPageUuidParamSchema } from '../common.schemas';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteModelPageCommand {
|
|
5
|
+
export const RequestParamSchema = ModelPageUuidParamSchema;
|
|
6
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
7
|
+
|
|
8
|
+
export const ResponseSchema = ModelPageDeleteResponseSchema;
|
|
9
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ModelPageSchema } from '../../../models';
|
|
3
|
+
import { ModelPageUuidParamSchema } from '../common.schemas';
|
|
4
|
+
|
|
5
|
+
export namespace FindModelPageAdminCommand {
|
|
6
|
+
export const RequestParamSchema = ModelPageUuidParamSchema;
|
|
7
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: ModelPageSchema,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MODEL_PAGE_TYPE } from '../../../constants';
|
|
3
|
+
import { ModelPageSchema } from '../../../models';
|
|
4
|
+
import { OptionalQueryArraySchema } from '../common.schemas';
|
|
5
|
+
|
|
6
|
+
export namespace FindModelPagesAdminCommand {
|
|
7
|
+
export const RequestQuerySchema = z.object({
|
|
8
|
+
vendorIds: OptionalQueryArraySchema(z.string().uuid()),
|
|
9
|
+
types: OptionalQueryArraySchema(z.nativeEnum(MODEL_PAGE_TYPE)),
|
|
10
|
+
slug: z.string().optional(),
|
|
11
|
+
limit: z.coerce.number().int().min(1).max(100).optional().default(20),
|
|
12
|
+
offset: z.coerce.number().int().min(0).optional().default(0),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = z.object({
|
|
18
|
+
data: z.array(ModelPageSchema),
|
|
19
|
+
page: z.number(),
|
|
20
|
+
totalPages: z.number(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MODEL_PAGE_TYPE } from '../../../constants';
|
|
3
|
+
import { ModelPageSchema } from '../../../models';
|
|
4
|
+
import { ModelPageUuidParamSchema } from '../common.schemas';
|
|
5
|
+
|
|
6
|
+
export namespace UpdateModelPageCommand {
|
|
7
|
+
export const RequestParamSchema = ModelPageUuidParamSchema;
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
slug: z.string().min(1).optional(),
|
|
13
|
+
type: z.nativeEnum(MODEL_PAGE_TYPE).optional(),
|
|
14
|
+
vendorId: z.string().uuid().optional(),
|
|
15
|
+
aiModelId: z.string().uuid().nullable().optional(),
|
|
16
|
+
toolModelId: z.string().uuid().nullable().optional(),
|
|
17
|
+
})
|
|
18
|
+
.superRefine((value, context) => {
|
|
19
|
+
if (value.aiModelId && value.toolModelId) {
|
|
20
|
+
context.addIssue({
|
|
21
|
+
code: z.ZodIssueCode.custom,
|
|
22
|
+
message: 'aiModelId and toolModelId cannot both be set',
|
|
23
|
+
path: ['toolModelId'],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (value.type === MODEL_PAGE_TYPE.TEXT) {
|
|
28
|
+
if (value.aiModelId === null) {
|
|
29
|
+
context.addIssue({
|
|
30
|
+
code: z.ZodIssueCode.custom,
|
|
31
|
+
message: 'aiModelId cannot be null for TEXT',
|
|
32
|
+
path: ['aiModelId'],
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (value.toolModelId) {
|
|
36
|
+
context.addIssue({
|
|
37
|
+
code: z.ZodIssueCode.custom,
|
|
38
|
+
message: 'toolModelId cannot be set for TEXT',
|
|
39
|
+
path: ['toolModelId'],
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (value.type && value.type !== MODEL_PAGE_TYPE.TEXT) {
|
|
45
|
+
if (value.aiModelId) {
|
|
46
|
+
context.addIssue({
|
|
47
|
+
code: z.ZodIssueCode.custom,
|
|
48
|
+
message: 'aiModelId cannot be set for a non-text model page',
|
|
49
|
+
path: ['aiModelId'],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (value.toolModelId === null) {
|
|
53
|
+
context.addIssue({
|
|
54
|
+
code: z.ZodIssueCode.custom,
|
|
55
|
+
message: 'toolModelId cannot be null for a non-text model page',
|
|
56
|
+
path: ['toolModelId'],
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
63
|
+
|
|
64
|
+
export const ResponseSchema = z.object({
|
|
65
|
+
data: ModelPageSchema,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
69
|
+
}
|