Merge branch 'main' into patch-3

This commit is contained in:
zhaowg3 2024-11-04 09:20:53 +08:00
commit 84ac87dcca
3 changed files with 10 additions and 8 deletions

View file

@ -114,9 +114,6 @@ class OpenAILLM(BaseLLM):
elif hasattr(chunk.choices[0], "usage"):
# The usage of some services is an attribute of chunk.choices[0], such as Moonshot
usage = CompletionUsage(**chunk.choices[0].usage)
elif "openrouter.ai" in self.config.base_url and chunk_has_usage:
# due to it get token cost from api
usage = chunk.usage
has_finished = True
log_llm_stream("\n")

View file

@ -81,10 +81,13 @@ async def mermaid_to_file(mermaid_code, output_file_without_suffix, width=2048,
if "svg" in suffixes:
svg_xml = await page.evaluate(
"""() => {
const svg = document.querySelector('svg');
const xmlSerializer = new XMLSerializer();
return xmlSerializer.serializeToString(svg);
}"""
const svg = document.querySelector('svg');
if (!svg) {
throw new Error('SVG element not found');
}
const xmlSerializer = new XMLSerializer();
return xmlSerializer.serializeToString(svg);
}"""
)
logger.info(f"Generating {output_file_without_suffix}.svg..")
with open(f"{output_file_without_suffix}.svg", "wb") as f:

View file

@ -81,4 +81,6 @@ volcengine-python-sdk[ark]~=1.0.94 # Solution for installation error in Windows:
gymnasium==0.29.1
boto3~=1.34.69
spark_ai_python~=0.3.30
agentops
agentops
tree_sitter~=0.23.2
tree_sitter_python~=0.23.2