Skip to content

Commit 7ace114

Browse files
committed
fixed configuration name generation
1 parent e62969b commit 7ace114

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

config.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -182,32 +182,35 @@ def generate_default_config_name(self):
182182

183183
print(f"DEBUG: Generated config name: {generated_name}", file=sys.stderr)
184184

185-
# Decide whether to set the config_name variable
186-
# Rule: If the current name is 'default_config' OR if the current name is empty,
187-
# OR if it starts with the model name part (and the model name part exists),
188-
# then replace it with the generated name, but *only* if the generated name is different.
185+
# Always update the config name field with the generated name in real-time
186+
# This provides immediate feedback about what the config represents
189187
current_config_name = self.launcher.config_name.get().strip()
190-
# Use the *actual* model name part used in the generated name
191-
model_name_prefix_in_gen = parts[0] if parts and parts[0] != "default" else ""
192-
193-
194-
update_variable = False
195-
if current_config_name == "default_config":
196-
update_variable = True
197-
elif not current_config_name: # If currently empty
198-
update_variable = True
199-
elif model_name_prefix_in_gen and current_config_name.startswith(model_name_prefix_in_gen):
200-
# Check if the current name is *only* the model name prefix, or starts with it followed by '_'
201-
# This heuristic avoids overwriting names like "modelname_manualedit" if they start with the model name
202-
if current_config_name == model_name_prefix_in_gen or current_config_name.startswith(model_name_prefix_in_gen + "_"):
203-
update_variable = True
204-
205-
206-
if update_variable and generated_name != current_config_name:
188+
print(f"DEBUG: Current config name: '{current_config_name}'", file=sys.stderr)
189+
190+
# Always update except for very specific custom names that don't look auto-generated
191+
should_update = True
192+
193+
# Only preserve if it's a very obviously custom name:
194+
# - Not empty, not "default_config", not "default", not "model"
195+
# - Doesn't contain any auto-gen patterns like _gpu=, _ctx=, _th=, etc.
196+
# - Doesn't start with any model name patterns
197+
# - Must be at least 3 characters and contain letters (to avoid preserving junk)
198+
if (current_config_name and
199+
len(current_config_name) >= 3 and
200+
any(c.isalpha() for c in current_config_name) and
201+
current_config_name not in ["default_config", "default", "model"] and
202+
not any(pattern in current_config_name for pattern in ["_gpu=", "_ctx=", "_temp=", "_batch=", "_threads=", "_th=", "_tb=", "_min_p=", "_seed=", "_n_predict="]) and
203+
not current_config_name.startswith(("default", "model", parts[0] if parts else ""))):
204+
should_update = False
205+
print(f"DEBUG: Detected truly custom name '{current_config_name}', will preserve", file=sys.stderr)
206+
207+
if should_update and generated_name != current_config_name:
207208
self.launcher.config_name.set(generated_name)
208-
print("DEBUG: Updated config_name variable.", file=sys.stderr)
209-
elif not update_variable:
210-
print("DEBUG: Did not update config_name variable as it seems manually set.", file=sys.stderr)
209+
print("DEBUG: Updated config_name variable in real-time.", file=sys.stderr)
210+
elif not should_update:
211+
print("DEBUG: Preserved custom config name.", file=sys.stderr)
212+
else:
213+
print("DEBUG: Generated name same as current, no update needed.", file=sys.stderr)
211214

212215

213216
def update_default_config_name_if_needed(self, *args):
@@ -878,8 +881,10 @@ def save_configuration(self):
878881
"""Saves the current UI settings as a named configuration."""
879882
name = self.launcher.config_name.get().strip()
880883
if not name:
881-
messagebox.showerror("Error", "Please enter a name for the configuration.")
882-
return
884+
# Auto-generate a name based on current settings
885+
suggested_name = self.generate_default_config_name()
886+
self.launcher.config_name.set(suggested_name)
887+
name = suggested_name
883888

884889
current_cfg = self.current_cfg()
885890
self.launcher.saved_configs[name] = current_cfg

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-07-12-0
1+
2025-07-12-1

0 commit comments

Comments
 (0)