Add basic functionality

This commit is contained in:
2026-10-05 21:51:31 +02:00
parent 91fde51eea
commit e9a3144f00
21 changed files with 2239 additions and 277 deletions
+66
View File
@@ -0,0 +1,66 @@
<script setup lang="ts">
import { invoke } from '@tauri-apps/api/core';
import { ref } from 'vue';
const initialized=ref(false);
const models=ref([]);
const model=ref("");
const new_model=ref("");
const information=ref(undefined);
const system_prompt=ref("");
async function init(){
models.value=await invoke("get_models");
initialized.value=true;
}
init();
async function load_model(localmodel){
model.value=localmodel;
let info;
try{
info=await invoke("get_model_info",{model: model.value});
} catch(e){
window.alert("Das funktioniert mit diesem Modell leider nicht.");
return
}
information.value={parameters: info.parameters, template: info.template}
console.log(information.value)
}
async function save(){
try {
window.alert("Antwort von Ollama: " + await invoke("create_model",{fromModel: model.value, template: information.value.template, systemPrompt: system_prompt.value, newModel: new_model.value}))
} catch(e){
window.alert("Das hat nicht geklappt. Fehlermeldung: "+e)
return
}
}
</script>
<template>
<RouterLink to="/">Zurück zur Startseite</RouterLink>
<h1>Modell bearbeiten</h1>
<p>Diese Funktion ist leider nicht für alle Modelle verfügbar.</p>
<div v-if="initialized">
<ul v-if="information==undefined">
<li @click="load_model(model.name)" v-for="model in models">{{ model.name }}</li>
</ul>
<form v-else @submit.prevent="save">
<button @click="information=undefined">Zurück zur Modellauswahl</button>
<textarea v-model="information.template" placeholder="Prompt Template" class="w-full"></textarea>
<textarea v-model="system_prompt" placeholder="System Prompt" class="w-full"></textarea>
<input type="text" placeholder="Neuer Modellname" v-model="new_model">
<input type="submit" value="Speichern"/>
</form>
</div>
<div v-else>
Rufe die Liste der Modelle bei Ollama ab...
</div>
</template>