mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-07 01:08:58 +00:00
feat(id): brand ProviderID and ModelID (#17110)
This commit is contained in:
@@ -35,6 +35,7 @@ import { Hash } from "../util/hash"
|
||||
import { ACPSessionManager } from "./session"
|
||||
import type { ACPConfig } from "./types"
|
||||
import { Provider } from "../provider/provider"
|
||||
import { ProviderID } from "../provider/schema"
|
||||
import { Agent as AgentModule } from "../agent/agent"
|
||||
import { Installation } from "@/installation"
|
||||
import { MessageV2 } from "@/session/message-v2"
|
||||
@@ -590,7 +591,7 @@ export namespace ACP {
|
||||
}
|
||||
} catch (e) {
|
||||
const error = MessageV2.fromError(e, {
|
||||
providerID: this.config.defaultModel?.providerID ?? "unknown",
|
||||
providerID: ProviderID.make(this.config.defaultModel?.providerID ?? "unknown"),
|
||||
})
|
||||
if (LoadAPIKeyError.isInstance(error)) {
|
||||
throw RequestError.authRequired()
|
||||
@@ -655,7 +656,7 @@ export namespace ACP {
|
||||
return result
|
||||
} catch (e) {
|
||||
const error = MessageV2.fromError(e, {
|
||||
providerID: this.config.defaultModel?.providerID ?? "unknown",
|
||||
providerID: ProviderID.make(this.config.defaultModel?.providerID ?? "unknown"),
|
||||
})
|
||||
if (LoadAPIKeyError.isInstance(error)) {
|
||||
throw RequestError.authRequired()
|
||||
@@ -700,7 +701,7 @@ export namespace ACP {
|
||||
return response
|
||||
} catch (e) {
|
||||
const error = MessageV2.fromError(e, {
|
||||
providerID: this.config.defaultModel?.providerID ?? "unknown",
|
||||
providerID: ProviderID.make(this.config.defaultModel?.providerID ?? "unknown"),
|
||||
})
|
||||
if (LoadAPIKeyError.isInstance(error)) {
|
||||
throw RequestError.authRequired()
|
||||
@@ -765,7 +766,7 @@ export namespace ACP {
|
||||
return mode
|
||||
} catch (e) {
|
||||
const error = MessageV2.fromError(e, {
|
||||
providerID: this.config.defaultModel?.providerID ?? "unknown",
|
||||
providerID: ProviderID.make(this.config.defaultModel?.providerID ?? "unknown"),
|
||||
})
|
||||
if (LoadAPIKeyError.isInstance(error)) {
|
||||
throw RequestError.authRequired()
|
||||
@@ -796,7 +797,7 @@ export namespace ACP {
|
||||
return result
|
||||
} catch (e) {
|
||||
const error = MessageV2.fromError(e, {
|
||||
providerID: this.config.defaultModel?.providerID ?? "unknown",
|
||||
providerID: ProviderID.make(this.config.defaultModel?.providerID ?? "unknown"),
|
||||
})
|
||||
if (LoadAPIKeyError.isInstance(error)) {
|
||||
throw RequestError.authRequired()
|
||||
@@ -1666,7 +1667,8 @@ export namespace ACP {
|
||||
): ModelOption[] {
|
||||
const includeVariants = options.includeVariants ?? false
|
||||
return providers.flatMap((provider) => {
|
||||
const models = Provider.sort(Object.values(provider.models) as any)
|
||||
const unsorted: Array<{ id: string; name: string; variants?: Record<string, any> }> = Object.values(provider.models)
|
||||
const models = Provider.sort(unsorted)
|
||||
return models.flatMap((model) => {
|
||||
const base: ModelOption = {
|
||||
modelId: `${provider.id}/${model.id}`,
|
||||
|
||||
Reference in New Issue
Block a user