feat: Add agent configuration and cleanup scripts for database migrations

This commit is contained in:
wizardchen
2025-11-05 23:18:44 +08:00
parent ae9d0778e9
commit 4fa3adbf3b
126 changed files with 22506 additions and 629 deletions
+39
View File
@@ -30,6 +30,12 @@ const (
ErrTenantNameRequired ErrorCode = 2003
ErrTenantInvalidStatus ErrorCode = 2004
// Agent related error codes (2100-2199)
ErrAgentMissingThinkingModel ErrorCode = 2100
ErrAgentMissingAllowedTools ErrorCode = 2101
ErrAgentInvalidMaxIterations ErrorCode = 2102
ErrAgentInvalidTemperature ErrorCode = 2103
// Add more error codes here
)
@@ -145,6 +151,39 @@ func NewTenantInactiveError() *AppError {
}
}
// Agent related errors
func NewAgentMissingThinkingModelError() *AppError {
return &AppError{
Code: ErrAgentMissingThinkingModel,
Message: "启用Agent模式前,请先选择思考模型",
HTTPCode: http.StatusBadRequest,
}
}
func NewAgentMissingAllowedToolsError() *AppError {
return &AppError{
Code: ErrAgentMissingAllowedTools,
Message: "至少需要选择一个允许的工具",
HTTPCode: http.StatusBadRequest,
}
}
func NewAgentInvalidMaxIterationsError() *AppError {
return &AppError{
Code: ErrAgentInvalidMaxIterations,
Message: "最大迭代次数必须在1-20之间",
HTTPCode: http.StatusBadRequest,
}
}
func NewAgentInvalidTemperatureError() *AppError {
return &AppError{
Code: ErrAgentInvalidTemperature,
Message: "温度参数必须在0-2之间",
HTTPCode: http.StatusBadRequest,
}
}
// IsAppError checks if the error is an AppError type
func IsAppError(err error) (*AppError, bool) {
appErr, ok := err.(*AppError)