Skip to content

Commit

Permalink
allow empty string for extra llm params
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed May 6, 2024
1 parent 06f695b commit c3c0bc2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Service/OpenAiSettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,11 @@ public function setMaxTokens(int $maxTokens): void {
}

public function setLlmExtraParams(string $llmExtraParams): void {
$paramsArray = json_decode($llmExtraParams, true);
if ($paramsArray === null) {
throw new Exception('Invalid model extra parameters');
if ($llmExtraParams !== '') {
$paramsArray = json_decode($llmExtraParams, true);
if (!is_array($paramsArray)) {
throw new Exception('Invalid model extra parameters, must be a valid JSON object string or an empty string');
}
}
$this->config->setAppValue(Application::APP_ID, 'llm_extra_params', $llmExtraParams);
}
Expand Down

0 comments on commit c3c0bc2

Please sign in to comment.