添加doubao-seed-2-0-code
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
import json
|
||||
import re
|
||||
|
||||
transcript_path = r"C:\Users\Kimber Xu\.gemini\antigravity-ide\brain\ef230fd3-39a1-47f8-aa16-4969fb505243\.system_generated\logs\transcript.jsonl"
|
||||
file_path = r"d:\PyCharm_projects\litellm-config\volc_limit_sync.py"
|
||||
|
||||
lines_dict = {}
|
||||
|
||||
with open(transcript_path, "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
try:
|
||||
step = json.loads(line)
|
||||
if step.get("type") == "SYSTEM_RESPONSE":
|
||||
content = step.get("content", "")
|
||||
if "File Path: `file:///d:/PyCharm_projects/litellm-config/volc_limit_sync.py`" in content:
|
||||
# Extract lines
|
||||
for match in re.finditer(r"^(\d+):\s(.*)$", content, re.MULTILINE):
|
||||
line_num = int(match.group(1))
|
||||
line_text = match.group(2)
|
||||
lines_dict[line_num] = line_text
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if lines_dict:
|
||||
max_line = max(lines_dict.keys())
|
||||
with open(file_path, "w", encoding="utf-8") as f:
|
||||
for i in range(1, max_line + 1):
|
||||
if i in lines_dict:
|
||||
f.write(lines_dict[i] + "\n")
|
||||
else:
|
||||
f.write("\n")
|
||||
print(f"Recovered {max_line} lines to {file_path}")
|
||||
else:
|
||||
print("Failed to find lines in transcript.")
|
||||
Reference in New Issue
Block a user