-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] Assistant websearch text/markdown source #1129
Conversation
8bedc94
to
b2bee62
Compare
@@ -32,7 +32,9 @@ export async function parseWeb(url: string) { | |||
r.headers.get("content-type")?.includes("text/plain") || | |||
r.headers.get("content-type")?.includes("text/markdown") | |||
) { | |||
return r.text(); | |||
const text = await r.text(); | |||
// JSON.stringify is needed to turn string concatenation into a single string (ex: "Hello, " + "world!" -> "Hello, world!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> JSON.stringify('"Hello, " + "world!"')
'"\\"Hello, \\" + \\"world!\\""'
It doesn't give "Hello, world!"
Not sure I understand where the concat happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example:
const text = await r.text();
console.log({text})
// {text: "Hello " + "world"}
and TEI endpoint was failing with Invalid json
let text = r.text();
text = JSON.stringify(text)
console.log({text})
// {text: "Hello world"}
TEI endpoint works fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will let @nsarrazin review I don't understand it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, seems to fix the issue
Description
When you combine assistant websearch with TEI, there was an error. (However, it was/is working fine with local models through transformers.js).
Although we have
chat-ui/src/lib/server/embeddingEndpoints/tei/embeddingEndpoints.ts
Line 63 in b2bee62
invalid json
) when a text value was a text concat value (i.e. rather than"Hello World"
, the actual value was"Hello " + "World"
). Therefore, we needed to addchat-ui/src/lib/server/websearch/parseWeb.ts
Lines 35 to 37 in b2bee62
on main
this PR