wcz-layout
Version:
36 lines • 2.03 kB
text/typescript
import { n as User } from "./User-aJksXItw.mjs";
import { RunAgentInput } from "@tanstack/ai/client";
import { OpenAIChatCompletionsTextAdapter, OpenAIChatModel } from "@tanstack/ai-openai";
import { AnyServerTool } from "@tanstack/ai";
/**
* The one adapter for the Wistron AI gateway: conversations, one-off calls and files. Create it
* per request in a server function (`getAppToken` caches the token).
*
* Chat Completions, not Responses: the gateway load-balances Azure deployments, and Responses
* replays encrypted reasoning that other deployments cannot read (400 invalid_encrypted_content).
*/
export declare const chatAdapter: <TModel extends OpenAIChatModel>(model: TModel) => Promise<OpenAIChatCompletionsTextAdapter<TModel>>;
interface LayoutChatOptions {
/** The request the chat sent: the server function's `data`. */
data: RunAgentInput;
/** Who the assistant acts for: `context.user` of `authMiddleware()`. */
user: User;
/** What the app is, what its records are called and where their pages are. The same for every user. */
systemPrompts: Array<string>;
/**
* The app's server tools. One marked `needsApproval` stays a tool call, which the chat confirms
* with the user first; the others become the functions of the programs the model runs, so it
* filters, joins and changes many records in one go, and only its answer enters the conversation.
*/
tools?: ReadonlyArray<AnyServerTool>;
/** How the app works: markdown by topic, each starting with a `# Title` line. Read on demand. */
guides?: Record<string, string>;
}
/**
* The reply to a chat request, streamed: return it from the server function given to
* `createLayoutChatHook`. It runs the app's tools as the signed-in user and brings what every
* assistant shares: the model, code mode, the guides, the shared rules and a bounded conversation.
*/
export declare function layoutChat({ data, user, systemPrompts, tools, guides }: LayoutChatOptions): Promise<Response>;
export {};
//# sourceMappingURL=ai.d.mts.map