3 ms·
This doesn't actually cover the most important part, which is where the response to a chat shows up. Has anyone figured this out? I only looked briefly, but AFA
by chatmasta 4y ago
This doesn't actually cover the most important part, which is where the response to a chat shows up. Has anyone figured this out? I only looked briefly, but AFAICT, it doesn't show up in the response data in Chrome or Firefox DevTools. I figured it was maybe using WebSockets or Server Sent Events, which apparently don't show up in DevTools in some cases (?). I think this is a Chrome bug [0] [1] and also a Firefox bug [2].
EDIT: It's using EventSource. If you open the debugger and Cmd+Shift+F for `onmessage`, you'll find where it receives the message, and you can add a breakpoint, which you can then right click and change to a logpoint, to log the contents of the message. There is probably a one-liner you could paste into devtools to do some prototype hacking of window.EventSource, but I don't have time to figure that out atm, and can't find anything in a few quick searches of GitHub code.
EDIT EDIT: Just tried Safari, it does indeed show up as a spinner, but I still can't see the actual messages in DevTools.
[0] https://github.com/Yaffle/EventSource/issues/79 https://github.com/Yaffle/EventSource/issues/79
[1] https://bugs.chromium.org/p/chromium/issues/detail?id=1025893 https://bugs.chromium.org/p/chromium/issues/detail?id=102589...
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1405706 https://bugzilla.mozilla.org/show_bug.cgi?id=1405706
- marpstar 4y agoShows up in Safari as Content-Type: text/event-stream on the https://chat.openai.com/backend-api/conversation https://chat.openai.com/backend-api/conversation endpoint. You can see the network call spin while the text loads. edit: added name of endpoint.
- codetrotter 4y agoThe URL you linked says {"detail":"Method Not Allowed"} When I click on it
- Semaphor 4y agoYou aren’t supposed to click on it, that won’t work. It’s the endpoint that’s showing up in the network tab.
- 1xdevloper 4y agoClicking it won't do anything. It's a POST request endpoint so you also have to provide the auth token and input.
- 1xdevloper 4y agoProbably because they're using a polyfill[0][1] to handle the event stream. [0] https://stackoverflow.com/questions/55201372/event-stream-data-not-showing-in-chrome-console https://stackoverflow.com/questions/55201372/event-stream-da... [1] https://github.com/EventSource/eventsource/issues/94 https://github.com/EventSource/eventsource/issues/94
- black3r 4y agoAnd that's because the native EventStream API only supports GET requests, so if you want to use a POST request (which make more sense in this context) you have to use a custom implementation...
- qqqturing2 4y agothey are using Server Side Events (SSE) to stream the text. see API docs: https://platform.openai.com/docs/api-reference/chat/create https://platform.openai.com/docs/api-reference/chat/create > If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. See the OpenAI Cookbook for example code.
- czx4f4bd 4y agoInteresting. Apparently server-sent events show up in devtools under the network tab as multiple responses sent for the same request. https://firefox-source-docs.mozilla.org/devtools-user/network_monitor/inspecting_server-sent_events/index.html https://firefox-source-docs.mozilla.org/devtools-user/networ... https://stackoverflow.com/a/46075339/6417784 https://stackoverflow.com/a/46075339/6417784
- tercmd 4y ago(Creator of the repo here) That is somewhat present in the `/backend-api/moderations` endpoint where the app sends your question + ChatGPT's response to (first time just your question, second time both)