Skip to content

Commit

Permalink
Consolidate the ChatMessage type
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmyersdev committed May 19, 2024
1 parent 5eab552 commit c0a68f7
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions models/src/chat/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ChatMessage, chainable, id, messageFactory, timestamp, zId, zJsonLike, zRole, zTimestamp } from 'vellma'
import { type ChatMessage, chainable, id, messageFactory, timestamp, zId, zMessage, zTimestamp } from 'vellma'
import { type ChatIntegration } from 'vellma/integrations'
import { type Peripherals, storageBucket, useInMemoryStorage, useLogger } from 'vellma/peripherals'
import { type Tool } from 'vellma/tools'
Expand Down Expand Up @@ -31,22 +31,7 @@ export const chatSchema = storageBucket({

export const chatMessageSchema = storageBucket({
name: 'chatMessages',
attributes: z.object({
id: zId.default(() => id()),
chatId: zId.optional(),
userId: z.string().optional(),
function: z.object({
args: zJsonLike.or(z.string()),
// Todo: Maybe enum the function list?
name: z.string(),
}).optional(),
name: z.string().optional(),
role: zRole,
text: z.string().optional().default(''),
textDelta: z.string().optional().default(''),
createdAt: zTimestamp.default(() => timestamp()),
updatedAt: zTimestamp.default(() => timestamp()),
}),
attributes: zMessage,
})

export const useChat = (config: ChatModelConfig) => {
Expand Down

0 comments on commit c0a68f7

Please sign in to comment.