mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
23 lines
704 B
TypeScript
23 lines
704 B
TypeScript
import { ModelValidationError } from '@main/apiServer/utils'
|
|
import { AgentType } from '@types'
|
|
|
|
export type AgentModelField = 'model' | 'plan_model' | 'small_model'
|
|
|
|
export interface AgentModelValidationContext {
|
|
agentType: AgentType
|
|
field: AgentModelField
|
|
model?: string
|
|
}
|
|
|
|
export class AgentModelValidationError extends Error {
|
|
readonly context: AgentModelValidationContext
|
|
readonly detail: ModelValidationError
|
|
|
|
constructor(context: AgentModelValidationContext, detail: ModelValidationError) {
|
|
super(`Validation failed for ${context.agentType}.${context.field}: ${detail.message}`)
|
|
this.name = 'AgentModelValidationError'
|
|
this.context = context
|
|
this.detail = detail
|
|
}
|
|
}
|