Code Monkey home page Code Monkey logo

zaki-1052 / gptportal Goto Github PK

View Code? Open in Web Editor NEW
256.0 4.0 55.0 48.48 MB

A feature-rich portal to chat with GPT-4, Claude, Gemini, Mistral, & OpenAI Assistant APIs via a lightweight Node.js web app; supports customizable multimodality for voice, images, & files.

Home Page: http://localhost:3000/portal

License: MIT License

CSS 12.18% HTML 24.38% JavaScript 60.07% Python 3.37%
ai api generative-ai gpt gpt-4 javascript openai tts-api whisper-ai chatbot chatgpt node-js gemini-api mistral-api gpt-4-api claude-api assistants-api self-hosted

gptportal's Introduction

ChatBot Portal for Multi-Modal LLM APIs

Welcome to my Chat-Bot Portal, a full-featured Node.js-based web application that allows users to interact with a chatbot powered by OpenAI's GPT-4 API, including the latest Vision, Hearing, and Speaking capabilities with image-generation, file uploads, and superior Model Performance from advanced and editable Custom Instructions in the System Prompt.

GPTPortal now supports the Anthropic Claude and Mistral AI models, plus Google Gemini via free API. It also includes a native Code Environment via Assistants Mode to reuse files and instructions from OpenAI's Beta API! Explore all the additional features added, like customizable Chat History, Prompt Templates, easy Setup, and many more API Providers.

Table of Contents

Features

  • Interactive chat interface with support for text messages.
  • Voice Conversations via Whisper transcriptions and spoken responses.
  • Image Upload functionality for visual context in discussions.
  • Server-side integration with SEVEN AI API providers and counting.
  • Basic authentication for secure access.
  • Customizable System-Defined Instructions and Model Parameters.
  • Simple and intuitive UI with copy-to-clipboard features.
  • Markdown rendering for chat messages in Marked styles.
  • Export as HTML button for conversation history.
  • Integrated shutdown functionality at "Bye!"
  • Image Generation with DALL·E 3 at "Generate:".
  • File Uploads via manual concatenation for large texts.
  • Assistants API Mode for reusable files and custom instructions.
    • Includes Automatic Python Execution in stateful Jupyter Environment.
    • Retrieval Augmented Generation of uploaded files.
  • New Anthropic Claude, Google Gemini, & Mistral Models.
  • Keyboard Shortcuts to control various ChatGPT-like functions.
  • Editable Custom Instructions via a frontend UI.
  • Prompt Templates for the System via Sidebar.
  • Conversation History with optimized context windows.
  • Automatic Token-Cost Calculations and Summaries.
  • Model Selector of various LLM APIs. Includes:
    • GPT-4: EVERY GPT Model Release
      • Includes 4o, Turbo, old v4, 3.5, etc.
    • Gemini: ALL Google Gemini Models
      • Includes Gemini-Pro and Flash
    • Claude Opus-Instant:
      • Seven New Anthropic High Performance Models
    • Mistral: Tiny-Medium
      • Six New Mistral AI Models
        • Intelligence Varies by Size
        • A Description can be found under Mistral AI Setup.
    • LLaMA-3: FREE Llama Models via Qroq
    • Open Router: ANY Other Models you can imagine!

// TODO: Rewrite Documentation

IMPORTANT: To view the old documentation (which is still applicable to v2), please see the Old Documentation Here.

Model Pricing Table

Model Input Cost per Million Tokens Output Cost per Million Tokens
gpt-4 $30.00 $60.00
gpt-4-turbo $10.00 $30.00
gpt-4o $5.00 $15.00
gpt-4o-mini $0.15 $0.60
gpt-3.5-turbo-0125 $0.50 $1.50
claude-3-5-sonnet-20240620 $3.00 $15.00
claude-3-sonnet-20240229 $3.00 $15.00
claude-3-opus-20240229 $15.00 $75.00
claude-3-haiku-20240307 $0.25 $1.25
claude-2.1 $8.00 $24.00
claude-2.0 $8.00 $24.00
claude-instant-1.2 $0.80 $2.40
open-mistral-7b $0.25 $0.25
open-mixtral-8x7b $0.70 $0.70
open-mixtral-8x22b $2.00 $6.00
mistral-small-2402 $1.00 $3.00
codestral-2405 $1.00 $3.00
mistral-medium-2312 $2.70 $8.10
mistral-large-2402 $4.00 $12.00
open-mistral-nemo $0.30 $0.30
open-codestral-mamba $0.25 $0.25

Free Models

