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

Bump vitest from 0.32.2 to 1.2.1 #119

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ OPENAI_API_KEY=
NODE_ENV=development
DEPLOYMENT_ENV=production
PUBLIC_SENTRY_DSN=
PUBLIC_SENTRY_ENV=
SENTRY_AUTH_TOKEN=
SENTRY_ORG=prototyp-vm
SENTRY_PROJECT=taco
PUBLIC_SITE_NAME=TACO
PUBLIC_SITE_URL=http://localhost:5173
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
time: "04:00"
open-pull-requests-limit: 10
target-branch: "dev"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
time: "04:00"
open-pull-requests-limit: 10
target-branch: "dev"
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
EMAIL_SENDER_SIGNATURE: '[email protected]'
PUBLIC_SENTRY_DSN: 'SECRET'
PUBLIC_SENTRY_ENV: 'test'
PUBLIC_SITE_URL: 'http://localhost:5173/'
2,117 changes: 1,645 additions & 472 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"ts-node": "^10.9.1",
"tslib": "^2.4.1",
"typescript": "^5.1.6",
"vite": "^4.3.0",
"vitest": "^0.32.2",
"vite": "^4.5.2",
"vitest": "^1.2.1",
"zod": "^3.21.4"
},
"prisma": {
Expand Down
34 changes: 19 additions & 15 deletions src/lib/components/ChatLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import { page } from '$app/stores'
import AvatarGroup from '$lib/components/AvatarGroup.svelte'
import DeleteChatModal from '$lib/components/DeleteChatModal.svelte'
import ForkIcon from '$lib/components/icons/ForkIcon.svelte'
import ModalConfirm from '$lib/components/ModalConfirm.svelte'
import ShareChatModal from '$lib/components/ShareChatModal.svelte'
import type { UserWithUserTeamsActiveTeamAndChats } from '$lib/server/entities/user'
import { isSidebarOpen } from '$lib/stores/general'
import { getTimeSince } from '$lib/utils/timeConverter'
import { ChatBubbleLeftIcon, UserGroupIcon } from '@babeard/svelte-heroicons/solid'
import {
Square2StackIcon,
ChatBubbleLeftIcon,
UserGroupIcon,
} from '@babeard/svelte-heroicons/solid'

export let chat: UserWithUserTeamsActiveTeamAndChats['sharedChats'][number]['chat']
const name = chat.name || 'New Chat'
Expand All @@ -19,8 +22,8 @@
$: href = `/app/chats/${chat.id}`
$: isLinkActive = $page.url.href.endsWith(`/app/chats/${chat.id}`)

let forkForm: HTMLFormElement
let forkInput: HTMLInputElement
let cloneForm: HTMLFormElement
let cloneInput: HTMLInputElement
</script>

<a href={isLinkActive ? null : href} title={name} on:click={() => isSidebarOpen.set(false)}>
Expand All @@ -37,6 +40,7 @@
<ChatBubbleLeftIcon class="h-6 w-6 text-white flex-shrink-0" />
{/if}
<h3 class="flex-auto truncate text-sm font-semibold leading-6 text-white">{name}</h3>

<time datetime={chat.updatedAt.toISOString()} class="flex-none text-xs text-gray-600"
>{updatedAtShorthand}</time
>
Expand All @@ -51,40 +55,40 @@
{chat.roleContent}
</p>
<ShareChatModal {user} {chat} />
<ModalConfirm initialFocus={forkInput} on:confirm={() => forkForm.requestSubmit()}>
<button class="block" type="button" title="Fork it" slot="trigger">
<ForkIcon class="h-5 w-5 text-gray-500 hover:text-green-500 duration-200" />
<ModalConfirm initialFocus={cloneInput} on:confirm={() => cloneForm.requestSubmit()}>
<button class="block" type="button" title="Clone" slot="trigger">
<Square2StackIcon class="h-5 w-5 text-gray-500 hover:text-green-500 duration-200" />
</button>
<svelte:fragment slot="title">Do you want to fork the chat?</svelte:fragment>
<svelte:fragment slot="title">Do you want to clone the chat?</svelte:fragment>
<svelte:fragment slot="body">
<form
method="post"
action="/app/chats/{chat.id}?/forkChat"
bind:this={forkForm}
action="/app/chats/{chat.id}?/cloneChat"
bind:this={cloneForm}
use:enhance
class="w-full"
>
<div class="mt-2 max-w-xl text-sm text-gray-500">
<p>Choose a name for the new forked chat.</p>
<p>Choose a name for the new cloned chat.</p>
</div>
<div class="mt-5 sm:flex sm:items-center">
<div class="w-full sm:max-w-xl flex">
<label class="sr-only" for="newName">New Name</label>
<input
bind:this={forkInput}
bind:this={cloneInput}
type="text"
name="newName"
id="newName"
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
placeholder="A new name for the forked chat."
value={`Forked: ${name}`}
placeholder="A new name for the cloned chat."
value={`Cloned: ${name}`}
/>
</div>
</div>
<input type="hidden" name="chatId" value={chat.id} />
</form>
</svelte:fragment>
<svelte:fragment slot="confirm">Fork</svelte:fragment>
<svelte:fragment slot="confirm">Clone</svelte:fragment>
</ModalConfirm>
<DeleteChatModal {chat} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/entities/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const deleteChat = (id: number) => {
})
}

