core: expose v2 model listing API (#25821)
This commit is contained in:
@@ -593,6 +593,12 @@ const scenarios: Scenario[] = [
|
||||
check(auth.test === undefined, "auth remove should delete provider from isolated auth file")
|
||||
}),
|
||||
),
|
||||
http.protected.get("/api/model", "v2.model.list").json(200, array),
|
||||
http.protected.get("/api/provider", "v2.provider.list").json(200, array),
|
||||
http.protected
|
||||
.get("/api/provider/{providerID}", "v2.provider.get")
|
||||
.at((ctx) => ({ path: route("/api/provider/{providerID}", { providerID: "missing" }), headers: ctx.headers() }))
|
||||
.json(404, object, "status"),
|
||||
http.protected
|
||||
.get("/api/session", "v2.session.list")
|
||||
.at((ctx) => ({ path: "/api/session?roots=true", headers: ctx.headers() }))
|
||||
|
||||
@@ -20,7 +20,8 @@ import { MessageV2 } from "../../src/session/message-v2"
|
||||
import { Database } from "@/storage/db"
|
||||
import { SessionMessageTable, SessionTable } from "@/session/session.sql"
|
||||
import { SessionMessage } from "../../src/v2/session-message"
|
||||
import { Modelv2 } from "../../src/v2/model"
|
||||
import { ModelV2 } from "@opencode-ai/core/model"
|
||||
import { ProviderV2 } from "@opencode-ai/core/provider"
|
||||
import * as DateTime from "effect/DateTime"
|
||||
import * as Log from "@opencode-ai/core/util/log"
|
||||
import { eq } from "drizzle-orm"
|
||||
@@ -110,9 +111,9 @@ const insertLegacyAssistantMessage = (sessionID: SessionIDType) =>
|
||||
type: "assistant",
|
||||
agent: "build",
|
||||
model: {
|
||||
id: Modelv2.ID.make("model"),
|
||||
providerID: Modelv2.ProviderID.make("provider"),
|
||||
variant: Modelv2.VariantID.make("default"),
|
||||
id: ModelV2.ID.make("model"),
|
||||
providerID: ProviderV2.ID.make("provider"),
|
||||
variant: ModelV2.VariantID.make("default"),
|
||||
},
|
||||
time: { created: DateTime.makeUnsafe(1) },
|
||||
content: [],
|
||||
|
||||
Reference in New Issue
Block a user