Url encode add model check url

This commit is contained in:
JHubi1 2024-09-16 14:02:42 +02:00
parent d670072a69
commit 9a5e7ddb89
No known key found for this signature in database
GPG Key ID: 7BF82570CBBBD050
1 changed files with 4 additions and 3 deletions

View File

@ -333,7 +333,7 @@ void addModel(BuildContext context, Function setState) async {
placeholder: "llama3:latest",
enableSuggestions: false,
validator: (content) async {
var model = content;
var model = content.trim();
model = model.removeSuffix(":latest");
if (model == "") return false;
canceled = false;
@ -395,8 +395,9 @@ void addModel(BuildContext context, Function setState) async {
}
http.Response response;
try {
response = await http.get(Uri.parse("$endpoint$model")).timeout(
Duration(
response = await http
.get(Uri.parse("$endpoint${Uri.encodeComponent(model)}"))
.timeout(Duration(
seconds: (10.0 * (prefs!.getDouble("timeoutMultiplier") ?? 1.0))
.round()));
} catch (_) {