refactor(characters): drive shared UI from active character

This commit is contained in:
2026-07-17 19:33:59 +08:00
parent 8bb1e21886
commit 7bd5defa5e
42 changed files with 335 additions and 118 deletions
@@ -4,7 +4,10 @@ import { createActor, fromCallback, waitFor } from "xstate";
import type { UiMessage } from "@/stores/chat/ui-message";
import type { ChatEvent } from "@/stores/chat/chat-events";
import { chatMachine } from "@/stores/chat/chat-machine";
import type { LoadMoreHistoryActorEvent } from "@/stores/chat/machine/actors/history";
import type {
ChatHistoryActorInput,
LoadMoreHistoryActorEvent,
} from "@/stores/chat/machine/actors/history";
import {
createLoadHistoryCallback,
@@ -50,7 +53,7 @@ describe("chat history flow", () => {
actors: {
loadHistory: fromCallback<
ChatEvent,
{ characterId: string }
ChatHistoryActorInput
>(({ sendBack }) => {
sendBack({
type: "ChatLocalHistoryLoaded",
@@ -119,7 +122,7 @@ describe("chat history flow", () => {
),
loadMoreHistory: fromCallback<
LoadMoreHistoryActorEvent,
{ characterId: string }
ChatHistoryActorInput
>(
({ receive, sendBack }) => {
receive((event) => {
@@ -198,7 +201,7 @@ describe("chat history flow", () => {
}),
loadMoreHistory: fromCallback<
LoadMoreHistoryActorEvent,
{ characterId: string }
ChatHistoryActorInput
>(
({ receive, sendBack }) => {
receive((event) => {
@@ -260,7 +263,7 @@ describe("chat history flow", () => {
}),
loadMoreHistory: fromCallback<
LoadMoreHistoryActorEvent,
{ characterId: string }
ChatHistoryActorInput
>(
({ receive }) => {
receive(() => {