Skip to content

Commit 44a38ff

Browse files
committed
fix(log): less verbose
1 parent de2200c commit 44a38ff

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

ai/analyzer.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,6 @@ def _process_file_sync(
203203
failed_count = 0
204204
for idx, chunk_doc, future, embedding_start_time in embedding_futures:
205205
try:
206-
# Check if request is already slow before waiting for result
207-
elapsed_before_result = time.time() - embedding_start_time
208-
if elapsed_before_result > 3.0:
209-
logger.warning(f"Embedding API request taking too long for {rel_path} chunk {idx}: {elapsed_before_result:.2f}s elapsed, still waiting for response...")
210-
211206
emb = future.result(timeout=EMBEDDING_TIMEOUT) # Add timeout to prevent hanging indefinitely
212207
embedding_duration = time.time() - embedding_start_time
213208

ai/openai.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,18 @@ def embed_text(self, text: str, file_path: str = "<unknown>", chunk_index: int =
307307
elapsed = time.perf_counter() - start
308308
err_msg = f"Timeout after {elapsed:.2f}s: {e}"
309309

310-
# Generate curl command for debugging
311-
curl_command = self._generate_curl_command(self.api_url, dict(self.session.headers), payload)
312-
313310
# Save to bash script in /tmp if DEBUG is enabled
314311
script_path = None
315312
if CFG.get("debug"):
313+
# Generate curl command for debugging
314+
curl_command = self._generate_curl_command(self.api_url, dict(self.session.headers), payload)
316315
script_path = self._save_curl_script(curl_command, request_id, file_path, chunk_index)
316+
if script_path:
317+
_embedding_logger.error(f"\nDebug script saved to: {script_path}")
318+
_embedding_logger.error(f"Run with: bash {script_path}")
319+
else:
320+
_embedding_logger.error(f"\nDebug with this curl command:")
321+
_embedding_logger.error(curl_command)
317322

318323
_embedding_logger.error(
319324
"Embedding API Timeout",
@@ -326,18 +331,6 @@ def embed_text(self, text: str, file_path: str = "<unknown>", chunk_index: int =
326331
}
327332
)
328333

329-
# Print to console for easy debugging
330-
print(f"\n{'='*80}")
331-
print(f"Embedding request timed out after {elapsed:.2f}s")
332-
print(f"Request ID: {request_id}")
333-
print(f"File: {file_path}, Chunk: {chunk_index}")
334-
if script_path:
335-
print(f"\nDebug script saved to: {script_path}")
336-
print(f"Run with: bash {script_path}")
337-
else:
338-
print(f"\nDebug with this curl command:")
339-
print(curl_command)
340-
print(f"{'='*80}\n")
341334
except requests.RequestException as e:
342335
elapsed = time.perf_counter() - start
343336
err_msg = f"RequestException after {elapsed:.2f}s: {e}\n{traceback.format_exc()}"

main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ async def lifespan(app: FastAPI):
9191
os.unlink(tmp_db_path)
9292
except Exception:
9393
pass
94+
95+
if CFG.get("debug"):
96+
logger.info("✓ debug enabled")
97+
9498
except Exception as e:
9599
logger.error(f"FATAL: Failed to load sqlite-vector extension at startup: {e}")
96100
# Force immediate exit - cannot continue without vector extension

0 commit comments

Comments
 (0)