Spestly commited on
Commit
3430be2
·
verified ·
1 Parent(s): 5347166

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -114,10 +114,16 @@ class AtlasInferenceApp:
114
  return "⚠️ Please select and load a model first"
115
 
116
  try:
117
- # Get the system prompt for the current model
118
- system_prompt = st.session_state.current_model["config"]["system_prompt"]
 
 
 
119
  if not system_prompt:
120
- return "⚠️ System prompt not found for the selected model."
 
 
 
121
 
122
  # Add the system instruction to guide the model's behavior
123
  prompt = f"{system_prompt}\n\n### Instruction:\n{message}\n\n### Response:"
 
114
  return "⚠️ Please select and load a model first"
115
 
116
  try:
117
+ # Debugging: Check if config and system_prompt exist
118
+ if "config" not in st.session_state.current_model:
119
+ return "⚠️ Model configuration not found. Please load the model again."
120
+
121
+ system_prompt = st.session_state.current_model["config"].get("system_prompt", "Default system prompt")
122
  if not system_prompt:
123
+ system_prompt = "Default system prompt" # Fallback if system_prompt is None
124
+
125
+ # Debugging: Print the system prompt for verification
126
+ st.write(f"System Prompt: {system_prompt}")
127
 
128
  # Add the system instruction to guide the model's behavior
129
  prompt = f"{system_prompt}\n\n### Instruction:\n{message}\n\n### Response:"