Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
closer to type completion
  • Loading branch information
anotherjesse committed Jun 19, 2025
commit 98465e8e546920eb7c87822e8b3e98a38b05f36d
1 change: 1 addition & 0 deletions packages/toolshed/routes/ai/llm/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const CACHE_DIR = `${env.CACHE_DIR}/llm-api-cache`;

interface CacheItem {
messages: Array<{ role: string; content: string }>;
object?: Record<string, unknown>;
model?: string;
system?: string;
stopSequences?: string[];
Expand Down
6 changes: 2 additions & 4 deletions packages/toolshed/routes/ai/llm/llm.handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ export const generateObject: AppRouteHandler<GenerateObjectRoute> = async (
if (cachedResult) {
return c.json({
object: cachedResult.object,
id: cachedResult.id,
});
}, HttpStatusCodes.OK);
}
}

Expand All @@ -292,14 +291,13 @@ export const generateObject: AppRouteHandler<GenerateObjectRoute> = async (
await saveToCache(cacheKey, {
...removeNonCacheableFields(payload),
object: result.object,
id: result.id,
});
} catch (e) {
console.error("Error saving generateObject response to cache:", e);
}
}

return c.json(result);
return c.json(result, HttpStatusCodes.OK);
} catch (error) {
console.error("Error in generateObject:", error);
const message = error instanceof Error ? error.message : "Unknown error";
Expand Down
Loading