Coder Social home page Coder Social logo

maxijonson / gpt-turbo Goto Github PK

View Code? Open in Web Editor NEW
49.0 3.0 13.0 2.29 MB

JavaScript library for OpenAI's Chat Completion API. Comes with conversation history management, parameter configuration, callable functions and plugin support!

Home Page: https://gpt-turbo.chintristan.io/

License: MIT License

JavaScript 1.97% TypeScript 86.79% HTML 0.21% CSS 0.84% MDX 10.19%
chatgpt nodejs openai typescript ai bot chat chatbot completion conversation

gpt-turbo's People

Contributors

jjbell150 avatar maxijonson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gpt-turbo's Issues

[Enhancement]: Setup library tests

Scope

Library (gpt-turbo)

Type

New feature

Description

I tried implementing some tests, but because GPT Turbo is ESM only with TypeScript, it's surprisingly very hard to even get started with Jest. Unfortunately, I have very small experience with testing with Jest and it's usually in CommonJS front-end environments, so this setup is totally new to me. I've tried for about a week a bunch of solutions but couldn't get it started...

I'd really appreciate it if someone could just get the tests started. I'm not even asking to write them, I just want the following test (or something like it) to work fine when I npm test. If this works, then I don't mind picking up from there.

The only requirement I have is that tests are in a test folder, separate from the src folder.

// packages/library/test/classes/Conversation.test.ts
import { describe, expect, test } from "@jest/globals";
import { Conversation } from "../../src/classes/Conversation.js"; // notice ESM .js extension
import { DEFAULT_CONTEXT } from "../../src/config/constants.js"; // notice ESM .js extension

describe("Conversation", () => {
    test("creates a Conversation with default parameters", () => {
        const conversation = new Conversation();

        expect(conversation.getMessages()).toHaveLength(0);
        expect(conversation.getMessages(true)).toHaveLength(1);

        const firstMessage = conversation.getMessages(true)[0];
        expect(firstMessage.role).toBe("system");
        expect(firstMessage.content).toBe(DEFAULT_CONTEXT);
    });
});

Notice the use .js extensions to import .ts modules. This is the syntax used across the library, since it's the required import syntax when working with ES Modules. The library simply won't compile without it. Removing the .js extension fixes the issue where Jest is unable to find the module (with .js, since files are actually .ts), but then crashes because these modules are actually importing other modules with .js.

Benefit

Adding tests to the library is crucial as it helps to reinforce the robustness of GPT Turbo. It can also be seen as a good indicator for potential devs willing to work with the library and I believe that it conveys a certain degree of maturity for the project as well.

I rarely add tests to my projects as they are often left unfinished, so I don't want to spend too much time testing something that won't go far enough to be worth the time. In the case of GPT Turbo, I feel like it is in a stable enough state that it can be used in a variety of projects and fulfill its purpose, so it feels right that it gets tested properly.

Participation

Yes

[Enchancement]: Add a save command to the CLI

Type

New feature

Description

It would be great to have a command that would save the current chat history to a timestamped file. As an extension of this, it would be very useful to have a flag that would do this automatically by creating a file on launch, and then append requests and responses to it.

Benefit

One of the main drawbacks of gpt-turbo-cli is that I can't save my chat history, which is a critical feature. It's much nicer to use than other CLIs, so it would be great if this was possible in any form.

Participation

No

Open Source License?

Since this is provided as-is, do you maybe want to add an open-source license so others can pick it up and extend it as needed, as well as make contributions back to your source?

[Enhancement]: Add custom saved prompts

Scope

Web (gpt-turbo-web)

Type

New feature

Description

I'm not sure this is in the scope of this application but would be very nice to be able to save custom prompts and start conversations with them. I have some prompts that I use a lot and ended up storing them in a markdown file and copy-pasting them when needed.

The main points would be:

  • Users should be able to view a list with custom prompts (maybe in a modal?)
  • Users should be able to add/delete/edit custom prompts that they created
  • Users should be able to select a custom prompt from a select input when starting a new conversation
  • Users should not be able to see other users prompts or have any kind of cloud like functionality
  • User prompts should be stored in the user browser (maybe localstorage or something like that) and would be lost when clearing cache (just to avoid all the work of syncing it)

It is a somewhat complex feature so I would definitely understand if you think it shouldn't be added.

Benefit

Users would have easy access to prompts they use a lot when creating a new conversation, making it easy to do repetitive tasks in different conversations (like generating code or translating text)

Participation

Yes

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.