diff --git a/app/Console/Commands/Bundle/Describe.php b/app/Console/Commands/Bundle/Describe.php index b0d3b12..495e83e 100644 --- a/app/Console/Commands/Bundle/Describe.php +++ b/app/Console/Commands/Bundle/Describe.php @@ -146,16 +146,17 @@ private function describeContent(Bundle $bundle, $progress) $text = Translator::translate($text, $lang, $currentLanguage); } - $text = textarea( + $newText = textarea( label: sprintf('Confirm description for "%s"', $bundle->getArticleTitle()), default: $text, required: true ); $bundle->metadata()->set('description', [ - 'text' => $text, + 'text' => $newText, 'generator' => $result['handler'], 'model' => $result['model'], + 'edited' => $text !== $newText, ]); $bundle->metadata()->save(); @@ -229,16 +230,17 @@ private function describeAttachment(Bundle $bundle, string $ref, array $data) $text = Translator::translate($text, $lang, $currentLanguage); } - $text = textarea( + $newText = textarea( label: sprintf('Confirm description for %s', $fullPath), default: $text, required: true ); $manager->manager()->set(sprintf('files.%s.alt', $ref), [ - 'text' => $text, + 'text' => $newText, 'generator' => $result['handler'], 'model' => $result['model'], + 'edited' => $newText !== $text, ]); $manager->manager()->save(); @@ -251,11 +253,14 @@ private function describeAttachment(Bundle $bundle, string $ref, array $data) private function askAiToSummarizeBundle(Bundle $bundle) { - $prompt = 'Summarize the following markdown in two sentences, using the first person: + $prompt = 'Summarize the content of the following Markdown text: ```markdown # ' . $bundle->getArticleTitle() . ' ' . $bundle->markdown()->get() . ' -``` +``` +The goal is to create a summary that captures the spirit and key points of the page. Use concise phrases, but ensure they reflect the tone and content of the Markdown text. +The summary should be written in English or French and not exceed 255 characters. It will be used in the `` tag of the page to help search engines understand the content of the file. +Do not include any header to the answer. '; $results = AI::providers([ AI::make('open-webui')->forService(AIHandler::SERVICE_SUMMARIZE_CONTENT)->withPrompt($prompt),