添加模型支持,更新提示功能以接收模型参数

This commit is contained in:
2026-05-13 18:12:45 +08:00
parent f58abe8003
commit 61b1018900
2 changed files with 34 additions and 2 deletions
+7 -1
View File
@@ -12,6 +12,11 @@ export type RuntimeHealth = {
version: string;
};
type RuntimeModelOverride = {
providerID: string;
modelID: string;
};
export class OpencodeRuntimeAdapter {
private clientPromise: Promise<OpencodeClient> | null = null;
private closeServer: (() => void) | null = null;
@@ -52,10 +57,11 @@ export class OpencodeRuntimeAdapter {
return this.messages(sessionId);
}
async prompt(sessionId: string, text: string) {
async prompt(sessionId: string, text: string, model?: RuntimeModelOverride) {
const client = await this.ensureClient();
await client.session.prompt({
sessionID: sessionId,
model,
parts: [{ type: "text", text }],
});
}