Skip to content

Commit beeb5c5

Browse files
committed
Add timeout and prevent repeat
1 parent 82f7bf1 commit beeb5c5

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

Modules/LlmDriver/app/Functions/StandardsChecker.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function handle(
3636

3737
$this->results = [];
3838

39-
foreach ($documents->chunk(3) as $chunk) {
39+
foreach ($documents->chunk(3) as $index => $chunk) {
4040
notify_ui($model->getChat(), sprintf('About to compare document to %d documents in the Collection', count($chunk)));
4141

4242
$prompts = [];
@@ -52,13 +52,20 @@ public function handle(
5252
$prompts[] = $prompt;
5353
}
5454

55-
$results = LlmDriverFacade::driver($model->getDriver())
56-
->completionPool($prompts);
55+
try {
56+
$results = LlmDriverFacade::driver($model->getDriver())
57+
->completionPool($prompts);
5758

58-
notify_ui($model->getChat(), 'Got some results will check the next set of documents in the Collection');
59+
notify_ui($model->getChat(), 'Got some results will check the next set of documents in the Collection');
5960

60-
foreach ($results as $result) {
61-
$this->results[] = $result->content;
61+
foreach ($results as $result) {
62+
$this->results[] = $result->content;
63+
}
64+
} catch (\Exception $e) {
65+
Log::error('Error running Standards Checker', [
66+
'error' => $e->getMessage(),
67+
'index' => $index,
68+
]);
6269
}
6370
}
6471

app/Jobs/OrchestrateJob.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ class OrchestrateJob implements ShouldQueue
2323
*/
2424
public $tries = 1;
2525

26-
27-
2826
/**
2927
* Create a new job instance.
3028
*/
@@ -51,7 +49,7 @@ public function handle(): void
5149
*/
5250
public function middleware(): array
5351
{
54-
return [new WithoutOverlapping($this->chat->id)];
52+
return [new WithoutOverlapping(sprintf('orchestrate_chat_id_%d', $this->chat->id))];
5553
}
5654

5755
/**
@@ -61,5 +59,4 @@ public function retryUntil(): \DateTime
6159
{
6260
return now()->addMinutes(10);
6361
}
64-
6562
}

resources/css/app.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
[x-cloak] {
66
display: none;
77
}
8+

resources/js/Pages/Chat/ChatBaloon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const props = defineProps({
1212
<template>
1313

1414

15-
<div class="message-container mx-auto max-container flex items-start gap-x-4"
15+
<div class="mx-auto max-container flex items-start gap-x-4"
1616
:class="message.from_ai ? 'flex-row-reverse' : 'flex-row'">
1717

1818
<div>
@@ -79,7 +79,7 @@ const props = defineProps({
7979
</TabGroup>
8080
</div>
8181
<div v-else
82-
class="bg-base-100 flex rounded-md shadow-lg shadow-inner-custom p-4 prose w-3/4 ml-52"
82+
class="bg-base-100 flex rounded-md shadow-lg shadow-inner-custom p-4 prose "
8383
:class="message.from_ai ? 'rounded-tr-none' : 'flex-row-reverse'">
8484
<div class="grow"
8585
:class="message.from_ai ? 'rounded-tr-none' : 'rounded-tl-none'"

resources/js/Pages/Chat/ChatMessage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const toast = useToast();
2121

2222
<template>
2323
<div id="chat-messages"
24-
class="flex-col flex flex-grow h-full overflow-y-scroll gap-y-8 py-10 px-2
24+
class="flex-col flex flex-grow h-full overflow-y-scroll gap-y-8 py-10 px-10
2525
">
2626
<div v-if="chat?.id && messages.length === 0">
2727
Ask a question below to get started.

0 commit comments

Comments
 (0)