feat(chat): sync multi-role backend APIs
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
DEFAULT_CHARACTER_ID,
|
||||
} from "@/data/constants/character";
|
||||
import type { ChatPromotionState } from "./helper/promotion";
|
||||
import type { CharacterErrorCode } from "@/data/services/api";
|
||||
|
||||
export type ChatUpgradeReason = "insufficient_credits";
|
||||
|
||||
@@ -29,6 +30,7 @@ export interface ChatUnlockPaywallRequest
|
||||
|
||||
export interface ChatState {
|
||||
characterId: string;
|
||||
characterErrorCode: CharacterErrorCode | null;
|
||||
emptyChatGreeting: string;
|
||||
messages: UiMessage[];
|
||||
promotion: ChatPromotionState | null;
|
||||
@@ -58,11 +60,12 @@ export interface ChatState {
|
||||
}
|
||||
|
||||
export function createInitialChatState(
|
||||
characterId: string = DEFAULT_CHARACTER_ID,
|
||||
emptyChatGreeting: string = DEFAULT_CHARACTER.emptyChatGreeting,
|
||||
characterId: string,
|
||||
emptyChatGreeting: string,
|
||||
): ChatState {
|
||||
return {
|
||||
characterId,
|
||||
characterErrorCode: null,
|
||||
emptyChatGreeting,
|
||||
messages: [],
|
||||
promotion: null,
|
||||
@@ -91,4 +94,7 @@ export function createInitialChatState(
|
||||
};
|
||||
}
|
||||
|
||||
export const initialState: ChatState = createInitialChatState();
|
||||
export const initialState: ChatState = createInitialChatState(
|
||||
DEFAULT_CHARACTER_ID,
|
||||
DEFAULT_CHARACTER.emptyChatGreeting,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user