Skip to content

Commit

Permalink
add content to sections to troubleshoot more
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 26, 2024
1 parent fa0a945 commit e981079
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/Http/Resources/SectionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public function toArray(Request $request): array
'content' => $this->content,
'content_formatted' => str($this->content)->markdown(),
'sort_order' => $this->sort_order,
'document' => $this->document,
'document' => new DocumentResource($this->document),
'prompt' => str($this->prompt)->markdown(),
'entries' => EntryResource::collection($this->entries),
];
}
Expand Down
38 changes: 32 additions & 6 deletions resources/js/Pages/Chat/Components/Section.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
<script setup>
import Entry from "@/Pages/Chat/Components/Entry.vue";
import {ref} from "vue";
const props = defineProps({
section: Object
})
const activeTab = ref('content');
const toggleTab = (tab) => {
activeTab.value = tab;
}
</script>

<template>
<div>
<h3 class="font-bold">Section ID: {{ section.id }} - {{ section.subject }}</h3>

<div class="prose" v-html="section.content"></div>
<div class="flex justify-end gap-2 items-center text-sm text-gray-500">
<div> sort: {{ section.sort_order + 1 }}</div>
<div role="tablist" class="tabs tabs-bordered mt-4 mb-2">
<a role="tab" class="tab"
:class="{ 'tab-active': activeTab === 'content' }"
@click="toggleTab('content')"
>Results</a>
<a role="tab" class="tab"
:class="{ 'tab-active': activeTab === 'document' }"
@click="toggleTab('document')"
>Document</a>
</div>
<div>
<div v-for="entry in section.entries" class="border border-neutral rounded-md p-4 mt-4">
<Entry :entry="entry"></Entry>
<div v-if="activeTab === 'content'">
<div class="prose" v-html="section.content"></div>
<div class="flex justify-end gap-2 items-center text-sm text-gray-500">
<div> sort: {{ section.sort_order + 1 }}</div>
</div>
<div>
<div v-for="entry in section.entries" class="border border-neutral rounded-md p-4 mt-4">
<Entry :entry="entry"></Entry>
</div>
</div>
</div>
<div v-if="activeTab === 'document'">
<h2 class="font-bold mb-2">
Related Document: {{ section.document.file_path }}
</h2>
<div class="prose" v-html="section.document.original_content"></div>
</div>
</div>
</template>
Expand Down

0 comments on commit e981079

Please sign in to comment.