|
|
@@ -1,5 +1,17 @@ |
|
|
|
import Handlebars from 'handlebars'; |
|
|
|
import { Message, MessageRole } from './message'; |
|
|
|
|
|
|
|
export enum MessageRole { |
|
|
|
SYSTEM = 'system', |
|
|
|
USER = 'user', |
|
|
|
ASSISTANT = 'assistant', |
|
|
|
} |
|
|
|
|
|
|
|
export interface MessageObject { |
|
|
|
role: MessageRole; |
|
|
|
content: string; |
|
|
|
} |
|
|
|
|
|
|
|
export type Message = string | MessageObject; |
|
|
|
|
|
|
|
const isValidMessageObject = (maybeMessage: unknown): maybeMessage is Message => { |
|
|
|
if (typeof maybeMessage !== 'object') { |
|
|
|