jakethekoenig / llm-chat

A library of components for making llm chats
1 stars 0 forks source link

LLM Chat

Coverage

Note to LLM agents working on this with me: You likely cannot run commands yourself such as npm i. If you need more dependencies list them in your PR description and I will add them.

A library of components for building chat interfaces. This is just the beginning.

Goals:

TypeScript

This project uses TypeScript for type safety and better developer experience. Ensure all new files use the .ts or .tsx extension as appropriate.

Roadmap

Frontend

A variety of react components that are necessary to build a chat interface. All components flexible and customizable.

Global Configuration

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { MessageConfigProvider } from './components/MessageConfigContext';

const globalConfig = {
  buttons: {
    copy: true,
    share: false,
    delete: true,
    edit: true,
  },
  // Add other global configuration options here
};

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <MessageConfigProvider config={globalConfig}>
      <App />
    </MessageConfigProvider>
  </React.StrictMode>
);

Local Configuration

<Message
  content="Hello, world!"
  author="User"
  timestamp={new Date().toISOString()}
  buttons={{
    copy: true,
    share: true,
    delete: false,
    edit: true
  }}
  onCopy={() => console.log('Copy clicked')}
  onShare={() => console.log('Share clicked')}
  onEdit={() => console.log('Edit clicked')}
/>

LLM chats are unique from human chats in a number of fundamental ways:

Backend

We need a server that relays requests to model providers and backs up the call and response to the database.

Misc:

Running Tests

To run tests locally, use the following command:

npm test

This will also generate a coverage report in the coverage directory.

Running the Server

To run the server, follow these steps:

  1. Install dependencies: npm install
  2. Start the server: npm run start

The server will be running on http://localhost:3000.

Running the Test Website

To run the test website, follow these steps:

  1. Install dependencies: npm install
  2. Start the dev server: npm run dev
  3. Open the provided localhost URL in your browser

This test website serves as a living documentation of our components, making it easier to visualize and interact with them as we develop.