mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 19:37:47 +01:00
refac: code interpreter
This commit is contained in:
@@ -1704,10 +1704,12 @@ async def process_chat_response(
|
|||||||
"stdout": "Code interpreter engine not configured."
|
"stdout": "Code interpreter engine not configured."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug(f"Code interpreter output: {output}")
|
||||||
|
|
||||||
if isinstance(output, dict):
|
if isinstance(output, dict):
|
||||||
stdout = output.get("stdout", "")
|
stdout = output.get("stdout", "")
|
||||||
|
|
||||||
if stdout:
|
if isinstance(stdout, str):
|
||||||
stdoutLines = stdout.split("\n")
|
stdoutLines = stdout.split("\n")
|
||||||
for idx, line in enumerate(stdoutLines):
|
for idx, line in enumerate(stdoutLines):
|
||||||
if "data:image/png;base64" in line:
|
if "data:image/png;base64" in line:
|
||||||
@@ -1739,7 +1741,7 @@ async def process_chat_response(
|
|||||||
|
|
||||||
result = output.get("result", "")
|
result = output.get("result", "")
|
||||||
|
|
||||||
if result:
|
if isinstance(result, str):
|
||||||
resultLines = result.split("\n")
|
resultLines = result.split("\n")
|
||||||
for idx, line in enumerate(resultLines):
|
for idx, line in enumerate(resultLines):
|
||||||
if "data:image/png;base64" in line:
|
if "data:image/png;base64" in line:
|
||||||
@@ -1789,6 +1791,8 @@ async def process_chat_response(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print(content_blocks, serialize_content_blocks(content_blocks))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = await generate_chat_completion(
|
res = await generate_chat_completion(
|
||||||
request,
|
request,
|
||||||
|
|||||||
Reference in New Issue
Block a user