conv schema
This commit is contained in:
parent
12b683a9a0
commit
8126f118be
2 changed files with 21 additions and 2 deletions
|
|
@ -23,4 +23,23 @@ export default defineSchema({
|
||||||
.index('by_model_provider', ['model_id', 'provider'])
|
.index('by_model_provider', ['model_id', 'provider'])
|
||||||
.index('by_provider_user', ['provider', 'user_id'])
|
.index('by_provider_user', ['provider', 'user_id'])
|
||||||
.index('by_model_provider_user', ['model_id', 'provider', 'user_id']),
|
.index('by_model_provider_user', ['model_id', 'provider', 'user_id']),
|
||||||
|
conversations: defineTable({
|
||||||
|
user_id: v.string(),
|
||||||
|
title: v.string(),
|
||||||
|
created_at: v.number(),
|
||||||
|
updated_at: v.number(),
|
||||||
|
})
|
||||||
|
.index('by_user', ['user_id'])
|
||||||
|
.index('by_user_updated', ['user_id', 'updated_at']),
|
||||||
|
messages: defineTable({
|
||||||
|
conversation_id: v.id('conversations'),
|
||||||
|
role: v.union(v.literal('user'), v.literal('assistant'), v.literal('system')),
|
||||||
|
content: v.string(),
|
||||||
|
created_at: v.number(),
|
||||||
|
model_id: v.optional(v.string()),
|
||||||
|
provider: v.optional(providerValidator),
|
||||||
|
token_count: v.optional(v.number()),
|
||||||
|
})
|
||||||
|
.index('by_conversation', ['conversation_id'])
|
||||||
|
.index('by_conversation_created', ['conversation_id', 'created_at']),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Be sure to login first.
|
Be sure to login first.
|
||||||
{/if}
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
<div class="mt-2 flex items-center gap-1">
|
<div class="mt-4 flex items-center gap-1">
|
||||||
{#each { length: 4 }}
|
{#each { length: 4 }}
|
||||||
<Button variant="outline" class="rounded-full">
|
<Button variant="outline" class="rounded-full">
|
||||||
<IconAi />
|
<IconAi />
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="mt-2 flex flex-col gap-2">
|
<ul class="mt-2 flex flex-col gap-2 p-2">
|
||||||
{#each { length: 3 } as _, i (i)}
|
{#each { length: 3 } as _, i (i)}
|
||||||
<li class={['py-2', i !== 2 && 'border-b']}>Hey AI, write me a poem</li>
|
<li class={['py-2', i !== 2 && 'border-b']}>Hey AI, write me a poem</li>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue