Skip to content

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

up

Hugo Richard7cb625eb54e3
diff --git a/apps/chat/app/components/SourceCard.vue b/apps/chat/app/components/SourceCard.vue
index e65c3bf..bd66fe6 100644
--- a/apps/chat/app/components/SourceCard.vue
+++ b/apps/chat/app/components/SourceCard.vue
@@ -33,120 +33,114 @@ function handleSync() {
}, 2000)
}
-const hasBadges = computed(() => {
- if (props.source.type === 'github') {
- return props.source.branch || props.source.contentPath || props.source.outputPath || props.source.readmeOnly
+const sourceUrl = computed(() => {
+ if (props.source.type === 'github' && props.source.repo) {
+ return `https://github.com/${props.source.repo}`
}
- return props.source.maxVideos
+ if (props.source.type === 'youtube') {
+ if (props.source.handle) return `https://youtube.com/${props.source.handle}`
+ if (props.source.channelId) return `https://youtube.com/channel/${props.source.channelId}`
+ }
+ return null
+})
+
+const sourceIdentifier = computed(() => {
+ if (props.source.type === 'github') return props.source.repo
+ return props.source.handle || props.source.channelId
})
</script>
<template>
- <div class="group relative rounded-xl border border-default bg-default/50 hover:bg-elevated/50 transition-all duration-200 hover:shadow-sm">
- <div class="p-4">
- <div class="flex items-start justify-between gap-4">
- <div class="flex items-start gap-3 min-w-0">
- <div
- class="flex items-center justify-center size-9 rounded-lg shrink-0 transition-colors"
- :class="source.type === 'github'
- ? 'bg-neutral-100 dark:bg-neutral-800/80'
- : 'bg-red-50 dark:bg-red-950/50'"
+ <div class="py-3.5 first:pt-3 last:pb-3">
+ <div class="flex items-start justify-between gap-4">
+ <div class="min-w-0">
+ <div class="flex items-baseline gap-2">
+ <h3 class="font-medium text-[15px] text-highlighted leading-tight">{{ source.label }}</h3>
+ <span class="text-muted/50">·</span>
+ <a
+ v-if="sourceUrl"
+ :href="sourceUrl"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="text-[13px] text-muted hover:text-highlighted transition-colors truncate"
>
- <UIcon
- :name="source.type === 'github' ? 'i-simple-icons-github' : 'i-simple-icons-youtube'"
- class="size-4"
- :class="source.type === 'youtube' ? 'text-red-500' : 'text-neutral-700 dark:text-neutral-300'"
- />
- </div>
-
- <div class="min-w-0 pt-0.5">
- <h3 class="font-medium text-highlighted leading-tight">{{ source.label }}</h3>
- <p class="text-sm text-muted mt-0.5 truncate">
- <template v-if="source.type === 'github'">
- {{ source.repo }}
- </template>
- <template v-else>
- {{ source.handle || source.channelId }}
- </template>
- </p>
- </div>
+ {{ sourceIdentifier }}
+ </a>
+ <span v-else class="text-[13px] text-muted truncate">
+ {{ sourceIdentifier }}
+ </span>
</div>
- <div class="flex items-center gap-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity">
- <UTooltip text="Sync now" :delay-open="300">
- <UButton
- size="xs"
- variant="ghost"
- color="neutral"
- icon="i-lucide-refresh-cw"
- :loading="isSyncing"
- class="rounded-lg"
- @click="handleSync"
- />
- </UTooltip>
- <UTooltip text="Edit" :delay-open="300">
- <UButton
- size="xs"
- variant="ghost"
- color="neutral"
- icon="i-lucide-pencil"
- class="rounded-lg"
- @click="emit('edit')"
- />
- </UTooltip>
- <UTooltip text="Delete" :delay-open="300">
- <UButton
- size="xs"
- variant="ghost"
- color="error"
- icon="i-lucide-trash-2"
- class="rounded-lg"
- @click="emit('delete')"
- />
- </UTooltip>
+ <div class="flex flex-wrap items-center gap-1.5 mt-2">
+ <template v-if="source.type === 'github'">
+ <div
+ v-if="source.branch"
+ class="inline-flex items-center gap-1 h-[22px] px-2 rounded-md text-[11px] font-medium text-muted bg-muted"
+ >
+ <UIcon name="i-lucide-git-branch" class="size-3 opacity-60" />
+ {{ source.branch }}
+ </div>
+ <div
+ v-if="source.contentPath"
+ class="inline-flex items-center gap-1 h-[22px] px-2 rounded-md text-[11px] font-medium text-muted bg-muted"
+ >
+ <UIcon name="i-lucide-folder" class="size-3 opacity-60" />
+ {{ source.contentPath }}
+ </div>
+ <UTooltip v-if="source.outputPath" text="Output folder in snapshot" :delay-open="200">
+ <div class="inline-flex items-center gap-1 h-[22px] px-2 rounded-md text-[11px] font-medium text-muted bg-muted">
+ <UIcon name="i-lucide-folder-output" class="size-3 opacity-60" />
+ {{ source.outputPath }}
+ </div>
+ </UTooltip>
+ <div
+ v-if="source.readmeOnly"
+ class="inline-flex items-center h-[22px] px-2 rounded-md text-[11px] font-medium text-warning bg-warning/10"
+ >
+ README only
+ </div>
+ </template>
+ <template v-else>
+ <div
+ v-if="source.maxVideos"
+ class="inline-flex items-center gap-1 h-[22px] px-2 rounded-md text-[11px] font-medium text-muted bg-muted"
+ >
+ <UIcon name="i-lucide-video" class="size-3 opacity-60" />
+ {{ source.maxVideos }} videos max
+ </div>
+ </template>
</div>
</div>
- <div v-if="hasBadges" class="flex flex-wrap items-center gap-1.5 mt-3 pl-12">
- <template v-if="source.type === 'github'">
- <span
- v-if="source.branch"
- class="inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs bg-neutral-100 dark:bg-neutral-800/80 text-muted"
- >
- <UIcon name="i-lucide-git-branch" class="size-3" />
- {{ source.branch }}
- </span>
- <span
- v-if="source.contentPath"
- class="inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs bg-neutral-100 dark:bg-neutral-800/80 text-muted"
- >
- <UIcon name="i-lucide-folder" class="size-3" />
- {{ source.contentPath }}
- </span>
- <span
- v-if="source.outputPath"
- class="inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300"
- >
- <UIcon name="i-lucide-arrow-right" class="size-3" />
- {{ source.outputPath }}
- </span>
- <span
- v-if="source.readmeOnly"
- class="inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300"
- >
- <UIcon name="i-lucide-file-text" class="size-3" />
- README only
- </span>
- </template>
- <template v-else>
- <span
- v-if="source.maxVideos"
- class="inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs bg-neutral-100 dark:bg-neutral-800/80 text-muted"
- >
- <UIcon name="i-lucide-video" class="size-3" />
- Max {{ source.maxVideos }} videos
- </span>
- </template>
+ <div class="flex items-center shrink-0 -mr-1">
+ <UTooltip text="Sync now" :delay-open="300" :ui="{ content: 'px-2 py-1 text-xs' }">
+ <UButton
+ icon="i-lucide-refresh-cw"
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ :loading="isSyncing"
+ @click="handleSync"
+ />
+ </UTooltip>
+ <UTooltip text="Edit" :delay-open="300" :ui="{ content: 'px-2 py-1 text-xs' }">
+ <UButton
+ icon="i-lucide-pencil"
+ color="neutral"
+ variant="ghost"
+ size="xs"
+ @click="emit('edit')"
+ />
+ </UTooltip>
+ <UTooltip text="Delete" :delay-open="300" :ui="{ content: 'px-2 py-1 text-xs' }">
+ <UButton
+ icon="i-lucide-trash-2"
+ color="error"
+ variant="ghost"
+ size="xs"
+ @click="emit('delete')"
+ />
+ </UTooltip>
</div>
</div>
</div>
diff --git a/apps/chat/app/components/SourceModal.vue b/apps/chat/app/components/SourceModal.vue
index f9a428d..8491eff 100644
--- a/apps/chat/app/components/SourceModal.vue
+++ b/apps/chat/app/components/SourceModal.vue
@@ -161,7 +161,7 @@ async function save() {
<p class="text-xs text-muted">Path to the documentation folder</p>
</div>
- <div class="flex items-center justify-between py-2 px-3 rounded-lg bg-neutral-50 dark:bg-neutral-900/50">
+ <div class="flex items-center justify-between py-2 px-3 rounded-lg bg-muted">
<div>
<p class="text-sm font-medium text-highlighted">README Only</p>
<p class="text-xs text-muted">Only sync the README.md file</p>
diff --git a/apps/chat/app/pages/admin/sources.vue b/apps/chat/app/pages/admin/sources.vue
index 6c5668c..a851f80 100644
--- a/apps/chat/app/pages/admin/sources.vue
+++ b/apps/chat/app/pages/admin/sources.vue
@@ -99,44 +99,50 @@ function handleSaved() {
</template>
<template #body>
- <UContainer class="py-10 max-w-3xl">
- <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-10">
- <div>
- <h1 class="text-2xl font-semibold text-highlighted tracking-tight">Sources</h1>
- <p class="text-muted text-sm mt-1">Manage your content sources for documentation sync</p>
- </div>
- <div class="flex gap-2">
- <UButton
- icon="i-lucide-refresh-cw"
- color="neutral"
- variant="outline"
- size="sm"
- :loading="isSyncingAll"
- :disabled="!sources?.github?.length && !sources?.youtube?.length"
- @click="triggerSync()"
- >
- Sync All
- </UButton>
- <UButton
- icon="i-lucide-plus"
- size="sm"
- @click="showAddModal = true"
- >
- Add Source
- </UButton>
+ <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?.length || sources?.youtube?.length"
+ 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"
+ @click="showAddModal = true"
+ >
+ Add
+ </UButton>
+ </div>
</div>
- </div>
+ <p class="text-[13px] text-muted mt-1">
+ Configure sources for documentation sync
+ </p>
+ </header>
<div
v-if="!sources?.github?.length && !sources?.youtube?.length"
- class="flex flex-col items-center justify-center py-16 px-4"
+ class="flex flex-col items-center py-16 border border-dashed border-default rounded-xl"
>
- <div class="flex items-center justify-center size-12 rounded-xl bg-neutral-100 dark:bg-neutral-800/80 mb-4">
- <UIcon name="i-lucide-database" class="size-6 text-muted" />
+ <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" />
</div>
- <h3 class="text-base font-medium text-highlighted mb-1">No sources configured</h3>
- <p class="text-sm text-muted text-center max-w-sm mb-6">
- Add your first source to start syncing documentation from GitHub repositories or YouTube channels.
+ <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>
<UButton
icon="i-lucide-plus"
@@ -147,71 +153,71 @@ function handleSaved() {
</UButton>
</div>
- <template v-else>
- <section class="mb-8">
- <div class="flex items-center justify-between mb-3">
- <div class="flex items-center gap-2">
- <UIcon name="i-simple-icons-github" class="size-4 text-muted" />
- <h2 class="text-sm font-medium text-highlighted">GitHub Repositories</h2>
- <span class="text-xs text-muted bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 rounded">
- {{ sources?.github?.length || 0 }}
- </span>
+ <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?.length || 0 }}</span>
+ </header>
+
+ <div
+ v-if="sources?.github?.length"
+ class="rounded-lg border border-default bg-default divide-y divide-default"
+ >
+ <div v-for="source in sources.github" :key="source.id" class="px-4">
+ <SourceCard
+ :source
+ @edit="editingSource = source"
+ @delete="deleteSource(source)"
+ @sync="triggerSync(source.id)"
+ />
</div>
</div>
-
- <div v-if="sources?.github?.length" class="space-y-2">
- <SourceCard
- v-for="source in sources.github"
- :key="source.id"
- :source
- @edit="editingSource = source"
- @delete="deleteSource(source)"
- @sync="triggerSync(source.id)"
- />
- </div>
- <button
+ <UButton
v-else
- class="w-full border border-dashed border-default hover:border-muted rounded-xl p-8 text-center transition-colors group"
+ variant="ghost"
+ class="w-full h-24 rounded-lg border border-dashed border-default hover:border-muted"
@click="showAddModal = true"
>
- <p class="text-sm text-muted group-hover:text-highlighted transition-colors">
- Add a GitHub repository
- </p>
- </button>
+ <span class="text-[13px] text-muted">Add a repository</span>
+ </UButton>
</section>
<section>
- <div class="flex items-center justify-between mb-3">
- <div class="flex items-center gap-2">
- <UIcon name="i-simple-icons-youtube" class="size-4 text-red-500" />
- <h2 class="text-sm font-medium text-highlighted">YouTube Channels</h2>
- <span class="text-xs text-muted bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 rounded">
- {{ sources?.youtube?.length || 0 }}
- </span>
+ <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?.length || 0 }}</span>
+ </header>
+
+ <div
+ v-if="sources?.youtube?.length"
+ class="rounded-lg border border-default bg-default divide-y divide-default"
+ >
+ <div v-for="source in sources.youtube" :key="source.id" class="px-4">
+ <SourceCard
+ :source
+ @edit="editingSource = source"
+ @delete="deleteSource(source)"
+ @sync="triggerSync(source.id)"
+ />
</div>
</div>
-
- <div v-if="sources?.youtube?.length" class="space-y-2">
- <SourceCard
- v-for="source in sources.youtube"
- :key="source.id"
- :source
- @edit="editingSource = source"
- @delete="deleteSource(source)"
- @sync="triggerSync(source.id)"
- />
- </div>
- <button
+ <UButton
v-else
- class="w-full border border-dashed border-default hover:border-muted rounded-xl p-8 text-center transition-colors group"
+ variant="ghost"
+ class="w-full h-24 rounded-lg border border-dashed border-default hover:border-muted"
@click="showAddModal = true"
>
- <p class="text-sm text-muted group-hover:text-highlighted transition-colors">
- Add a YouTube channel
- </p>
- </button>
+ <span class="text-[13px] text-muted">Add a channel</span>
+ </UButton>
</section>
- </template>
+ </div>
</UContainer>
<SourceModal