mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-25 06:35:35 +00:00
fix: make azure cognitive services match azure
This commit is contained in:
parent
38adc13295
commit
aa190a9bd4
1 changed files with 13 additions and 4 deletions
|
|
@ -223,8 +223,14 @@ function custom(dep: CustomDep): Record<string, CustomLoader> {
|
|||
},
|
||||
}
|
||||
}),
|
||||
"azure-cognitive-services": Effect.fnUntraced(function* () {
|
||||
const resourceName = yield* dep.get("AZURE_COGNITIVE_SERVICES_RESOURCE_NAME")
|
||||
"azure-cognitive-services": Effect.fnUntraced(function* (provider: Info) {
|
||||
const env = yield* dep.env()
|
||||
const resource = iife(() => {
|
||||
const name = provider.options?.resourceName
|
||||
if (typeof name === "string" && name.trim() !== "") return name
|
||||
return env["AZURE_COGNITIVE_SERVICES_RESOURCE_NAME"]
|
||||
})
|
||||
|
||||
return {
|
||||
autoload: false,
|
||||
async getModel(sdk: any, modelID: string, options?: Record<string, any>) {
|
||||
|
|
@ -235,8 +241,11 @@ function custom(dep: CustomDep): Record<string, CustomLoader> {
|
|||
return sdk.responses(modelID)
|
||||
}
|
||||
},
|
||||
options: {
|
||||
baseURL: resourceName ? `https://${resourceName}.cognitiveservices.azure.com/openai` : undefined,
|
||||
options: {},
|
||||
vars(_options) {
|
||||
return {
|
||||
...(resource && { AZURE_COGNITIVE_SERVICES_RESOURCE_NAME: resource }),
|
||||
}
|
||||
},
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue