Skip to content

Commit

Permalink
CyberBuddy - Rename keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
csavelief committed Oct 7, 2024
1 parent f79ed3a commit 3332246
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/Modules/CyberBuddy/Helpers/ApiUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public function delete_chunks(array $uids, string $collectionName): array
}

/** @deprecated */
public function ask_chunks_demo(string $question): array
public function ask_chunks_demo(string $collection, string $question): array
{
/** @var Prompt $prompt */
$prompt = Prompt::where('name', 'default_debugger')->firstOrfail();
return $this->ask_chunks($question, 'anssi-2017', $prompt->template, true, true, 'fr');
return $this->ask_chunks($question, $collection, $prompt->template, true, true, 'fr');
}

public function ask_chunks(string $question, string $collectionName, string $prompt, bool $rerankings = true, bool $showContext = true, string $lang = 'en', int $maxDocsUsed = 5): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,17 @@ public function handle(): void
");
}
})->skipsConversation();
$botman->hears('/question {question}', function (BotMan $botman, string $question) {
$botman->hears('/question {collection} {question}', function (BotMan $botman, string $collection, string $question) {
$botman->types();
$response = ApiUtils::ask_chunks_demo($question);
$response = ApiUtils::ask_chunks_demo($collection, $question);
if ($response['error']) {
$botman->reply('Une erreur s\'est produite. Veuillez réessayer ultérieurement.');
} else {
$answer = self::enhanceAnswerWithSources($response['response'], collect($response['context'] ?? []));
$botman->reply($answer);
}
})->skipsConversation();
$botman->hears('/frameworks', fn(BotMan $botman) => $botman->startConversation(new FrameworksConversation()));
$botman->hears('/conversation', fn(BotMan $botman) => $botman->startConversation(new FrameworksConversation()));
$botman->fallback(fn(BotMan $botman) => $botman->reply('Désolé, je n\'ai pas compris votre commande.'));
$botman->listen();
}
Expand Down

0 comments on commit 3332246

Please sign in to comment.