Skip to content

Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base

improve ui

Hugo Richard4315cde8c720
diff --git a/apps/chat/app/components/UserMenu.vue b/apps/chat/app/components/UserMenu.vue
index 91c8baf..0d6ae60 100644
--- a/apps/chat/app/components/UserMenu.vue
+++ b/apps/chat/app/components/UserMenu.vue
@@ -214,8 +214,8 @@ const items = computed<DropdownMenuItem[][]>(() => {
children: [
{
label: 'Sources',
- icon: 'i-lucide-book-open',
- to: '/admin/sources',
+ icon: 'i-lucide-database',
+ to: '/admin',
},
{
label: 'Sync all',
diff --git a/apps/chat/app/layouts/admin.vue b/apps/chat/app/layouts/admin.vue
index a048024..04e3830 100644
--- a/apps/chat/app/layouts/admin.vue
+++ b/apps/chat/app/layouts/admin.vue
@@ -1,64 +1,43 @@
<script setup lang="ts">
-const { user, clear } = useUserSession()
-
-const navItems = [{ label: 'Sources', to: '/admin/sources', icon: 'i-lucide-book-open' },]
+const navigation = [
+ {
+ label: 'Sources',
+ icon: 'i-lucide-database',
+ to: '/admin',
+ },
+]
</script>
<template>
- <div class="min-h-screen bg-default">
- <header class="sticky top-0 z-50 border-b border-default bg-elevated/80 backdrop-blur-sm">
- <div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
- <div class="flex items-center justify-between h-14">
- <div class="flex items-center gap-4">
- <NuxtLink to="/" class="flex items-center gap-2">
- <Logo class="h-7 w-auto" />
- <span class="font-semibold text-highlighted">Admin</span>
- </NuxtLink>
-
- <nav class="flex items-center gap-1 ml-4">
- <NuxtLink
- v-for="item in navItems"
- :key="item.to"
- :to="item.to"
- class="px-3 py-1.5 text-sm font-medium rounded-md transition-colors"
- :class="$route.path.startsWith(item.to) ? 'bg-elevated text-highlighted' : 'text-muted hover:text-highlighted hover:bg-elevated/50'"
- >
- {{ item.label }}
- </NuxtLink>
- </nav>
- </div>
+ <UDashboardGroup>
+ <UDashboardSidebar
+ id="admin-sidebar"
+ class="bg-elevated/50"
+ >
+ <template #header>
+ <NuxtLink
+ to="/"
+ class="flex items-center gap-2 text-sm text-muted hover:text-highlighted transition-colors -ml-1"
+ >
+ <UIcon name="i-lucide-arrow-left" class="size-4" aria-hidden="true" />
+ <span>Back to Chat</span>
+ </NuxtLink>
+ </template>
- <div class="flex items-center gap-3">
- <UButton
- to="/"
- color="neutral"
- variant="ghost"
- size="sm"
- icon="i-lucide-arrow-left"
- >
- Back to Chat
- </UButton>
+ <template #default>
+ <UNavigationMenu
+ :items="[navigation]"
+ orientation="vertical"
+ />
+ </template>
- <UDropdownMenu
- :items="[
- [{ type: 'label', label: user?.name || user?.username, avatar: { src: user?.avatar } }],
- [{ label: 'Log out', icon: 'i-lucide-log-out', onSelect: () => { clear(); navigateTo('/') } }]
- ]"
- >
- <UAvatar
- :src="user?.avatar"
- :alt="user?.name || user?.username"
- size="sm"
- class="cursor-pointer"
- />
- </UDropdownMenu>
- </div>
+ <template #footer>
+ <div class="text-xs text-muted px-2">
+ Admin Panel
</div>
- </div>
- </header>
+ </template>
+ </UDashboardSidebar>
- <main>
- <slot />
- </main>
- </div>
+ <slot />
+ </UDashboardGroup>
</template>
diff --git a/apps/chat/app/pages/admin.vue b/apps/chat/app/pages/admin.vue
new file mode 100644
index 0000000..4053d8b
--- /dev/null
+++ b/apps/chat/app/pages/admin.vue
@@ -0,0 +1,14 @@
+<script setup lang="ts">
+definePageMeta({
+ layout: 'admin',
+ middleware: 'admin',
+})
+</script>
+
+<template>
+ <UDashboardPanel id="admin-content">
+ <template #body>
+ <NuxtPage />
+ </template>
+ </UDashboardPanel>
+</template>
diff --git a/apps/chat/app/pages/admin/sources/index.vue b/apps/chat/app/pages/admin/index.vue
similarity index 55%
rename from apps/chat/app/pages/admin/sources/index.vue
rename to apps/chat/app/pages/admin/index.vue
index 455ab0b..c3f9836 100644
--- a/apps/chat/app/pages/admin/sources/index.vue
+++ b/apps/chat/app/pages/admin/index.vue
@@ -17,11 +17,6 @@ interface SerializedSource {
updatedAt: string
}
-definePageMeta({
- layout: 'admin',
- middleware: 'admin',
-})
-
const toast = useToast()
const overlay = useOverlay()
@@ -87,78 +82,77 @@ function handleSaved() {
refresh()
editingSource.value = null
}
+
+const hasSources = computed(() => (sources.value?.github?.count || 0) + (sources.value?.youtube?.count || 0) > 0)
</script>
<template>
- <UContainer class="py-10 max-w-xl">
- <header class="mb-10">
- <div class="flex items-center justify-between">
- <h1 class="text-lg font-semibold text-highlighted">
- Sources
- </h1>
- <div class="flex items-center gap-1.5">
- <UButton
- v-if="sources?.github?.count || sources?.youtube?.count"
- icon="i-lucide-refresh-cw"
- color="neutral"
- variant="ghost"
- size="xs"
- :loading="isSyncingAll"
- @click="triggerSync()"
- >
- Sync All
- </UButton>
- <UButton
- icon="i-lucide-plus"
- size="xs"
- to="/admin/sources/new"
- >
- Add
- </UButton>
- </div>
- </div>
- <p class="text-[13px] text-muted mt-1">
- Configure sources for documentation sync
+ <div class="px-6 lg:px-10 py-8 max-w-3xl">
+ <header class="mb-8">
+ <h1 class="text-lg font-medium text-highlighted mb-1">
+ Sources
+ </h1>
+ <p class="text-sm text-muted max-w-lg">
+ Sources are knowledge bases that give the AI context. Connect GitHub repositories for documentation or YouTube channels for video transcripts.
</p>
</header>
<div
- v-if="!sources?.github?.count && !sources?.youtube?.count"
- class="flex flex-col items-center py-16 border border-dashed border-default rounded-xl"
+ v-if="hasSources"
+ class="flex items-center gap-2 mb-6"
>
- <div class="size-10 rounded-lg bg-muted flex items-center justify-center mb-3">
- <UIcon name="i-lucide-layers" class="size-5 text-muted" />
+ <UButton
+ icon="i-lucide-refresh-cw"
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ :loading="isSyncingAll"
+ @click="triggerSync()"
+ >
+ Sync All
+ </UButton>
+ <UButton
+ icon="i-lucide-plus"
+ size="xs"
+ to="/admin/new"
+ >
+ Add Source
+ </UButton>
+ </div>
+
+ <div
+ v-if="!hasSources"
+ class="flex flex-col items-center py-16 border border-dashed border-default rounded-lg"
+ >
+ <div class="size-10 rounded-lg bg-elevated flex items-center justify-center mb-4">
+ <UIcon name="i-lucide-database" class="size-5 text-muted" aria-hidden="true" />
</div>
<p class="text-sm font-medium text-highlighted mb-1">
No sources yet
</p>
- <p class="text-[13px] text-muted mb-4">
- Add a source to get started
+ <p class="text-xs text-muted mb-4 text-center max-w-xs">
+ Add your first source to give the AI knowledge about your favorite tools
</p>
<UButton
icon="i-lucide-plus"
- size="sm"
- to="/admin/sources/new"
+ size="xs"
+ to="/admin/new"
>
- Add Source
+ Add your first source
</UButton>
</div>
<div v-else class="space-y-8">
<section>
- <header class="flex items-center gap-2 mb-2">
- <UIcon name="i-simple-icons-github" class="size-4 text-muted" />
- <h2 class="text-[13px] font-medium text-muted">
- GitHub
- </h2>
- <span class="text-[13px] text-muted/60">{{ sources?.github?.count || 0 }}</span>
- </header>
+ <p class="text-xs text-muted mb-3">
+ GitHub Repositories
+ </p>
<div
v-if="sources?.github?.count"
- class="rounded-lg border border-default bg-default divide-y divide-default"
+ class="rounded-lg border border-default divide-y divide-default overflow-hidden"
>
- <div v-for="source in sources.github.sources" :key="source.id" class="px-4">
+ <div v-for="source in sources.github.sources" :key="source.id" class="px-4 hover:bg-elevated/50 transition-colors">
<SourceCard
:source
@edit="editingSource = source"
@@ -169,28 +163,26 @@ function handleSaved() {
</div>
<UButton
v-else
+ color="neutral"
variant="ghost"
- class="w-full h-24 rounded-lg border border-dashed border-default hover:border-muted"
- to="/admin/sources/new"
+ class="w-full h-14 border border-dashed border-default hover:border-muted"
+ to="/admin/new"
+ icon="i-lucide-plus"
>
- <span class="text-[13px] text-muted">Add a repository</span>
+ Add a GitHub repository
</UButton>
</section>
<section>
- <header class="flex items-center gap-2 mb-2">
- <UIcon name="i-simple-icons-youtube" class="size-4 text-red-500" />
- <h2 class="text-[13px] font-medium text-muted">
- YouTube
- </h2>
- <span class="text-[13px] text-muted/60">{{ sources?.youtube?.count || 0 }}</span>
- </header>
+ <p class="text-xs text-muted mb-3">
+ YouTube Channels
+ </p>
<div
v-if="sources?.youtube?.count"
- class="rounded-lg border border-default bg-default divide-y divide-default"
+ class="rounded-lg border border-default divide-y divide-default overflow-hidden"
>
- <div v-for="source in sources.youtube.sources" :key="source.id" class="px-4">
+ <div v-for="source in sources.youtube.sources" :key="source.id" class="px-4 hover:bg-elevated/50 transition-colors">
<SourceCard
:source
@edit="editingSource = source"
@@ -201,20 +193,22 @@ function handleSaved() {
</div>
<UButton
v-else
+ color="neutral"
variant="ghost"
- class="w-full h-24 rounded-lg border border-dashed border-default hover:border-muted"
- to="/admin/sources/new"
+ class="w-full h-14 border border-dashed border-default hover:border-muted"
+ to="/admin/new"
+ icon="i-lucide-plus"
>
- <span class="text-[13px] text-muted">Add a channel</span>
+ Add a YouTube channel
</UButton>
</section>
</div>
- </UContainer>
-
- <SourceModal
- v-if="editingSource"
- :source="editingSource"
- @close="editingSource = null"
- @saved="handleSaved"
- />
+
+ <SourceModal
+ v-if="editingSource"
+ :source="editingSource"
+ @close="editingSource = null"
+ @saved="handleSaved"
+ />
+ </div>
</template>
diff --git a/apps/chat/app/pages/admin/sources/new.vue b/apps/chat/app/pages/admin/new.vue
similarity index 54%
rename from apps/chat/app/pages/admin/sources/new.vue
rename to apps/chat/app/pages/admin/new.vue
index 34d159f..714a0cc 100644
--- a/apps/chat/app/pages/admin/sources/new.vue
+++ b/apps/chat/app/pages/admin/new.vue
@@ -29,11 +29,6 @@ interface ExtractedSource {
const CONFIG_EXTENSIONS = ['.ts', '.js', '.json', '.yml', '.yaml', '.toml']
const CONFIG_ACCEPT = CONFIG_EXTENSIONS.join(',')
-definePageMeta({
- layout: 'admin',
- middleware: 'admin',
-})
-
const router = useRouter()
const toast = useToast()
@@ -152,7 +147,6 @@ async function extractAll() {
})
}
- // Clear pending files after extraction
pendingFiles.value.forEach(f => f.previewUrl && URL.revokeObjectURL(f.previewUrl))
pendingFiles.value = []
@@ -278,7 +272,7 @@ async function saveAll() {
title: `${created} source${created > 1 ? 's' : ''} created`,
icon: 'i-lucide-check',
})
- router.push('/admin/sources')
+ router.push('/admin')
} else {
toast.add({
title: 'Failed to create sources',
@@ -294,34 +288,29 @@ const typeOptions = [
]
const hasValidSources = computed(() => sources.value.some(s => s.data.label))
+const validSourcesCount = computed(() => sources.value.filter(s => s.data.label).length)
</script>
<template>
- <UContainer class="py-10 max-w-3xl">
+ <div class="px-6 lg:px-10 py-8 max-w-3xl">
<header class="mb-8">
- <div class="flex items-center gap-3 mb-1">
- <UButton
- icon="i-lucide-arrow-left"
- color="neutral"
- variant="ghost"
- size="xs"
- to="/admin/sources"
- />
- <h1 class="text-lg font-semibold text-highlighted">
- Add Sources
- </h1>
- </div>
- <p class="text-[13px] text-muted ml-9">
- Upload screenshots or config files to auto-extract sources
+ <h1 class="text-lg font-medium text-highlighted mb-1">
+ Add Sources
+ </h1>
+ <p class="text-sm text-muted">
+ Sources provide context to the AI. Add GitHub docs or YouTube channels to make the assistant knowledgeable about specific tools and frameworks.
</p>
</header>
- <div class="space-y-6">
- <!-- Drop Zone -->
+ <section class="mb-8">
+ <p class="text-xs text-muted mb-3">
+ Quick import
+ </p>
+
<div
- class="relative p-8 border-2 border-dashed rounded-xl transition-all cursor-pointer"
+ class="relative p-8 border border-dashed rounded-lg transition-colors cursor-pointer"
:class="[
- isDragging ? 'border-primary bg-primary/5 scale-[1.02]' : 'border-default hover:border-muted hover:bg-muted/5',
+ isDragging ? 'border-primary bg-primary/5' : 'border-default hover:border-muted hover:bg-elevated/30',
]"
@drop="handleDrop"
@dragover="handleDragOver"
@@ -338,212 +327,217 @@ const hasValidSources = computed(() => sources.value.some(s => s.data.label))
>
<div class="text-center">
- <div class="size-14 rounded-xl bg-muted/50 flex items-center justify-center mx-auto mb-4">
+ <div class="size-10 rounded-lg bg-elevated flex items-center justify-center mx-auto mb-3">
<UIcon
- :name="isDragging ? 'i-lucide-download' : 'i-lucide-files'"
- class="size-7 text-muted transition-transform"
- :class="{ 'scale-110': isDragging }"
+ :name="isDragging ? 'i-lucide-download' : 'i-lucide-upload'"
+ class="size-5 text-muted"
+ :class="{ 'text-primary': isDragging }"
+ aria-hidden="true"
/>
</div>
- <p class="text-sm font-medium text-highlighted mb-1">
- Drop files here
+ <p class="text-sm text-highlighted mb-1">
+ Drop files here or click to browse…
</p>
<p class="text-xs text-muted">
- Screenshots, .ts, .json, .yml, .yaml
+ Screenshots of configs, or .ts, .json, .yml files
</p>
</div>
</div>
+ </section>
- <!-- Pending Files -->
- <div v-if="pendingFiles.length > 0" class="space-y-3">
- <div class="flex items-center justify-between">
- <h2 class="text-sm font-medium text-highlighted">
- Files to extract ({{ pendingFiles.length }})
- </h2>
- <UButton
- icon="i-lucide-sparkles"
- size="xs"
- :loading="isExtracting"
- @click="extractAll"
- >
- Extract sources
- </UButton>
- </div>
+ <section v-if="pendingFiles.length > 0" class="mb-8">
+ <div class="flex items-center justify-between mb-3">
+ <p class="text-xs text-muted">
+ Files to extract
+ </p>
+ <UButton
+ icon="i-lucide-sparkles"
+ size="xs"
+ :loading="isExtracting"
+ @click="extractAll"
+ >
+ Extract
+ </UButton>
+ </div>
- <div class="flex flex-wrap gap-2">
+ <div class="flex flex-wrap gap-2">
+ <div
+ v-for="item in pendingFiles"
+ :key="item.id"
+ class="relative group"
+ >
<div
- v-for="item in pendingFiles"
- :key="item.id"
- class="relative group"
+ v-if="item.type === 'image'"
+ class="w-20 h-14 rounded-md border border-default overflow-hidden"
>
- <div
- v-if="item.type === 'image'"
- class="w-20 h-14 rounded-lg border border-default overflow-hidden"
+ <img
+ :src="item.previewUrl"
+ :alt="item.file.name"
+ class="w-full h-full object-cover"
>
- <img
- :src="item.previewUrl"
- :alt="item.file.name"
- class="w-full h-full object-cover"
- >
- </div>
- <div
- v-else
- class="w-20 h-14 rounded-lg border border-default bg-muted/30 flex flex-col items-center justify-center gap-1"
- >
- <UIcon :name="getFileIcon(item)" class="size-5 text-muted" />
- <span class="text-[10px] text-muted truncate max-w-16 px-1">{{ item.file.name }}</span>
- </div>
- <button
- class="absolute -top-1.5 -right-1.5 size-5 rounded-full bg-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity"
- @click.stop="removeFile(item.id)"
- >
- <UIcon name="i-lucide-x" class="size-3" />
- </button>
</div>
- </div>
- </div>
-
- <!-- Extracted Sources -->
- <div v-if="sources.length > 0" class="space-y-4">
- <div class="flex items-center justify-between">
- <h2 class="text-sm font-medium text-highlighted">
- Sources ({{ sources.length }})
- </h2>
- <UButton
- icon="i-lucide-plus"
- size="xs"
- color="neutral"
- variant="ghost"
- @click="addManualSource"
+ <div
+ v-else
+ class="w-20 h-14 rounded-md border border-default bg-elevated flex flex-col items-center justify-center gap-0.5"
+ >
+ <UIcon :name="getFileIcon(item)" class="size-4 text-muted" aria-hidden="true" />
+ <span class="text-[10px] text-muted truncate max-w-16 px-1">{{ item.file.name }}</span>
+ </div>
+ <button
+ class="absolute -top-1.5 -right-1.5 size-5 rounded-full bg-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity"
+ aria-label="Remove file"
+ @click.stop="removeFile(item.id)"
>
- Add manually
- </UButton>
+ <UIcon name="i-lucide-x" class="size-3" aria-hidden="true" />
+ </button>
</div>
+ </div>
+ </section>
- <div class="space-y-3">
- <div
- v-for="source in sources"
- :key="source.id"
- class="p-4 rounded-xl border border-default bg-default/50"
- >
- <div class="flex items-start gap-4 mb-3">
- <div class="flex-1 min-w-0">
- <div v-if="source.confidence < 1" class="text-xs text-muted mb-2">
- {{ Math.round(source.confidence * 100) }}% confidence
- </div>
-
- <div class="grid grid-cols-3 gap-3">
- <USelectMenu
- v-model="source.data.type"
- :items="typeOptions"
- value-key="value"
- size="sm"
- @update:model-value="source.data.basePath = $event === 'youtube' ? '/youtube' : '/docs'"
- />
- <div class="col-span-2">
- <UInput
- v-model="source.data.label"
- placeholder="Label (e.g. Nuxt)"
- size="sm"
- />
- </div>
- </div>
- </div>
+ <section v-if="sources.length > 0" class="mb-8">
+ <div class="flex items-center justify-between mb-3">
+ <p class="text-xs text-muted">
+ Sources
+ </p>
+ <button
+ class="text-xs text-muted hover:text-highlighted transition-colors flex items-center gap-1"
+ @click="addManualSource"
+ >
+ <UIcon name="i-lucide-plus" class="size-3" aria-hidden="true" />
+ Add manually
+ </button>
+ </div>
- <UButton
- icon="i-lucide-x"
- color="neutral"
- variant="ghost"
- size="xs"
- @click="removeSource(source.id)"
+ <div class="space-y-3">
+ <div
+ v-for="source in sources"
+ :key="source.id"
+ class="p-4 rounded-lg border border-default"
+ >
+ <div class="flex items-start justify-between gap-3 mb-3">
+ <div class="flex-1 grid grid-cols-3 gap-2">
+ <USelectMenu
+ v-model="source.data.type"
+ :items="typeOptions"
+ value-key="value"
+ size="sm"
+ @update:model-value="source.data.basePath = $event === 'youtube' ? '/youtube' : '/docs'"
/>
+ <div class="col-span-2">
+ <UInput
+ v-model="source.data.label"
+ placeholder="Label (e.g. Nuxt)"
+ size="sm"
+ autocomplete="off"
+ />
+ </div>
</div>
+ <button
+ class="text-muted hover:text-error transition-colors p-1"
+ aria-label="Delete source"
+ @click="removeSource(source.id)"
+ >
+ <UIcon name="i-lucide-trash-2" class="size-4" aria-hidden="true" />
+ </button>
+ </div>
- <div class="space-y-3">
- <template v-if="source.data.type === 'github'">
- <div class="grid grid-cols-3 gap-3">
- <UInput
- v-model="source.data.repo"
- placeholder="owner/repo"
- size="sm"
- icon="i-simple-icons-github"
- />
- <UInput
- v-model="source.data.branch"
- placeholder="main"
- size="sm"
- icon="i-lucide-git-branch"
- />
- <UInput
- v-model="source.data.contentPath"
- placeholder="docs/content"
- size="sm"
- icon="i-lucide-folder-open"
- />
- </div>
- </template>
-
- <template v-else>
- <div class="grid grid-cols-2 gap-3">
- <UInput
- v-model="source.data.channelId"
- placeholder="UCxxxx..."
- size="sm"
- icon="i-simple-icons-youtube"
- />
- <UInput
- v-model="source.data.handle"
- placeholder="@handle"
- size="sm"
- icon="i-lucide-at-sign"
- />
- </div>
- </template>
-
- <div class="flex items-center gap-2 text-xs text-muted">
- <UIcon name="i-lucide-package" class="size-3.5" />
- <span>Snapshot:</span>
- <code class="text-highlighted font-mono">{{ getSnapshotPreview(source) }}</code>
+ <div class="space-y-2">
+ <template v-if="source.data.type === 'github'">
+ <div class="grid grid-cols-3 gap-2">
+ <UInput
+ v-model="source.data.repo"
+ placeholder="owner/repo"
+ size="sm"
+ icon="i-simple-icons-github"
+ autocomplete="off"
+ />
+ <UInput
+ v-model="source.data.branch"
+ placeholder="main"
+ size="sm"
+ icon="i-lucide-git-branch"
+ autocomplete="off"
+ />
+ <UInput
+ v-model="source.data.contentPath"
+ placeholder="docs/content"
+ size="sm"
+ icon="i-lucide-folder-open"
+ autocomplete="off"
+ />
+ </div>
+ </template>
+
+ <template v-else>
+ <div class="grid grid-cols-2 gap-2">
+ <UInput
+ v-model="source.data.channelId"
+ placeholder="UCxxxx…"
+ size="sm"
+ icon="i-simple-icons-youtube"
+ autocomplete="off"
+ />
+ <UInput
+ v-model="source.data.handle"
+ placeholder="@handle"
+ size="sm"
+ icon="i-lucide-at-sign"
+ autocomplete="off"
+ />
</div>
+ </template>
+
+ <div class="flex items-center gap-1.5 text-xs text-muted pt-1">
+ <UIcon name="i-lucide-folder-output" class="size-3" aria-hidden="true" />
+ <span>Output:</span>
+ <code class="text-highlighted font-mono text-[11px]">{{ getSnapshotPreview(source) }}</code>
</div>
</div>
</div>
</div>
-
- <!-- Empty state -->
- <div
- v-if="sources.length === 0 && pendingFiles.length === 0"
- class="text-center py-8"
+ </section>
+
+ <div
+ v-if="sources.length === 0 && pendingFiles.length === 0"
+ class="text-center py-10"
+ >
+ <p class="text-sm text-muted mb-1">
+ No files uploaded yet
+ </p>
+ <p class="text-xs text-muted mb-4">
+ Or skip the import and configure sources manually
+ </p>
+ <UButton
+ icon="i-lucide-plus"
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ @click="addManualSource"
>
- <p class="text-sm text-muted mb-3">
- No sources yet
- </p>
- <UButton
- icon="i-lucide-plus"
- size="sm"
- color="neutral"
- variant="outline"
- @click="addManualSource"
- >
- Add manually
- </UButton>
- </div>
+ Add manually
+ </UButton>
+ </div>
- <!-- Actions -->
- <div class="flex justify-end gap-3 pt-4 border-t border-default">
- <UButton
- color="neutral"
- variant="ghost"
- label="Cancel"
- to="/admin/sources"
- />
- <UButton
- :label="`Create ${sources.filter(s => s.data.label).length} Source${sources.filter(s => s.data.label).length !== 1 ? 's' : ''}`"
- :loading="isSubmitting"
- :disabled="!hasValidSources || isExtracting"
- @click="saveAll"
- />
- </div>
+ <div
+ v-if="sources.length > 0"
+ class="flex items-center justify-end gap-2 pt-4 border-t border-default"
+ >
+ <UButton
+ color="neutral"
+ variant="ghost"
+ size="sm"
+ to="/admin"
+ >
+ Cancel
+ </UButton>
+ <UButton
+ size="sm"
+ :disabled="!hasValidSources || isExtracting"
+ :loading="isSubmitting"
+ @click="saveAll"
+ >
+ Create {{ validSourcesCount }}
+ </UButton>
</div>
- </UContainer>
+ </div>
</template>
diff --git a/apps/chat/package.json b/apps/chat/package.json
index d0a2e5b..bb865be 100644
--- a/apps/chat/package.json
+++ b/apps/chat/package.json
@@ -34,7 +34,7 @@
"ai": "^6.0.49",
"date-fns": "^4.1.0",
"drizzle-orm": "^0.45.1",
- "evlog": "^1.0.0",
+ "evlog": "^1.0.1",
"giget": "^3.1.1",
"nuxt": "^4.3.0",
"nuxt-auth-utils": "^0.5.27",
diff --git a/apps/chat/server/routes/auth/github.get.ts b/apps/chat/server/routes/auth/github.get.ts
index 6a9c25e..48bc543 100644
--- a/apps/chat/server/routes/auth/github.get.ts
+++ b/apps/chat/server/routes/auth/github.get.ts
@@ -36,7 +36,7 @@ export default defineOAuthGitHubEventHandler({
existingUser.role = newRole
}
- await setUserSession(event, { user: existingUser })
+ await setUserSession(event, { user: { ...existingUser, provider: 'github' as const } })
} else {
const role = isAdminUser(ghUser.email || '', ghUser.login) ? 'admin' : 'user'
const [newUser] = await db.insert(schema.users).values({
@@ -49,6 +49,10 @@ export default defineOAuthGitHubEventHandler({
role,
}).returning()
+ if (!newUser) {
+ throw createError({ statusCode: 500, message: 'Failed to create user' })
+ }
+
// Migrate anonymous chats to new user
if (session.user?.id) {
await db.update(schema.chats)
@@ -56,7 +60,7 @@ export default defineOAuthGitHubEventHandler({
.where(eq(schema.chats.userId, session.user.id))
}
- await setUserSession(event, { user: newUser })
+ await setUserSession(event, { user: { ...newUser, provider: 'github' as const } })
}
return sendRedirect(event, '/')
diff --git a/bun.lock b/bun.lock
index bf0a1a4..b411c19 100644
--- a/bun.lock
+++ b/bun.lock
@@ -28,7 +28,7 @@
"ai": "^6.0.49",
"date-fns": "^4.1.0",
"drizzle-orm": "^0.45.1",
- "evlog": "^1.0.0",
+ "evlog": "^1.0.1",
"giget": "^3.1.1",
"nuxt": "^4.3.0",
"nuxt-auth-utils": "^0.5.27",
@@ -1646,7 +1646,7 @@
"eventsource-parser": ["[email protected]", "", {}, "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg=="],
- "evlog": ["[email protected]", "", { "dependencies": { "@nuxt/kit": "^4.3.0" }, "peerDependencies": { "h3": "^1.13.0", "nitropack": "^2.13.1", "ofetch": "^1.5.1" }, "optionalPeers": ["h3", "nitropack", "ofetch"] }, "sha512-VK7ayLR9cJZEuhGY4hieN+DD9tgUDWWGNJ4kmQTipa4il5GKfNnIk+vlay0lunfGoKK4mpRXT8vBTbbZDe8HxQ=="],
+ "evlog": ["[email protected]", "", { "dependencies": { "@nuxt/kit": "^4.3.0" }, "peerDependencies": { "h3": "^1.15.5", "nitropack": "^2.13.1", "ofetch": "^1.5.1" }, "optionalPeers": ["h3", "nitropack", "ofetch"] }, "sha512-c/9aMlZdKFRADRsmJ06T55fdzjDse+sQRPEx4Q17wt4+n9Jr5Mh0UE7sB9aa09o/IwPzA1Ja0LrHcVRncdRBPQ=="],
"execa": ["[email protected]", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA=="],
@@ -3130,6 +3130,8 @@
"@poppinss/dumper/supports-color": ["[email protected]", "", {}, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="],
+ "@savoir/sdk/evlog": ["[email protected]", "", { "dependencies": { "@nuxt/kit": "^4.3.0" }, "peerDependencies": { "h3": "^1.13.0", "nitropack": "^2.13.1", "ofetch": "^1.5.1" }, "optionalPeers": ["h3", "nitropack", "ofetch"] }, "sha512-VK7ayLR9cJZEuhGY4hieN+DD9tgUDWWGNJ4kmQTipa4il5GKfNnIk+vlay0lunfGoKK4mpRXT8vBTbbZDe8HxQ=="],
+
"@smithy/abort-controller/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-9YcuJVTOBDjg9LWo23Qp0lTQ3D7fQsQtwle0jVfpbUHy9qBwCEgKuVH4FqFB3VYu0nwdHKiEMA+oXz7oV8X1kw=="],
"@smithy/config-resolver/@smithy/types": ["@smithy/[email protected]", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-9YcuJVTOBDjg9LWo23Qp0lTQ3D7fQsQtwle0jVfpbUHy9qBwCEgKuVH4FqFB3VYu0nwdHKiEMA+oXz7oV8X1kw=="],