We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8d1678 commit 43dc70cCopy full SHA for 43dc70c
src/routes/models/route.ts
@@ -1,6 +1,7 @@
1
import { Hono } from "hono"
2
3
import { forwardError } from "~/lib/forward-error"
4
+import { cacheModels } from "~/lib/models"
5
import { state } from "~/lib/state"
6
7
export const modelRoutes = new Hono()
@@ -9,10 +10,10 @@ modelRoutes.get("/", async (c) => {
9
10
try {
11
if (!state.models) {
12
// This should be handled by startup logic, but as a fallback.
- return c.json({ error: "Models not available" }, 503)
13
+ await cacheModels()
14
}
15
- const models = state.models.data.map((model) => ({
16
+ const models = state.models?.data.map((model) => ({
17
id: model.id,
18
object: "model",
19
type: "model",
0 commit comments