Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: display doc metadata #109

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/components/MemorySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ defineProps<{
}>()

const selectedCollection = ref('episodic')
const showMeta = ref(false)
const selectedItem = ref('')
const showMetadata = (id: string) => {
selectedItem.value = selectedItem.value === id ? '' : id;
}
</script>

<template>
Expand Down Expand Up @@ -41,6 +46,23 @@ const selectedCollection = ref('episodic')
<p class="truncate">{{ item.metadata.source }} {{ item.metadata.name ? `(${item.metadata.name})` : '' }}</p>
<p class="whitespace-nowrap">{{ new Date(item.metadata.when * 1000).toLocaleString() }}</p>
</div>
<div
class="indicator-item indicator-center tooltip before:rounded-lg pt-8 before:font-medium before:text-base-100"
>
<span class="badge badge-neutral cursor-pointer font-medium text-base-100" @click="showMetadata(item.id)">
{{ selectedItem === item.id ? 'Hide Metadata' : 'View Metadata' }}
</span>
</div>
<div v-if="selectedItem === item.id" class="font-medium text-base-100 shadow-lg">
<ul class="list-disc">
<li v-for="(el, value) in item.metadata" :key="value" class="flex justify-between items-center py-2">
<div class="flex flex-col text-left">
<div class="text-sm font-semibold text-neutral/90">{{ value }}</div>
</div>
<div class="text-sm text-right text-neutral/70">{{ el }}</div>
</li>
</ul>
</div>
</div>
</template>
<p v-else class="text-center text-sm font-medium">
Expand Down
Loading