Skip to content

Commit

Permalink
feat: some ui nits and setup fixes (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
anbraten authored Jun 12, 2024
1 parent 7915b30 commit 1832c03
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 592 deletions.
Binary file removed assets/loading.gif
Binary file not shown.
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
schema: ['./server/schemas/*.ts'],
out: './server/db/migrations',
dbCredentials: {
url: 'data/code_captain.db',
url: '.data/code_captain.db',
},
driver: 'better-sqlite',
} satisfies Config;
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default defineNuxtConfig({
head: {
title: 'CodeCaptain.ai',
link: [
{ rel: 'alternate icon', type: 'image/png', href: '/logo.png' },
{ rel: 'icon', type: 'image/png', href: '/logo.png' },
{ rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' },
],
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@nuxt/ui": "^2.14.2",
"@nuxtjs/tailwindcss": "^6.11.4",
"@types/better-sqlite3": "^7.6.9",
"@types/canvas-confetti": "^1.6.4",
"@types/jsonwebtoken": "^9.0.6",
"@types/markdown-it": "^13.0.7",
"@types/node": "^20.11.30",
Expand All @@ -41,6 +42,7 @@
"@langchain/openai": "^0.0.33",
"@langchain/weaviate": "^0.0.4",
"better-sqlite3": "^9.4.3",
"canvas-confetti": "^1.9.3",
"consola": "^3.2.3",
"drizzle-orm": "^0.30.4",
"glob": "^10.3.10",
Expand Down
21 changes: 11 additions & 10 deletions pages/repos/[repo_id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
</div>

<div v-if="indexing" class="mx-auto flex flex-col items-center gap-4 pt-8 w-full">
<span class="text-2xl">Whoho lets go and do some indexing.</span>
<img src="~/assets/loading.gif" alt="loading" />
<span class="text-2xl">Ahoy! Captain Code is charting the course through your repository 🚢</span>
<div
v-if="indexingLog"
class="flex flex-col w-full min-h-0 overflow-auto rounded p-2 ring-1 ring-stone-200 dark:ring-neutral-800"
Expand All @@ -34,14 +33,8 @@
</div>

<div v-else-if="!repo.lastFetch" class="flex flex-col m-auto gap-4">
<p class="text-2xl mx-auto">Should we start indexing your repository?</p>
<UButton
class="mx-auto"
icon="i-ion-cloud-download-outline"
label="Index repository"
variant="outline"
@click="reIndex"
/>
<p class="text-2xl mx-auto">Should I start searching for some hidden treasures here? 🏝️</p>
<UButton class="mx-auto" icon="i-ion-ios-search" label="Index repository" variant="outline" @click="reIndex" />
</div>

<div v-else>
Expand Down Expand Up @@ -72,6 +65,8 @@
</template>

<script lang="ts" setup>
import confetti from 'canvas-confetti';
const { refresh: refreshRepos } = await useRepositoriesStore();
const { chats, refresh: refreshChats } = await useChatsStore();
Expand Down Expand Up @@ -108,6 +103,12 @@ async function reIndex() {
indexingLog.value.push(text);
}
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.6 },
});
toast.add({
title: 'Success',
description: 'Repo synced successfully',
Expand Down
869 changes: 291 additions & 578 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions server/forges/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export class Github implements Forge {
return parseInt(match[1]);
}

public getOauthRedirectUrl({ state }: { state: string }): string {
public getOauthRedirectUrl({ state, redirectUri }: { state: string; redirectUri: string }): string {
const scopes = ['read:user', 'user:email', 'repo'];
return `https://github.com/login/oauth/authorize?client_id=${
this.clientId
}&scope=public_repo&state=${state}&scope=${scopes.join('%20')}`;
}&scope=public_repo&state=${state}&scope=${scopes.join('%20')}&redirect_uri=${redirectUri}`;
}

public async getUserInfo(accessToken: string): Promise<ForgeUser> {
Expand Down

0 comments on commit 1832c03

Please sign in to comment.