Skip to content

Commit

Permalink
hmm
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Aug 27, 2023
1 parent 804f362 commit 845ed06
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions app/Domains/Scheduling/TaskRepository.php
Expand Up @@ -6,7 +6,6 @@
use App\Jobs\MessageCreatedJob;
use App\Models\Message;
use App\Models\Task;
use App\OpenAi\ChatClient;
use Carbon\Carbon;

class TaskRepository
Expand All @@ -22,7 +21,7 @@ public function handle(TasksDto $tasksDto, Message $message): void
'message_id' => $message->id,
]);

$summary[] = $task->description . ' on ' . $task->date;
$summary[] = $task->description.' on '.$task->date;
}
}

Expand All @@ -31,8 +30,8 @@ public function handle(TasksDto $tasksDto, Message $message): void
$summary = sprintf("The following tasks have been created %s\n\n", $summary);

$message->content = str($message->content)->prepend($summary);
// $message->run_functions = false;//prevent a loop
// $message->run_functions = false;//prevent a loop
$message->updateQuietly();
// MessageCreatedJob::dispatchSync($message);
// MessageCreatedJob::dispatchSync($message);
}
}
2 changes: 1 addition & 1 deletion app/Jobs/MessageCreatedJob.php
Expand Up @@ -34,7 +34,7 @@ public function handle(): void
MessageStatusEvent::dispatch($this->message);
/** @var Response $results */
$results = MessageRepository::handle($this->message);
if($results != null) {
if ($results != null) {
Message::create([
'user_id' => $this->message->user_id,
'content' => $results->content,
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Message.php
Expand Up @@ -13,7 +13,7 @@
* @property int $id
* @property string $role
* @property int $parent_id
* @property boolean $run_functions
* @property bool $run_functions
* @property int $user_id
* @property string $content
* @property array $embedding
Expand Down
1 change: 0 additions & 1 deletion app/OpenAi/ChatClient.php
Expand Up @@ -6,7 +6,6 @@
use App\Models\Message;
use App\OpenAi\Dtos\FunctionCallDto;
use App\OpenAi\Dtos\Response;
use Facades\App\OpenAi\ChatClient as ChatClientFacade;
use Facades\App\OpenAi\FunctionCall;
use OpenAI\Laravel\Facades\OpenAI;

Expand Down
2 changes: 1 addition & 1 deletion database/factories/MessageFactory.php
Expand Up @@ -25,7 +25,7 @@ public function definition(): array
'content' => fake()->sentence(4, true),
'user_id' => User::factory(),
'parent_id' => null,
'run_functions' => true
'run_functions' => true,
];
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/MessageRepositoryTest.php
Expand Up @@ -15,7 +15,7 @@ public function test_makes_request()
{

$response = Response::from([
'content' => "Foo"
'content' => 'Foo',
]);
ChatClient::shouldReceive('setMessage->chat')->once()->andReturn(
$response
Expand Down

0 comments on commit 845ed06

Please sign in to comment.