fixed update model logic
This commit is contained in:
@@ -74,15 +74,11 @@ class OllamaModelEditComponent(AsyncCard):
|
|||||||
|
|
||||||
async def build(self, model_name: str, model_info: dict) -> None:
|
async def build(self, model_name: str, model_info: dict) -> None:
|
||||||
self.classes('w-full')
|
self.classes('w-full')
|
||||||
|
self.model_name = model_name
|
||||||
self.model_name_original = model_name
|
self.model_name_original = model_name
|
||||||
|
self.model_info = model_info
|
||||||
|
|
||||||
model_parameters = ollama.model_parameters(model_info)
|
model_parameters = ollama.model_parameters(model_info)
|
||||||
print(model_parameters)
|
|
||||||
|
|
||||||
# pprint(model_info)
|
|
||||||
# Always load the existing model data
|
|
||||||
self.model_name = model_name
|
|
||||||
# await self.load_existing_model(model_name)
|
|
||||||
|
|
||||||
with self:
|
with self:
|
||||||
with ui.column().classes('w-full gap-2'):
|
with ui.column().classes('w-full gap-2'):
|
||||||
@@ -211,12 +207,10 @@ class OllamaModelEditComponent(AsyncCard):
|
|||||||
ui.switch().bind_value(self, switch_binding).props('dense').set_value(value is not None)
|
ui.switch().bind_value(self, switch_binding).props('dense').set_value(value is not None)
|
||||||
ui.label(label).classes('min-w-fit')
|
ui.label(label).classes('min-w-fit')
|
||||||
ui.slider(min=value_min, max=value_max, step=value_step, value=value if value else value_default).classes('flex-1').props('dense').bind_value(self, value_binding).bind_enabled_from(self, switch_binding)
|
ui.slider(min=value_min, max=value_max, step=value_step, value=value if value else value_default).classes('flex-1').props('dense').bind_value(self, value_binding).bind_enabled_from(self, switch_binding)
|
||||||
# TODO backward
|
|
||||||
ui.label().bind_text_from(self, value_binding, backward=backward).classes('text-xs text-gray-500 min-w-fit')
|
ui.label().bind_text_from(self, value_binding, backward=backward).classes('text-xs text-gray-500 min-w-fit')
|
||||||
ui.icon('info', size='sm').classes('text-gray-500 cursor-help').tooltip(info)
|
ui.icon('info', size='sm').classes('text-gray-500 cursor-help').tooltip(info)
|
||||||
|
|
||||||
async def _on_model_name_change(self, value):
|
async def _on_model_name_change(self, value):
|
||||||
print(f'Value({value}) Original({self.model_name_original}) Parent({self.model_info['details']['parent_model']})')
|
|
||||||
if value == self.model_name_original:
|
if value == self.model_name_original:
|
||||||
if len(self.model_info['details']['parent_model']) > 0:
|
if len(self.model_info['details']['parent_model']) > 0:
|
||||||
self.model_from = self.model_info['details']['parent_model']
|
self.model_from = self.model_info['details']['parent_model']
|
||||||
|
|||||||
Reference in New Issue
Block a user