27 lines
707 B
TypeScript
27 lines
707 B
TypeScript
import {
|
|
chatMachineSetup,
|
|
chatRootStateConfig,
|
|
} from "./machine/session-flow";
|
|
import {
|
|
DEFAULT_CHARACTER,
|
|
DEFAULT_CHARACTER_ID,
|
|
} from "@/data/constants/character";
|
|
|
|
import { createInitialChatState } from "./chat-state";
|
|
|
|
export type { ChatState } from "./chat-state";
|
|
export { initialState } from "./chat-state";
|
|
export type { ChatEvent } from "./chat-events";
|
|
|
|
export const chatMachine = chatMachineSetup.createMachine({
|
|
id: "chat",
|
|
context: ({ input }) =>
|
|
createInitialChatState(
|
|
input?.characterId ?? DEFAULT_CHARACTER_ID,
|
|
input?.emptyChatGreeting ?? DEFAULT_CHARACTER.emptyChatGreeting,
|
|
),
|
|
...chatRootStateConfig,
|
|
});
|
|
|
|
export type ChatMachine = typeof chatMachine;
|