GithubHelp home page GithubHelp logo

rahulsushilsharma / huggingface-chat Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 5.0 190 KB

hugging face chat api for JS ๐Ÿค—

License: MIT License

TypeScript 100.00%
ai chat chatbot huggingface js llm ts

huggingface-chat's Introduction

Hello, World! ๐Ÿ‘‹

I'm a coding enthusiast on a mission to create tech magic! ๐Ÿš€

  • ๐Ÿ”ญ Currently crafting amazing projects with LLM tech and vector databases.
  • ๐ŸŒฑ Forever learning and exploring the coding universe.
  • ๐Ÿ‘ฏ Open to collaborations that bring ideas to life.
  • ๐Ÿค” Looking to help fellow coders in need.
  • ๐Ÿ’ฌ Ask me anything tech-related!

โšก Fun fact: Coding + Coffee = My superpowers! โ˜•๐Ÿ’ป

Thanks for stopping by, let's code some magic and build cool stuff together! โœจโœจ

๐Ÿ“ซ Reach me:

Mail GitHub Twitter

huggingface-chat's People

Contributors

rahulsushilsharma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

huggingface-chat's Issues

Package stopped working?

Describe the bug
Package stopped working on June 5. everything was working fine until then. Getting remote conversations works as does everything besides the actual chat is not posting to a conversation. The following code in chat.ts is returning an empty JSON object in response:

    const response = await fetch(
      "https://huggingface.co/chat/conversation/" +
        this.currentConversionID +
        "",
      {
        headers: {
          ...this.headers,
          "content-type": "application/json",
          cookie: this.cookie,
          Referer:
            "https://huggingface.co/chat/conversation/" +
            this.currentConversionID +
            "",
        },
        body: JSON.stringify(data),
        method: "POST",
      }
    );

Desktop (please complete the following information):

  • Chrome

How to use?

I am using in node.js with this code

import("huggingface-chat").then(module => {
const { Login, ChatBot } = module;
const EMAIL = "email";
const PASSWD = "password";
const cachePath = "./login_cache/";

async function main() {
    try {
        const signin = new Login(EMAIL, PASSWD);
        const res = await signin.login(cachePath); // default path is ./login_cache/
        const chat = new ChatBot(res); // res is cookies which is required for subsequent aip calls
        const data = await chat.chat("who am i"); // Default model is "meta-llama/Llama-2-70b-chat-hf"
        
        // Create a reader for the stream
        let reader = data.stream.getReader();

        // Continuously read from the stream until it's done
        while (true) {
            const { done, value } = await reader.read();
            if (done) break; // The streaming has ended.
            console.log(value); // Log each chunk of data from the stream
        }
    } catch (error) {
        console.error("An error occurred:", error);
    }
}

main();

});

It is just generating new chats and nothing else.

Add option for deleting conversations

There is currently no way to delete conversations previously on my account. It would be great to have the option to delete all conversations, and/or to delete one at a time

Parsing issues

Sometimes errors occur when simply streaming

Example:

Error parsing JSON: {"type":"stream","token":"\n"}
{"type":"stream","token":"*"}
{"type":"stream","token":" "}

Do Perplexity

Is your feature request related to a problem? Please describe.
Make one for perplexity

Describe the solution you'd like
They are fast

Describe alternatives you've considered
chat.lmsys.org

Additional context
collab?

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.