feat: Add support for builtin models in the application
- Introduced `is_builtin` property in the model configuration to identify builtin models. - Updated frontend components to display a tag for builtin models in the ModelSelector and ModelSettings. - Enhanced the ModelEditorDialog to prevent editing and deletion of builtin models. - Implemented logic in the backend to hide sensitive information for builtin models and restrict their modification. - Added informative UI elements to clarify the nature of builtin models in the settings and editor views.
This commit is contained in:
@@ -28,7 +28,7 @@ func (r *modelRepository) Create(ctx context.Context, m *types.Model) error {
|
||||
func (r *modelRepository) GetByID(ctx context.Context, tenantID uint, id string) (*types.Model, error) {
|
||||
var m types.Model
|
||||
if err := r.db.WithContext(ctx).Where("id = ?", id).Where(
|
||||
"tenant_id = ? or tenant_id = 0", tenantID,
|
||||
"tenant_id = ? OR is_builtin = true", tenantID,
|
||||
).First(&m).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, nil
|
||||
@@ -44,7 +44,7 @@ func (r *modelRepository) List(
|
||||
) ([]*types.Model, error) {
|
||||
var models []*types.Model
|
||||
query := r.db.WithContext(ctx).Where(
|
||||
"tenant_id = ? or tenant_id = 0", tenantID,
|
||||
"tenant_id = ? OR is_builtin = true", tenantID,
|
||||
)
|
||||
|
||||
if modelType != "" {
|
||||
|
||||
Reference in New Issue
Block a user