export const forkChat = async (
export const cloneChat = async (
chatId: number,
userId: number,
activeUserTeamId: number,
Expand Down
14 changes: 12 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<script lang="ts">
import TacoIcon from '$lib/components/icons/TacoIcon.svelte'
import { KeyIcon, CpuChipIcon, ChatBubbleLeftRightIcon } from '@babeard/svelte-heroicons/solid'
import {
KeyIcon,
CpuChipIcon,
ChatBubbleLeftRightIcon,
ShieldCheckIcon,
} from '@babeard/svelte-heroicons/solid'
import type { PageData } from './$types'

export let data: PageData
Expand All @@ -21,6 +26,11 @@
description: 'With Taco, your whole team shares a single Open Al account.',
icon: KeyIcon,
},
{
name: 'No training on your data',
description: "OpenAI won't use the information you provide to improve its models.",
icon: ShieldCheckIcon,
},
]

let isLoggedIn: boolean = data.isLoggedIn
Expand All @@ -46,7 +56,7 @@
</p>
</div>
<div class="mx-auto mt-16 px-8 max-w-2xl sm:mt-20 lg:mt-24 lg:max-w-none">
<dl class="grid max-w-xl grid-cols-1 gap-x-8 gap-y-16 lg:max-w-none lg:grid-cols-3">
<dl class="grid max-w-xl grid-cols-1 gap-x-8 gap-y-16 lg:max-w-none lg:grid-cols-4">
{#each features as feature}
<div class="flex flex-col">
<dt class="flex items-center gap-x-3 text-base font-semibold leading-7 text-white">
Expand Down
8 changes: 3 additions & 5 deletions src/routes/app/chats/[chatId]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forkChat, getChatWithRelationsById } from '$lib/server/entities/chat'
import { cloneChat, getChatWithRelationsById } from '$lib/server/entities/chat'
import { type Actions, fail, redirect } from '@sveltejs/kit'
import { z } from 'zod'
import type { PageServerLoad } from './$types'
Expand All @@ -7,7 +7,6 @@ import { getAvailableModels } from '$lib/server/api/openai'
export const load: PageServerLoad = async ({ params, locals: { currentUser } }) => {
const chatId = Number(params.chatId)


if (!currentUser.activeUserTeam?.team) {
throw redirect(303, '/app/settings/teams')
}
Expand All @@ -23,7 +22,7 @@ export const load: PageServerLoad = async ({ params, locals: { currentUser } })
}

export const actions: Actions = {
forkChat: async ({ locals: { currentUser }, request }) => {
cloneChat: async ({ locals: { currentUser }, request }) => {
const fields = Object.fromEntries(await request.formData())

const schema = z
Expand All @@ -40,7 +39,7 @@ export const actions: Actions = {
}

if (schema.success) {
const newChat = await forkChat(
const newChat = await cloneChat(
schema.data.chatId,
currentUser.id,
currentUser.activeUserTeamId,
Expand All @@ -65,4 +64,3 @@ export const actions: Actions = {
function getModels(): any {
throw new Error('Function not implemented.')
}

7 changes: 5 additions & 2 deletions src/routes/app/settings/teams/new/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<div>
<h2 class="text-base font-semibold leading-7 text-white">Create a new Team</h2>
<p class="mt-1 text-sm leading-6 text-gray-400">
You can also specify the api key later in the settings.
You need an OpenAI API key to create a team. You can get one at <a
href="https://platform.openai.com"
target="_blank">https://platform.openai.com</a
>
</p>
</div>

Expand Down Expand Up @@ -39,7 +42,7 @@
<Input
value={form?.fields?.openAiApiKey}
errors={form?.errors?.openAiApiKey}
label="OpenAI API Key"
label="OpenAI API Key*"
id="openAiApiKey"
name="openAiApiKey"
type="text"
Expand Down
Loading