Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

remove legacy prompt logging

Abi Raja0d5b355f9e80
diff --git a/backend/fs_logging/core.py b/backend/fs_logging/core.py
deleted file mode 100644
index e89096f4..00000000
--- a/backend/fs_logging/core.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from datetime import datetime
-import json
-import os
-from openai.types.chat import ChatCompletionMessageParam
-
-
-def write_logs(prompt_messages: list[ChatCompletionMessageParam], completion: str):
- # Get the logs path from environment, default to the current working directory
- logs_path = os.environ.get("LOGS_PATH", os.getcwd())
-
- # Create run_logs directory if it doesn't exist within the specified logs path
- logs_directory = os.path.join(logs_path, "run_logs")
- if not os.path.exists(logs_directory):
- os.makedirs(logs_directory)
-
- print("Writing to logs directory:", logs_directory)
-
- # Generate a unique filename using the current timestamp within the logs directory
- filename = datetime.now().strftime(f"{logs_directory}/messages_%Y%m%d_%H%M%S.json")
-
- # Write the messages dict into a new file for each run
- with open(filename, "w") as f:
- f.write(json.dumps({"prompt": prompt_messages, "completion": completion}))
diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py
index 86e4d011..60e00967 100644
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@ -6,7 +6,6 @@ from typing import Callable, Awaitable
from fastapi import APIRouter, WebSocket
import openai
from websockets.exceptions import ConnectionClosedOK, ConnectionClosedError
-from codegen.utils import extract_html_content
from config import (
ANTHROPIC_API_KEY,
GEMINI_API_KEY,
@@ -22,7 +21,6 @@ from custom_types import InputMode
from llm import (
Llm,
)
-from fs_logging.core import write_logs
from typing import (
Any,
Callable,
@@ -500,20 +498,10 @@ class PostProcessingStage:
async def process_completions(
self,
completions: List[str],
- prompt_messages: List[ChatCompletionMessageParam],
websocket: WebSocket,
) -> None:
- """Process completions and perform cleanup"""
- # Only process non-empty completions
- valid_completions = [comp for comp in completions if comp]
-
- # Write the first valid completion to logs for debugging
- if valid_completions:
- # Strip the completion of everything except the HTML content
- html_content = extract_html_content(valid_completions[0])
- write_logs(prompt_messages, html_content)
-
- # Note: WebSocket closing is handled by the caller
+ """Process completions and perform cleanup."""
+ return None
class AgenticGenerationStage:
@@ -815,7 +803,7 @@ class PostProcessingMiddleware(Middleware):
) -> None:
post_processor = PostProcessingStage()
await post_processor.process_completions(
- context.completions, context.prompt_messages, context.websocket
+ context.completions, context.websocket
)
await next_func()