Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
jringeisen committed Feb 12, 2024
2 parents 519d69f + d541d62 commit 93c3ea8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/Services/Adapters/AI/OpenAI/OpenAIAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public function request(bool $isString = false): AIContentDto
$chatCreationOptions = [
'model' => self::MODEL,
'messages' => $this->messages->toArray(),
'user' => 'user-'.$this->user->id,
'user' => 'user-' . $this->user->id,
];

if (! $isString) {
if (!$isString) {
$chatCreationOptions['response_format'] = ['type' => 'json_object'];
}

Expand Down Expand Up @@ -83,7 +83,7 @@ public function convertResponse(mixed $response): AIContentDto
$dto->setSubCategory($response->sub_category);
} elseif (property_exists($response, 'questions')) {
$dto->setQuestions($response->questions);
} else {
} elseif (is_string($response)) {
$dto->setMessage($response);
}

Expand All @@ -102,7 +102,7 @@ function () {
->createStreamed([
'model' => self::MODEL,
'messages' => $this->messages->toArray(),
'user' => 'user-'.$this->user->id,
'user' => 'user-' . $this->user->id,
]);

$message = '';
Expand All @@ -129,7 +129,7 @@ function () {
);
}

echo 'data: '.json_encode($data, JSON_THROW_ON_ERROR)."\n\n";
echo 'data: ' . json_encode($data, JSON_THROW_ON_ERROR) . "\n\n";

ob_flush();
flush();
Expand Down

0 comments on commit 93c3ea8

Please sign in to comment.