diff --git a/browser/src/screenshot.ts b/browser/src/screenshot.ts index 477b4ccd..8b2111e3 100644 --- a/browser/src/screenshot.ts +++ b/browser/src/screenshot.ts @@ -48,7 +48,7 @@ export async function screenshot ( const obotServerUrl = process.env?.OBOT_SERVER_URL const threadId = getGPTScriptEnv(headers, 'OBOT_THREAD_ID') if (obotServerUrl !== undefined && threadId !== undefined) { - downloadUrl = `${obotServerUrl}/api/threads/${threadId}/file/${screenshotName}` + downloadUrl = `${obotServerUrl}/api/threads/${threadId}/files/${screenshotName}` } return { diff --git a/images/src/analyze.ts b/images/src/analyze.ts index 1be4984b..0da3c225 100644 --- a/images/src/analyze.ts +++ b/images/src/analyze.ts @@ -59,7 +59,7 @@ export async function analyzeImages( const supportedMimeTypes = ['image/jpeg', 'image/png', 'image/webp']; const threadId = process.env.OBOT_THREAD_ID const obotServerUrl = process.env.OBOT_SERVER_URL -const imageGenBaseUrl = (threadId && obotServerUrl) ? `${obotServerUrl}/api/threads/${threadId}/file/` : null +const imageGenBaseUrl = (threadId && obotServerUrl) ? `${obotServerUrl}/api/threads/${threadId}/files/` : null async function resolveImageURL (image: string): Promise { // If the image is a URL, return it as is @@ -99,9 +99,9 @@ async function readImageFile(path: string): Promise { // The Generate Images tool returns file paths with a special prefix // so that they can be rendered in the Obot UI. - // e.g. /api/threads//file/generated_image_.webp + // e.g. /api/threads//files/generated_image_.webp // It must be stripped before reading the file from the workspace - path = path.replace(/^\/?api\/threads\/[a-z0-9]+\/file\//, '') + path = path.replace(/^\/?api\/threads\/[a-z0-9]+\/files\//, '') const client = new GPTScript() return Buffer.from(await client.readFileInWorkspace(`files/${path}`)) diff --git a/images/src/generate.ts b/images/src/generate.ts index 7d7b2679..68c0c9ba 100644 --- a/images/src/generate.ts +++ b/images/src/generate.ts @@ -9,7 +9,7 @@ type ImageQuality = 'standard' | 'hd'; const threadId = process.env.OBOT_THREAD_ID const obotServerUrl = process.env.OBOT_SERVER_URL -const downloadBaseUrl = (threadId && obotServerUrl) ? `${obotServerUrl}/api/threads/${threadId}/file` : null +const downloadBaseUrl = (threadId && obotServerUrl) ? `${obotServerUrl}/api/threads/${threadId}/files` : null export async function generateImages( prompt: string = '',