Skip to content

Commit

Permalink
move to the documents component
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed May 29, 2024
1 parent 745f369 commit 67d9d23
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
8 changes: 8 additions & 0 deletions app/Domains/EmailParser/EmailClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function handle(Source $source): array

$foldersToCheck = explode(',', trim($source->secrets['email_box']));

$foldersToCheck = collect($foldersToCheck)->map(function ($folder) {
return str($folder)->lower()->toString();
})->toArray();

$secrets = $source->secrets;

$config = [
Expand Down Expand Up @@ -83,10 +87,14 @@ public function handle(Source $source): array

foreach ($folders as $folder) {
$full_name = data_get($folder, 'full_name');

Log::info('Checking folder', [
'full_name' => $full_name,
'folders_to_check' => $foldersToCheck,
]);

$full_name = str($full_name)->lower()->toString();

if (in_array($full_name, $foldersToCheck)) {
$messages = $folder->messages()->all()->get();
logger('[LaraChain] - Email Box Count', [
Expand Down
2 changes: 0 additions & 2 deletions app/Jobs/SummarizeDocumentJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public function handle(): void
], $this->prompt);
}

put_fixture('prompt_being_used_summary.txt', $prompt, false);

/** @var CompletionResponse $results */
$results = LlmDriverFacade::driver(
$this->document->getDriver()
Expand Down
19 changes: 18 additions & 1 deletion resources/js/Pages/Collection/Components/Documents.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<script setup>
import {computed, ref} from 'vue';
import {computed, onMounted, ref} from 'vue';
import Tags from '@/Components/Tags.vue';
import ShowDocument from '@/Pages/Collection/Components/ShowDocument.vue';
import DocumentReset from '@/Pages/Collection/Components/DocumentReset.vue';
import ActionDeleteDocuments from "@/Pages/Collection/Components/ActionDeleteDocuments.vue";
import ActionCreateFilter from "@/Pages/Collection/Components/ActionCreateFilter.vue";
import Filters from "@/Pages/Collection/Components/Filters.vue";
import ManageFilters from "@/Pages/Collection/Components/ManageFilters.vue";
import {router} from "@inertiajs/vue3";
import {useToast} from "vue-toastification";
const toast = useToast();
const props = defineProps({
collection: {
Expand Down Expand Up @@ -53,6 +57,19 @@ const emptyDocumentIds = () => {
console.log("Resetting documents");
selectedDocuments.value = new Set()
}
onMounted(() => {
Echo.private(`collection.${props.collection.id}`)
.listen('.status', (e) => {
console.log(e.status);
router.reload({ only: ['documents'] })
let message = e.message;
if (message) {
if(message !== 'Processing Document') {
toast.info(message)
}
}
});
});
Expand Down
14 changes: 1 addition & 13 deletions resources/js/Pages/Collection/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,7 @@ const closeEditCollectionSlideOut = () => {
showEditCollection.value = false;
};
onMounted(() => {
Echo.private(`collection.${props.collection.data.id}`)
.listen('.status', (e) => {
console.log(e.status);
router.reload({ only: ['documents'] })
let message = e.message;
if (message) {
if(message !== 'Processing Document') {
toast.info(message)
}
}
});
});
const reset = () => {
//router.reload();
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/EmailClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Domains\Sources\SourceTypeEnum;
use App\Models\Source;
use Tests\TestCase;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Support\FolderCollection;

class EmailClientTest extends TestCase
Expand Down

0 comments on commit 67d9d23

Please sign in to comment.