refactor(characters): drive shared UI from active character
This commit is contained in:
@@ -19,20 +19,26 @@ import {
|
||||
|
||||
const startGuestSessionAction = unlockMachineSetup.assign(
|
||||
({ context }) => ({
|
||||
...createInitialChatState(context.characterId),
|
||||
...createInitialChatState(
|
||||
context.characterId,
|
||||
context.emptyChatGreeting,
|
||||
),
|
||||
promotion: context.promotion,
|
||||
}),
|
||||
);
|
||||
|
||||
const startUserSessionAction = unlockMachineSetup.assign(
|
||||
({ context }) => ({
|
||||
...createInitialChatState(context.characterId),
|
||||
...createInitialChatState(
|
||||
context.characterId,
|
||||
context.emptyChatGreeting,
|
||||
),
|
||||
promotion: context.promotion,
|
||||
}),
|
||||
);
|
||||
|
||||
const clearChatSessionAction = unlockMachineSetup.assign(({ context }) => ({
|
||||
...createInitialChatState(context.characterId),
|
||||
...createInitialChatState(context.characterId, context.emptyChatGreeting),
|
||||
}));
|
||||
|
||||
const injectPromotionAction = unlockMachineSetup.assign(({ event }) => {
|
||||
@@ -80,12 +86,18 @@ const guestSessionState = chatMachineSetup.createStateConfig({
|
||||
{
|
||||
id: "loadHistory",
|
||||
src: "loadHistory",
|
||||
input: ({ context }) => ({ characterId: context.characterId }),
|
||||
input: ({ context }) => ({
|
||||
characterId: context.characterId,
|
||||
emptyChatGreeting: context.emptyChatGreeting,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: "loadMoreHistory",
|
||||
src: "loadMoreHistory",
|
||||
input: ({ context }) => ({ characterId: context.characterId }),
|
||||
input: ({ context }) => ({
|
||||
characterId: context.characterId,
|
||||
emptyChatGreeting: context.emptyChatGreeting,
|
||||
}),
|
||||
},
|
||||
],
|
||||
on: {
|
||||
@@ -162,12 +174,18 @@ const userSessionState = chatMachineSetup.createStateConfig({
|
||||
{
|
||||
id: "loadHistory",
|
||||
src: "loadHistory",
|
||||
input: ({ context }) => ({ characterId: context.characterId }),
|
||||
input: ({ context }) => ({
|
||||
characterId: context.characterId,
|
||||
emptyChatGreeting: context.emptyChatGreeting,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: "loadMoreHistory",
|
||||
src: "loadMoreHistory",
|
||||
input: ({ context }) => ({ characterId: context.characterId }),
|
||||
input: ({ context }) => ({
|
||||
characterId: context.characterId,
|
||||
emptyChatGreeting: context.emptyChatGreeting,
|
||||
}),
|
||||
},
|
||||
],
|
||||
on: {
|
||||
|
||||
Reference in New Issue
Block a user