feat: GUI can use structured output present in recipes (#3218)
This commit is contained in:
@@ -285,6 +285,9 @@ function ToolCallView({
|
||||
}
|
||||
break;
|
||||
|
||||
case 'final_output':
|
||||
return 'final output';
|
||||
|
||||
case 'computer_control':
|
||||
return 'poking around...';
|
||||
|
||||
|
||||
@@ -191,6 +191,8 @@ export const initializeSystem = async (
|
||||
// Get recipeConfig directly here
|
||||
const recipeConfig = window.appConfig?.get?.('recipeConfig');
|
||||
const botPrompt = (recipeConfig as { instructions?: string })?.instructions;
|
||||
const responseConfig = (recipeConfig as { response?: { json_schema?: unknown } })?.response;
|
||||
|
||||
// Extend the system prompt with desktop-specific information
|
||||
const response = await fetch(getApiUrl('/agent/prompt'), {
|
||||
method: 'POST',
|
||||
@@ -213,6 +215,25 @@ export const initializeSystem = async (
|
||||
}
|
||||
}
|
||||
|
||||
// Configure session with response config if present
|
||||
if (responseConfig?.json_schema) {
|
||||
const sessionConfigResponse = await fetch(getApiUrl('/agent/session_config'), {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Secret-Key': getSecretKey(),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
response: responseConfig,
|
||||
}),
|
||||
});
|
||||
if (!sessionConfigResponse.ok) {
|
||||
console.warn(`Failed to configure session: ${sessionConfigResponse.statusText}`);
|
||||
} else {
|
||||
console.log('Configured session with response schema');
|
||||
}
|
||||
}
|
||||
|
||||
if (!options?.getExtensions || !options?.addExtension) {
|
||||
console.warn('Extension helpers not provided in alpha mode');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user