Spaces:
Running
Running
fix bug
Browse files
app.py
CHANGED
@@ -37,17 +37,16 @@ def get_template_path(template_name: str, is_new_template: bool = False) -> Path
|
|
37 |
:param is_new_template: Whether it's a new template created by user
|
38 |
:return: Path object for the template file
|
39 |
"""
|
40 |
-
settings_path = Path("metagpt/ext/spo/settings")
|
41 |
|
42 |
if is_new_template:
|
43 |
# Create user-specific subdirectory in settings folder
|
44 |
if "user_id" not in st.session_state:
|
45 |
st.session_state.user_id = str(uuid.uuid4())
|
46 |
-
user_settings_path =
|
47 |
return user_settings_path / f"{template_name}.yaml"
|
48 |
else:
|
49 |
# Use root settings path for existing templates
|
50 |
-
return
|
51 |
|
52 |
def get_all_templates() -> List[str]:
|
53 |
"""
|
@@ -187,7 +186,11 @@ def main():
|
|
187 |
st.header("Template Configuration")
|
188 |
|
189 |
if template_name:
|
190 |
-
|
|
|
|
|
|
|
|
|
191 |
template_data = load_yaml_template(template_path)
|
192 |
|
193 |
if "current_template" not in st.session_state or st.session_state.current_template != template_name:
|
@@ -278,7 +281,7 @@ def main():
|
|
278 |
optimized_path=str(workspace_dir),
|
279 |
initial_round=initial_round,
|
280 |
max_rounds=max_rounds,
|
281 |
-
template=f"{
|
282 |
name=template_name,
|
283 |
)
|
284 |
|
|
|
37 |
:param is_new_template: Whether it's a new template created by user
|
38 |
:return: Path object for the template file
|
39 |
"""
|
|
|
40 |
|
41 |
if is_new_template:
|
42 |
# Create user-specific subdirectory in settings folder
|
43 |
if "user_id" not in st.session_state:
|
44 |
st.session_state.user_id = str(uuid.uuid4())
|
45 |
+
user_settings_path = st.session_state.user_id
|
46 |
return user_settings_path / f"{template_name}.yaml"
|
47 |
else:
|
48 |
# Use root settings path for existing templates
|
49 |
+
return f"{template_name}.yaml"
|
50 |
|
51 |
def get_all_templates() -> List[str]:
|
52 |
"""
|
|
|
186 |
st.header("Template Configuration")
|
187 |
|
188 |
if template_name:
|
189 |
+
template_real_name = get_template_path(template_name, is_new_template)
|
190 |
+
settings_path = Path("metagpt/ext/spo/settings")
|
191 |
+
|
192 |
+
template_path = settings_path / template_real_name
|
193 |
+
|
194 |
template_data = load_yaml_template(template_path)
|
195 |
|
196 |
if "current_template" not in st.session_state or st.session_state.current_template != template_name:
|
|
|
281 |
optimized_path=str(workspace_dir),
|
282 |
initial_round=initial_round,
|
283 |
max_rounds=max_rounds,
|
284 |
+
template=f"{template_real_name}",
|
285 |
name=template_name,
|
286 |
)
|
287 |
|