Export template source from b7b156d0ca1549a52cbea95609b23714449b3cc8:quixos-instance/packages/agent-presentation
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { AgentWidget } from "./widget.js";
|
||||
import type { Modules } from "./gen/client.js";
|
||||
import { ThreadView } from "./shared.js";
|
||||
import { HttpThreadController } from "./http.js";
|
||||
import type { Thread as ThreadData } from "./protocol.js";
|
||||
import "./thread.css";
|
||||
export const Thread: Modules["Thread"] = ({ subject, input }) => {
|
||||
const controller = useMemo(
|
||||
() =>
|
||||
new HttpThreadController(
|
||||
subject.object,
|
||||
JSON.parse(
|
||||
JSON.stringify(input.body.root, (_key, value) => (typeof value === "bigint" ? value.toString() : value)),
|
||||
) as ThreadData,
|
||||
),
|
||||
[subject.object],
|
||||
);
|
||||
useEffect(() => () => controller.close(), [controller]);
|
||||
return (
|
||||
<ThreadView thread={subject.object} controller={controller} renderWidget={(item) => <AgentWidget item={item} />} />
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user