quarkus-langchain4j icon indicating copy to clipboard operation
quarkus-langchain4j copied to clipboard

Dev UI chat page: support images in messages

Open jmartisk opened this issue 1 year ago • 12 comments

jmartisk avatar Apr 11 '24 06:04 jmartisk

Hm, I'm trying to implement attaching images using the Vaadin upload component and then converting to base64 in the frontend and passing it to a jsonrpc invocation, but I'm hitting some kind of limitation where the websocket for JsonRPC invocations can only handle messages up to 100 kB, anything bigger crashes the websocket :(

@phillip-kruger have you perhaps tried anything similar before?

jmartisk avatar Apr 12 '24 10:04 jmartisk

(For clarity, the intended use case is creating an image-based chat message to pass to gpt-4-turbo or any other model that has computer vision capabilities)

jmartisk avatar Apr 12 '24 10:04 jmartisk

In that case just use normal post, not the ws. You will have to use another comment or build your own

phillip-kruger avatar Apr 12 '24 13:04 phillip-kruger

Yeah that will make things somewhat more complicated because the image will arrive completely independently of the accompanying text message, but I'll give it a try

jmartisk avatar Apr 15 '24 05:04 jmartisk

Shout if I can help

phillip-kruger avatar Apr 15 '24 05:04 phillip-kruger

Hm, I now realize, if I want to add a custom endpoint beyond JSON-RPC (either a REST endpoint or a reactive route) then I have to add some kind of HTTP extension, and we recently removed that to make quarkus-langchain4j suitable for CLI applications :(

jmartisk avatar Apr 17 '24 07:04 jmartisk

This is only for Dev UI. And you have Verx-http in Dev UI

phillip-kruger avatar Apr 17 '24 07:04 phillip-kruger

We don't have that as a dependency of the extension (neither the deployment, nor the runtime artifact). Quarkus apparently brings it in when the user runs dev mode, but we don't have any compile-time dependency on it (when compiling the extension)

jmartisk avatar Apr 17 '24 07:04 jmartisk

Ok I see. Maybe I can add something to the Dev UI to make this possible. How urgent is this ?

phillip-kruger avatar Apr 17 '24 08:04 phillip-kruger

It would be cool to have the ability to post images for demoing on conferences (the first is in the half of May), but even if it doesn't work out I still have enough material to present :)

jmartisk avatar Apr 17 '24 08:04 jmartisk

Simply making the jsonrpc endpoint accept messages over 100 kB isn't possible? I don't know where the limitation is coming from. But lifting it would be the easiest solution.

jmartisk avatar Apr 17 '24 08:04 jmartisk

Yea I am not sure where that comes from. It's not something I set in Dev UI so must be some default of Vertx Web Sockets. If you can find and increase that, go for it !

phillip-kruger avatar Apr 17 '24 08:04 phillip-kruger