mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-25 11:44:22 +01:00
feat: enhance provider model mapping and reasoning capabilities
- Add npm package tracking to provider model mapping - Implement special handling for opencode provider with reasoning - Update provider options mapping to use npm package names
This commit is contained in:
@@ -159,7 +159,7 @@ export namespace Provider {
|
||||
} = {}
|
||||
const models = new Map<
|
||||
string,
|
||||
{ providerID: string; modelID: string; info: ModelsDev.Model; language: LanguageModel }
|
||||
{ providerID: string; modelID: string; info: ModelsDev.Model; language: LanguageModel; npm?: string }
|
||||
>()
|
||||
const sdk = new Map<number, SDK>()
|
||||
|
||||
@@ -378,12 +378,14 @@ export namespace Provider {
|
||||
modelID,
|
||||
info,
|
||||
language,
|
||||
npm: info.provider?.npm ?? provider.info.npm,
|
||||
})
|
||||
return {
|
||||
modelID,
|
||||
providerID,
|
||||
info,
|
||||
language,
|
||||
npm: info.provider?.npm ?? provider.info.npm,
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof NoSuchModelError)
|
||||
|
||||
@@ -96,6 +96,11 @@ export namespace ProviderTransform {
|
||||
if (providerID !== "azure") {
|
||||
result["textVerbosity"] = "low"
|
||||
}
|
||||
if (providerID === "opencode") {
|
||||
result["promptCacheKey"] = sessionID
|
||||
result["include"] = ["reasoning.encrypted_content"]
|
||||
result["reasoningSummary"] = "detailed"
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ export namespace SessionPrompt {
|
||||
maxOutputTokens: ProviderTransform.maxOutputTokens(model.providerID, outputLimit, params.options),
|
||||
abortSignal: abort.signal,
|
||||
providerOptions: {
|
||||
[model.providerID]: params.options,
|
||||
[model.npm === "@ai-sdk/openai" ? "openai" : model.providerID]: params.options,
|
||||
},
|
||||
stopWhen: stepCountIs(1),
|
||||
temperature: params.temperature,
|
||||
|
||||
Reference in New Issue
Block a user