wip: snapshot das alterações não commitadas (2026-10-20)
Origem: D:/Documents/Github/HealthTracking Arquivos omitidos (segredos, bancos de dados, logs, >50 MB): 1
This commit is contained in:
1 parent
8bce19c448
commit
86a4949751
4 files changed
+421
No files matched your search
@@ -0,0 +1,42 @@
|
||||
"""Debug mcp.json by counting braces"""
|
||||
import sys
|
||||
|
||||
with open('C:/Users/Evandro/.pi/agent/mcp.json', 'rb') as f:
|
||||
raw = f.read().decode('utf-8')
|
||||
|
||||
# Count braces not in strings
|
||||
depth = 0
|
||||
in_string = False
|
||||
escape = False
|
||||
for i, c in enumerate(raw):
|
||||
if escape:
|
||||
escape = False
|
||||
continue
|
||||
if c == '\\':
|
||||
escape = True
|
||||
continue
|
||||
if c == '"':
|
||||
in_string = not in_string
|
||||
continue
|
||||
if in_string:
|
||||
continue
|
||||
if c == '{':
|
||||
depth += 1
|
||||
elif c == '}':
|
||||
depth -= 1
|
||||
|
||||
print(f'Final depth: {depth}')
|
||||
# Find chrome-devtools and check if its block is properly closed
|
||||
idx_cd = raw.find('"chrome-devtools"')
|
||||
print(f'chrome-devtools at: {idx_cd}')
|
||||
# Show the block from chrome-devtools
|
||||
end = raw.find('"id": "speaches"', 0)
|
||||
if end == -1:
|
||||
end = len(raw)
|
||||
# Find where the whisper block ENDS
|
||||
idx_w = raw.find('"whisper"')
|
||||
print(f'whisper at: {idx_w}')
|
||||
# Show lines around line 140
|
||||
lines = raw.split('\n')
|
||||
for i in range(max(0, 135), min(len(lines), len(lines))):
|
||||
print(f'{i+1}: {lines[i]}')
|
||||
@@ -0,0 +1,64 @@
|
||||
"""Just rewrite the mcp.json cleanly with the new whisper path"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
path = 'C:/Users/Evandro/.pi/agent/mcp.json'
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
raw = f.read()
|
||||
|
||||
# Find the whisper block
|
||||
start_marker = '"whisper": {'
|
||||
start_idx = raw.find(start_marker)
|
||||
if start_idx == -1:
|
||||
print("Not found")
|
||||
sys.exit(1)
|
||||
|
||||
# Find the matching closing brace
|
||||
depth = 0
|
||||
i = start_idx + len(start_marker) - 1
|
||||
in_string = False
|
||||
escape = False
|
||||
while i < len(raw):
|
||||
c = raw[i]
|
||||
if escape:
|
||||
escape = False
|
||||
i += 1
|
||||
continue
|
||||
if c == chr(92): # backslash
|
||||
escape = True
|
||||
i += 1
|
||||
continue
|
||||
if c == '"':
|
||||
in_string = not in_string
|
||||
i += 1
|
||||
continue
|
||||
if in_string:
|
||||
i += 1
|
||||
continue
|
||||
if c == '{':
|
||||
depth += 1
|
||||
elif c == '}':
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
end_idx = i + 1
|
||||
break
|
||||
i += 1
|
||||
else:
|
||||
print("No matching close brace found")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"start={start_idx}, end={end_idx}")
|
||||
new_whisper = '"whisper": {\n "command": "C:\\\\Users\\\\Evandro\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python312\\\\python.exe",\n "args": [\n "D:/Documents/GitHub/whisper-mcp/server.py"\n ],\n "description": "Whisper transcription via local Speaches/Whisper (faster-whisper-large-v3-turbo). v2.0 with SSRF guard, size limit, retry, structured errors.",\n "timeout": 180,\n "lifecycle": "lazy",\n "idleTimeout": 10,\n "directTools": true,\n "environment": {\n "WHISPER_BASE_URL": "http://localhost:8000",\n "WHISPER_MODEL": "deepdml/faster-whisper-large-v3-turbo-ct2",\n "WHISPER_TIMEOUT": "120",\n "WHISPER_MAX_BYTES": "26214400"\n }\n }'
|
||||
new_raw = raw[:start_idx] + new_whisper + raw[end_idx:]
|
||||
try:
|
||||
parsed = json.loads(new_raw)
|
||||
print("JSON valid")
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_raw)
|
||||
print("Saved")
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Still invalid: {e}")
|
||||
start = max(0, e.pos - 100)
|
||||
end = min(len(new_raw), e.pos + 100)
|
||||
print(f"Context: {new_raw[start:end]!r}")
|
||||
Reference in new issue
Block a user