Implement template export/import endpoints and enhance grid generation logic
Added new endpoints for exporting and importing grid configurations in TemplateEndpoints, allowing for better management of template data. Enhanced the GenerateGridCommandHandler to support seasonal layers in grid generation, improving scheduling accuracy during holiday periods. Updated related classes and records to accommodate these changes, ensuring a cohesive integration of new features. Improved documentation for clarity and maintainability.
This commit is contained in:
@@ -7,7 +7,10 @@ import type {
|
||||
CreatedIdResponse,
|
||||
EntryTraceDto,
|
||||
GenerateGridResultDto,
|
||||
GridConfig,
|
||||
GridGenerationMode,
|
||||
GridImportResultDto,
|
||||
GridPromptDto,
|
||||
GridPlanDto,
|
||||
GridProfileDto,
|
||||
GridProfileKind,
|
||||
@@ -121,6 +124,33 @@ export function generateGrid(
|
||||
})
|
||||
}
|
||||
|
||||
/** Выгрузка сетки одним файлом: перенос, бэкап перед экспериментом и образец для ИИ. */
|
||||
export function exportGrid(channelId: string) {
|
||||
return apiRequest<GridConfig>(`/admin/channels/${channelId}/template/export`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Загрузка сетки из файла. `replace` — снести существующие слоты и построить заново; иначе слои
|
||||
* и слоты добавляются к тому, что уже есть.
|
||||
*/
|
||||
export function importGrid(channelId: string, config: GridConfig, replace: boolean) {
|
||||
return apiRequest<GridImportResultDto>(`/admin/channels/${channelId}/template/import`, {
|
||||
method: 'POST',
|
||||
body: { config, replace },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Собирает текст запроса к ИИ по референс-каналам и пожеланиям. Никуда не отправляется — админ
|
||||
* копирует его в свою модель и приносит ответ назад кнопкой импорта.
|
||||
*/
|
||||
export function buildGridPrompt(channelId: string, references: string[], notes: string) {
|
||||
return apiRequest<GridPromptDto>(`/admin/channels/${channelId}/template/ai-prompt`, {
|
||||
method: 'POST',
|
||||
body: { references, notes: notes || null },
|
||||
})
|
||||
}
|
||||
|
||||
/** Копия сетки на другой канал: слои, слоты, стыки и правила. Группы общие и не копируются. */
|
||||
export function copyTemplateTo(channelId: string, targetChannelId: string) {
|
||||
return apiRequest<CopyTemplateResultDto>(
|
||||
|
||||
Reference in New Issue
Block a user