forked from phoenix-oss/llama-stack-mirror
fix memory url parsing (#81)
This commit is contained in:
parent
132f9429b1
commit
59af1c8fec
1 changed files with 9 additions and 0 deletions
|
@ -102,6 +102,15 @@ async def content_from_doc(doc: MemoryBankDocument) -> str:
|
|||
r = await client.get(doc.content.uri)
|
||||
return r.text
|
||||
|
||||
pattern = re.compile("^(https?://|file://|data:)")
|
||||
if pattern.match(doc.content):
|
||||
if doc.content.startswith("data:"):
|
||||
return content_from_data(doc.content)
|
||||
else:
|
||||
async with httpx.AsyncClient() as client:
|
||||
r = await client.get(doc.content)
|
||||
return r.text
|
||||
|
||||
return interleaved_text_media_as_str(doc.content)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue