From 5b745c045f6d177c919af68be14a06a5a30fc66a Mon Sep 17 00:00:00 2001 From: Alexander Thiess Date: Mon, 22 Sep 2025 15:13:09 +0200 Subject: [PATCH] adjustments --- .gitignore | 4 +++- src/components/ollama_model_edit.py | 15 ++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 433d78c..50cb8fc 100644 --- a/.gitignore +++ b/.gitignore @@ -174,4 +174,6 @@ cython_debug/ # PyPI configuration file .pypirc -.nicegui \ No newline at end of file +.nicegui + +/config \ No newline at end of file diff --git a/src/components/ollama_model_edit.py b/src/components/ollama_model_edit.py index 5c00b74..74b1d03 100644 --- a/src/components/ollama_model_edit.py +++ b/src/components/ollama_model_edit.py @@ -91,7 +91,7 @@ class OllamaModelEditComponent(AsyncCard): # Basic fields - pre-filled with existing model data ui.input('Model Name', value=model_name, on_change=lambda e: self._on_model_name_change(e.value)).props('outlined dense').classes('w-full').bind_value(self, 'model_name').tooltip('Keep the same name to update the existing model, or change it to create a new model') # ui.label().props('outlined dense').classes('w-full').bind_text_from(self, 'model_from') - ui.input('From', value=model_info['details']['parent_model']).props('outlined dense').classes('w-full').bind_value(self, 'model_from').set_enabled(False) + ui.input('From', value=model_info['details']['parent_model']).props('outlined dense').classes('w-full').bind_value_from(self, 'model_from').set_enabled(False) # System message field (commonly used) ui.textarea('System Message', placeholder='You are a helpful assistant...', value=model_info['system'] if 'system' in model_info else '').classes('w-full').props('autogrow outlined').bind_value(self, 'system_message') @@ -216,13 +216,14 @@ class OllamaModelEditComponent(AsyncCard): ui.icon('info', size='sm').classes('text-gray-500 cursor-help').tooltip(info) async def _on_model_name_change(self, value): - return - if self.model_name != self.model_name_original: - self.model_from = self.model_name_original + print(f'Value({value}) Original({self.model_name_original}) Parent({self.model_info['details']['parent_model']})') + if value == self.model_name_original: + if len(self.model_info['details']['parent_model']) > 0: + self.model_from = self.model_info['details']['parent_model'] + else: + self.model_from = '' else: - self.model_from = '' - if len(self.model_info['details']['parent_model']) > 0: - self.model_from = self.model_info['details']['parent_model'] + self.model_from = self.model_name_original async def load_existing_model(self, model_name): """Load existing model data and populate form fields"""