text-generation-webui icon indicating copy to clipboard operation
text-generation-webui copied to clipboard

Chat API broken by *is typing* messages

Open poisson-fish opened this issue 1 year ago • 8 comments

The API got broken very recently with the addition of the is typing message. Now instead of returning the prompt result, all we get is is typing in the response datas:

{
  "data": [
   [["hello world","<em>Is typing...</em>"]], // first element is the prompt and second is the prompt result
  ],
  "duration": 0.0039386749267578125, // number of seconds to run function call
  "average_duration": 0.0009846687316894531
}

poisson-fish avatar Mar 13 '23 02:03 poisson-fish

Ugh, that's bad.

oobabooga avatar Mar 13 '23 02:03 oobabooga

Yeah, I'm looking into it but there's a lot of stuff to look through so no promises

poisson-fish avatar Mar 13 '23 03:03 poisson-fish

That only affects the API in chat mode, which is not completely supported yet. For instance, you cannot access the chat history or switch characters through the present API.

If you really want to use the chat API nevertheless, you can to it with streaming and discard the initial "Is tying..." message using this:

https://github.com/oobabooga/text-generation-webui/blob/main/api-example-stream.py

oobabooga avatar Mar 13 '23 03:03 oobabooga

Ah gotcha, I'll try the websocket option. Is a slightly more robust dedicated API separate from gradio something that could see a PR acceptance?

poisson-fish avatar Mar 13 '23 03:03 poisson-fish

If you could do it through an extension, that would be great.

oobabooga avatar Mar 13 '23 03:03 oobabooga

Additionally the current example .py don't have all the parameters for the chat API - but as the REST version is broken maybe it's better to make it explicit it doesn't work? Came here to ask for which API endpoint to use to get the now asynchronous response :/

troed avatar Mar 14 '23 14:03 troed

I have removed the chat API for now to avoid further confusion https://github.com/oobabooga/text-generation-webui/commit/72d207c0980232db287f9ce89ec4dd3b032465e5

oobabooga avatar Mar 14 '23 19:03 oobabooga

Also curious what the best course of action is to get a nice API with chat stuff. I'm guessing its just not finished yet/official?

angelfor3v3r avatar Mar 15 '23 00:03 angelfor3v3r