diff --git a/core/components/modai/src/Tools/CreateResource.php b/core/components/modai/src/Tools/CreateResource.php index fda0f24..c0930e2 100644 --- a/core/components/modai/src/Tools/CreateResource.php +++ b/core/components/modai/src/Tools/CreateResource.php @@ -50,7 +50,7 @@ public static function getParameters(modX $modx): array "description" => 'The content of the new resource. Generate this based on the users\' prompt. Allow the user to iterate on the content to create before finally calling the appropriate tool. Generate the content as HTML.' ], ], - "required" => ["name", "description", 'content'] + "required" => ["pagetitle", "template", "parent", 'content'] ], "description" => "List of resources to create" ], diff --git a/core/components/modai/src/Tools/EditChunk.php b/core/components/modai/src/Tools/EditChunk.php index ff23d53..516c7c9 100644 --- a/core/components/modai/src/Tools/EditChunk.php +++ b/core/components/modai/src/Tools/EditChunk.php @@ -93,15 +93,15 @@ public function runTool(array $arguments): string } $chunk->set('description', (string)$arguments['chunk']['description']); $chunk->set('snippet', (string)$arguments['chunk']['content']); - if ($chunk->save()) { - return json_encode(['success' => true, 'message' => 'Chunk updated. Use with: [[$' . $chunk->get('name') . ']]']); + if (!$chunk->save()) { + return json_encode(['success' => false, 'message' => 'Could not save chunk.']); } if ($this->clearCache) { $this->modx->cacheManager->refresh(); } - return json_encode(['success' => false, 'message' => 'Could not save chunk.']); + return json_encode(['success' => true, 'message' => 'Chunk updated. Use with: [[$' . $chunk->get('name') . ']]']); } public static function checkPermissions(modX $modx): bool diff --git a/core/components/modai/src/Tools/GetChunks.php b/core/components/modai/src/Tools/GetChunks.php index 5dfdb65..83dbb2e 100644 --- a/core/components/modai/src/Tools/GetChunks.php +++ b/core/components/modai/src/Tools/GetChunks.php @@ -83,7 +83,7 @@ public function runTool(array $arguments): string if (!empty($arguments['name'])) { $where[] = [ - 'name' => $arguments['query'], + 'name' => $arguments['name'], ]; } diff --git a/core/components/modai/src/Tools/GetTemplates.php b/core/components/modai/src/Tools/GetTemplates.php index deb088d..1228603 100644 --- a/core/components/modai/src/Tools/GetTemplates.php +++ b/core/components/modai/src/Tools/GetTemplates.php @@ -83,7 +83,7 @@ public function runTool(array $arguments): string if (!empty($arguments['name'])) { $where[] = [ - 'templatename' => $arguments['query'], + 'templatename' => $arguments['name'], ]; }