thinking
This commit is contained in:
@@ -451,6 +451,16 @@ function writeRpcCommand(proc: Subprocess, command: Record<string, unknown>): vo
|
||||
}
|
||||
}
|
||||
|
||||
export function setThinkingLevel(
|
||||
process: Subprocess,
|
||||
level: string,
|
||||
): void {
|
||||
writeRpcCommand(process, {
|
||||
type: 'set_thinking_level',
|
||||
level,
|
||||
});
|
||||
}
|
||||
|
||||
export function sendPrompt(
|
||||
process: Subprocess,
|
||||
prompt: string,
|
||||
|
||||
@@ -39,6 +39,8 @@ export type GroupMeta = {
|
||||
sessionCount: number;
|
||||
};
|
||||
|
||||
export type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
||||
|
||||
export type ClientMessage =
|
||||
| {
|
||||
type: "chat";
|
||||
@@ -50,6 +52,7 @@ export type ClientMessage =
|
||||
sandboxed?: boolean;
|
||||
groupSlug?: string;
|
||||
attachmentIds?: string[];
|
||||
thinking?: ThinkingLevel;
|
||||
}
|
||||
| {
|
||||
type: "resume";
|
||||
|
||||
@@ -244,7 +244,7 @@ function createEventHandler(sessionId: string, model: string, cwd: string, stora
|
||||
|
||||
async function handleChat(
|
||||
ws: ServerWebSocket<WSData>,
|
||||
msg: { prompt: string; sessionId?: string; model?: string; cwd?: string; cwdRoot?: string; sandboxed?: boolean; groupSlug?: string; attachmentIds?: string[] }
|
||||
msg: { prompt: string; sessionId?: string; model?: string; cwd?: string; cwdRoot?: string; sandboxed?: boolean; groupSlug?: string; attachmentIds?: string[]; thinking?: string }
|
||||
): Promise<void> {
|
||||
const { email, username, userId } = ws.data;
|
||||
const sessionId = msg.sessionId || randomUUID();
|
||||
@@ -312,6 +312,11 @@ async function handleChat(
|
||||
session.meta.title = msg.prompt.slice(0, 100);
|
||||
}
|
||||
|
||||
// Set thinking level if provided
|
||||
if (msg.thinking) {
|
||||
piBridge.setThinkingLevel(session.piProcess, msg.thinking);
|
||||
}
|
||||
|
||||
// Send prompt to Pi
|
||||
const requestId = randomUUID();
|
||||
session.isGenerating = true;
|
||||
|
||||
Reference in New Issue
Block a user