Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
59ab3d7
1
Parent(s):
a80a131
lfg
Browse files
src/routes/code_routes.py
CHANGED
|
@@ -744,6 +744,10 @@ async def fix_code(
|
|
| 744 |
app_state = request.app.state
|
| 745 |
session_state = app_state.get_session_state(session_id)
|
| 746 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 747 |
# Get dataset context
|
| 748 |
dataset_context = get_dataset_context(session_state["datasets"])
|
| 749 |
|
|
@@ -756,13 +760,15 @@ async def fix_code(
|
|
| 756 |
)
|
| 757 |
|
| 758 |
fixed_code = format_code_block(fixed_code)
|
|
|
|
|
|
|
| 759 |
|
| 760 |
return {
|
| 761 |
"fixed_code": fixed_code,
|
| 762 |
}
|
| 763 |
except Exception as e:
|
| 764 |
# Fallback if DSPy models are not initialized or there's an error
|
| 765 |
-
logger.log_message(f"Error with DSPy models: {str(e)}", level=logging.ERROR)
|
| 766 |
|
| 767 |
# Return a helpful error message that doesn't expose implementation details
|
| 768 |
return {
|
|
|
|
| 744 |
app_state = request.app.state
|
| 745 |
session_state = app_state.get_session_state(session_id)
|
| 746 |
|
| 747 |
+
# Get the user_id from session state if available (for logging/tracking)
|
| 748 |
+
user_id = session_state.get("user_id")
|
| 749 |
+
logger.log_message(f"Code fix request from user_id: {user_id}, session_id: {session_id}", level=logging.INFO)
|
| 750 |
+
|
| 751 |
# Get dataset context
|
| 752 |
dataset_context = get_dataset_context(session_state["datasets"])
|
| 753 |
|
|
|
|
| 760 |
)
|
| 761 |
|
| 762 |
fixed_code = format_code_block(fixed_code)
|
| 763 |
+
|
| 764 |
+
logger.log_message(f"Code fix completed successfully for user_id: {user_id}", level=logging.INFO)
|
| 765 |
|
| 766 |
return {
|
| 767 |
"fixed_code": fixed_code,
|
| 768 |
}
|
| 769 |
except Exception as e:
|
| 770 |
# Fallback if DSPy models are not initialized or there's an error
|
| 771 |
+
logger.log_message(f"Error with DSPy models for user_id {user_id}: {str(e)}", level=logging.ERROR)
|
| 772 |
|
| 773 |
# Return a helpful error message that doesn't expose implementation details
|
| 774 |
return {
|