The following models have no cost for input or output tokens:

  • gemini-pro
  • gemini-pro-vision
  • gemini-1.5-pro
  • gemini-1.5-flash
  • llama3-70b-8192
  • llama3-8b-8192
  • gemma-7b-it
  • mixtral-8x7b-32768

gptportal's People

Contributors

dependabot[bot] avatar fariszr avatar zaki-1052 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  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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gptportal's Issues

App is hard-coded to use http://localhost:3000

Hey I'm running this behind a cloudflared tunnel, and I'm getting a 401 unauthorized when sending any message, however trying the service locally on the same server works fine.

Is there a way to enable a debug mode to see what the issue is?

The issue is that the app is just hardcoded to use http://localhost for everything internal.

The application goes into a redirect loop

with all default settings, freshly cloned repo, the app goes into redirect loop after logging in.

Screenshot 2024-04-06 at 22 49 57

Environment:

  • macOS: Sonoma 14.3.1 (23D60)
  • node version: v20.12.1
  • Browser: firefox and safari
  • commit: 5bb59c3

Issues on fresh debian 12 installation (ReferenceError: Cannot access 'app' before initialization and redirect loop)

Hello, I just cloned the repo in a fresh Debian 12 container with node v21.7.3.

upon running npm run start i got the following error:

> [email protected] start
> node server.js

/home/user/GPTPortal/server.js:12
app.use(bodyParser.json({ limit: '50mb' }));
^

ReferenceError: Cannot access 'app' before initialization
    at Object.<anonymous> (/home/giorgio/GPTPortal/server.js:12:1)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
    at node:internal/main/run_main_module:28:49

Which i solved by rearranging some lines in the server.js file:

// importing required node packages
require('dotenv').config();
const express = require('express');
const axios = require('axios');
const basicAuth = require('express-basic-auth');
const fs = require('fs');
const { marked } = require('marked');
const bodyParser = require('body-parser');
const app = express(); // Move this line up here
const download = require('image-downloader');
const cors = require('cors');
// Increase the limit for JSON bodies
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true, parameterLimit: 50000 }));
app.use(express.json()); // for parsing application/json
app.use(express.static('public')); // Serves your static files from 'public' directory
app.use(cors());
const router = express.Router();
const { v4: uuidv4 } = require('uuid');

// openai
const OpenAI = require('openai').default;
// <other code remains the same>

However, when i try to access the application from the network: http://<local-server-ip>:3000/portal i get into a redirect loop to http://<local-server-ip>:3000/public/portal.html The page isn’t redirecting properly.

I'd appreciate some ideas on how to fix this, i'd love to try this app.

Streaming responses

Hello! Thanks for your work! Is it possible to add stream=true parameter to have streamed responses?

Add screenshots to your README.md

Please add Screenshots to your README.md .

People are visual and want to know what they get.

https://gpt-portal.com/ doesn not seem to be your website and you have no links to a website.

So help interested users out to see what they get.

A docker-compose.yml is available which is great!

Greetings!

GoogleGenerativeAI Error: fetch is not defined

I set the default model as gemini-1.5-flash and I already choose it from the dropdown menu but when I ask send the prompt I get this error message:

Error with Gemini API: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1/models/gemini-1.5-flash:generateContent: fetch is not defined

Here's the web console log:
Error sending message to server: Error: HTTP error! status: 500
at sendMessageToServer (script.js:2198:19)
at async HTMLButtonElement. (script.js:1848:15)

Running the app on Windows 11.

API Proxy Address

Hello,

I use another program that allows to customize "API Proxy Address", for OpenAI and Anthropic.

They also allow custom AI endpoints, if they are OpenIA compatible.

Do you plan to do the same.

Thanks

Error

Any idea? MacOS 14

TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
    at new NodeError (node:internal/errors:405:5)
    at Function.byteLength (node:buffer:787:11)
    at safeCompare (/Users/[user[Downloads/GPTPortal-main/node_modules/express-basic-auth/index.js:9:33)
    at staticUsersAuthorizer (/Users/USER/Downloads/GPTPortal-main/node_modules/express-basic-auth/index.js:42:43)
    at authMiddleware (/Users/USER/Downloads/GPTPortal-main/node_modules/express-basic-auth/index.js:61:18)
    at Layer.handle [as handle_request] (/Users/m1/Downloads/GPTPortal-main/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/USER/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:328:13)
    at /Users/m1/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/Users/m1/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/USER/Downloads/GPTPortal-main/node_modules/express/lib/router/index.js:280:10)

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.