Skip to content

Commit 619dc43

Browse files
committed
fix get_file_modifications detection issue
1 parent 39f9519 commit 619dc43

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/codeinterpreterapi/chains/modifications_check.py

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ def get_file_modifications(
1919
result = llm.invoke(prompt)
2020

2121
try:
22+
if isinstance(result.content, str):
23+
if result.content.endswith("```"):
24+
result.content = result.content[:-3]
25+
if result.content.startswith("```"):
26+
result.content = result.content[3:]
2227
result = json.loads(result.content)
2328
except json.JSONDecodeError:
2429
result = ""
@@ -40,6 +45,11 @@ async def aget_file_modifications(
4045
result = await llm.ainvoke(prompt)
4146

4247
try:
48+
if isinstance(result.content, str):
49+
if result.content.endswith("```"):
50+
result.content = result.content[:-3]
51+
if result.content.startswith("```"):
52+
result.content = result.content[3:]
4353
result = json.loads(result.content)
4454
except json.JSONDecodeError:
4555
result = ""

0 commit comments

Comments
 (0)