mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
Reorganized the genai package by removing legacy LLM-related files and introducing a new modular interface under the 'interface' directory. Added provider-specific model classes, centralized constants, and updated the example to use the new API and data structures. Updated exports in genai.dart and improved dependency management.
35 lines
887 B
Dart
35 lines
887 B
Dart
import 'package:flutter/material.dart';
|
|
import '../models/models.dart';
|
|
|
|
class AIConfigField extends StatelessWidget {
|
|
final bool numeric;
|
|
final ModelConfig configuration;
|
|
final Function(ModelConfig) onConfigUpdated;
|
|
final bool readonly;
|
|
const AIConfigField({
|
|
super.key,
|
|
this.numeric = false,
|
|
required this.configuration,
|
|
required this.onConfigUpdated,
|
|
this.readonly = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextFormField(
|
|
initialValue: configuration.value.value.toString(),
|
|
onChanged: (x) {
|
|
if (readonly) return;
|
|
if (numeric) {
|
|
if (x.isEmpty) x = '0';
|
|
if (num.tryParse(x) == null) return;
|
|
configuration.value.value = num.parse(x);
|
|
} else {
|
|
configuration.value.value = x;
|
|
}
|
|
onConfigUpdated(configuration);
|
|
},
|
|
);
|
|
}
|
|
}
|