GithubHelp home page GithubHelp logo

Comments (1)

dosubot avatar dosubot commented on May 23, 2024 2

πŸ€–

Hello @thatmarcboi! I'm Dosu, a friendly bot designed to assist you with your queries, bugs, and more while we wait for a human maintainer to join us. I'm here to help make your experience with our repository as smooth as possible. Looking forward to assisting you!

Based on the information I found, the current version of the gpt4-pdf-chatbot-langchain codebase does not support text streaming functionality similar to chat.openai.com. The code handles HTTP POST requests and responds with a single response for each request. It does not maintain a persistent connection for streaming responses. You can refer to the relevant code in the pages/api/chat.ts file.

However, there is a similar solved issue in the repository, Unable to stream response, where the user was directed to a fork of the project by groovybits, which still has the streaming functionality. You might find this fork useful.

Additionally, the gpt4-pdf-chatbot-langchain project includes a library that can be used to implement text streaming functionality. The library is "@microsoft/fetch-event-source". This library is a polyfill for the EventSource API (also known as Server-Sent Events), which can be used to stream text data from a server to a client. You can refer to the package.json file for more details.

Here is a basic example of how you might use it:

import { FetchEventSource } from '@microsoft/fetch-event-source';

const eventSource = new FetchEventSource('https://example.com/stream');

eventSource.onmessage = (event) => {
  console.log(event.data);
};

eventSource.onerror = (error) => {
  console.error('An error occurred:', error);
};

In this example, 'https://example.com/stream' would be the URL of your server-side endpoint that sends the text stream. The onmessage event handler is called whenever a new piece of data is received from the stream, and the onerror event handler is called if an error occurs.

I hope this information is helpful. If you have any other questions or need further clarification, feel free to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a πŸ‘ if this is helpful and πŸ‘Ž if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from gpt4-pdf-chatbot-langchain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.