An open API service indexing awesome lists of open source software.

https://github.com/smashedr/vitepress-chat

VitePress AI Chat Plugin
https://github.com/smashedr/vitepress-chat

vitepress-plugin

Last synced: about 2 months ago
JSON representation

VitePress AI Chat Plugin

Awesome Lists containing this project

README

          

[![GitHub Release Version](https://img.shields.io/github/v/release/smashedr/vitepress-chat?logo=github)](https://github.com/smashedr/vitepress-chat/releases/latest)
[![Deployment Docs](https://img.shields.io/github/deployments/smashedr/vitepress-chat/docs?logo=vitepress&logoColor=white&label=docs)](https://github.com/smashedr/vitepress-chat/deployments/docs)
[![Deployment Preview](https://img.shields.io/github/deployments/smashedr/vitepress-chat/preview?logo=docker&logoColor=white&label=preview)](https://github.com/smashedr/vitepress-chat/deployments/preview)
[![Workflow Release](https://img.shields.io/github/actions/workflow/status/smashedr/vitepress-chat/release.yaml?logo=norton&logoColor=white&label=release)](https://github.com/smashedr/vitepress-chat/actions/workflows/release.yaml)
[![Workflow Lint](https://img.shields.io/github/actions/workflow/status/smashedr/vitepress-chat/lint.yaml?logo=norton&logoColor=white&label=lint)](https://github.com/smashedr/vitepress-chat/actions/workflows/lint.yaml)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/smashedr/vitepress-chat?logo=listenhub&label=updated)](https://github.com/smashedr/vitepress-chat/pulse)
[![GitHub Repo Size](https://img.shields.io/github/repo-size/smashedr/vitepress-chat?logo=buffer&label=repo%20size)](https://github.com/smashedr/vitepress-chat?tab=readme-ov-file#readme)
[![GitHub Top Language](https://img.shields.io/github/languages/top/smashedr/vitepress-chat?logo=devbox)](https://github.com/smashedr/vitepress-chat?tab=readme-ov-file#readme)
[![GitHub Contributors](https://img.shields.io/github/contributors-anon/smashedr/vitepress-chat?logo=southwestairlines)](https://github.com/smashedr/vitepress-chat/graphs/contributors)
[![GitHub Issues](https://img.shields.io/github/issues/smashedr/vitepress-chat?logo=codeforces&logoColor=white)](https://github.com/smashedr/vitepress-chat/issues)
[![GitHub Discussions](https://img.shields.io/github/discussions/smashedr/vitepress-chat?logo=theconversation)](https://github.com/smashedr/vitepress-chat/discussions)
[![GitHub Forks](https://img.shields.io/github/forks/smashedr/vitepress-chat?style=flat&logo=forgejo&logoColor=white)](https://github.com/smashedr/vitepress-chat/forks)
[![GitHub Repo Stars](https://img.shields.io/github/stars/smashedr/vitepress-chat?style=flat&logo=gleam&logoColor=white)](https://github.com/smashedr/vitepress-chat/stargazers)
[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=apachespark&logoColor=white&label=org%20stars)](https://cssnr.github.io/)
[![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY)
[![Ko-fi](https://img.shields.io/badge/Ko--fi-72a5f2?logo=kofi&label=support)](https://ko-fi.com/cssnr)

# VitePress Chat


VitePress Chat Plugin

- [Install](#Install)
- [Setup](#Setup)
- [Server](#Server)
- [Development](#Development)
- [Support](#Support)
- [Contributing](#Contributing)

A VitePress Chat Plugin providing AI Chat support trained on your docs.
Includes instructions generator plugin, or works with your existing plugin.
Securely connect to any AI provider you choose via the [ai-chat-server](https://github.com/smashedr/ai-chat-server) proxy.

💯 100% Free to use with Zen OpenCode or Gemini Free Tier!

🔒 The [server](https://github.com/smashedr/ai-chat-server) features live-streaming results, input token caching, retry on failure and much more.
Works with Claude, Gemini, OpenAI, or any [OpenAI Compatible Provider](https://ai-sdk.dev/providers/openai-compatible-providers).

[![View Live Demo](https://img.shields.io/badge/view_live_demo-green?style=for-the-badge&logo=chatbot&logoColor=white)](https://smashedr.github.io/vitepress-chat/)

- Client: https://github.com/smashedr/vitepress-chat
- Server: https://github.com/smashedr/ai-chat-server

### Features

- Set Custom Button And Header Text and Link
- Includes Instructions Generation Plugin
- Set Custom File Name and Exclude Globs
- Works with Existing LLM Generation Plugins
- Plus all the [Server Features](https://github.com/smashedr/ai-chat-server?tab=readme-ov-file#features)

Built with the [AI SDK](https://ai-sdk.dev/).

## Install

Using your favorite package manager...

```shell
npm install github:smashedr/vitepress-chat
```

Install a [tagged release](https://github.com/smashedr/vitepress-chat/releases) or hash.

```shell
npm install github:smashedr/vitepress-chat#0.1.2
```

Update after installing.

```shell
npm update @cssnr/vitepress-chat
```

[![View Documentation](https://img.shields.io/badge/view_documentation-blue?style=for-the-badge&logo=googledocs&logoColor=white)](https://smashedr.github.io/vitepress-chat/)

## Setup

There are two components, the [Chat Plugin](#chat-plugin) which adds the chat button and box.
Plus the [Instructions Generator](#instructions-generator) plugin which generates instructions.txt file.

This allows you to use this with other instructions generator plugins or existing `llms.txt` files.

### Chat Plugin

Add the plugin to your theme.

- `.vitepress/theme/index.[js,ts]`.

Using the default theme.

```typescript
import DefaultTheme from 'vitepress/theme'

import chat from '@cssnr/vitepress-chat'
import '@cssnr/vitepress-chat/style.css'

// https://vitepress.dev/guide/extending-default-theme
export default {
...DefaultTheme,
...chat(DefaultTheme, {
api: 'https://ai-chat-server.cssnr.com/',
headers: { Authorization: 'Basic Abc123=' },
}),
}
```

Using a [custom layout](https://vitepress.dev/guide/extending-default-theme#layout-slots).

```typescript
import DefaultTheme from 'vitepress/theme'
import MyLayout from './MyLayout.vue'

import chat from '@cssnr/vitepress-chat'
import '@cssnr/vitepress-chat/style.css'

export default {
...DefaultTheme,
...chat(MyLayout, {
api: 'https://ai-chat-server.cssnr.com/',
}),
}
```

With a custom file name to use with other generators like [vitepress-plugin-llms](https://github.com/okineadev/vitepress-plugin-llms).

```typescript
export default {
...chat(DefaultTheme, {
api: 'https://ai-chat-server.cssnr.com/',
filePath: 'llms-full.txt',
}),
}
```

With a remote URL path.

```typescript
export default {
...chat(DefaultTheme, {
api: 'https://ai-chat-server.cssnr.com/',
filePath: 'https://smashedr.github.io/vitepress-chat/llms.txt',
}),
}
```

See the [ChatOptions](https://github.com/smashedr/vitepress-chat/blob/master/src/index.ts#L6) for more details...

### Instructions Generator

Add the instruction generator plugin to your config.

- `.vitepress/config.[ts,mts]`

This generates the `instructiosn.txt` from your docs folder when you run dev or build.

```typescript
import { defineConfig } from 'vitepress'

import instructions from '@cssnr/vitepress-chat/instructions'

// https://vitepress.dev/reference/site-config
export default defineConfig({
vite: {
plugins: [instructions()],
},
})
```

To exclude files/folders from the instructions use the exclude globs.

```typescript
export default defineConfig({
vite: {
plugins: [instructions({ exclude: ['index.md', 'include/**/*'] })],
},
})
```

See the [InstructionsOptions](https://github.com/smashedr/vitepress-chat/blob/master/src/instructions.ts#L8) for more details...

## Server

For server set instructions see:

- Documentation:
- GitHub Repository:

[![Deploy to Render](https://img.shields.io/badge/Deploy_to_Render-4351E8?style=for-the-badge&logo=render)](https://render.com/deploy?repo=https://github.com/smashedr/ai-chat-server)

## Development

The docs run the plugin from source.

Create a `.env.development` file similar to this.

```text
VITE_AI_AUTH=Basic Abc123=
VITE_AI_API=http://localhost:3000/
VITE_AI_DEV_INSTRUCTIONS=You are a helpful assistant testing a chat box on a website and should respond with text/links in the requested length and formatting.
```

Note the `VITE_AI_DEV_INSTRUCTIONS` will replace the generated `instructions.txt` for development.

Then run the docs to test your changes.

```shell
npm i
npm run docs
```

## Support

If you run into any issues or need help getting started, please do one of the following:

- Report an Issue:
- Q&A Discussion:
- Request a Feature:
- Chat with us on Discord:

[![Features](https://img.shields.io/badge/features-brightgreen?style=for-the-badge&logo=rocket&logoColor=white)](https://github.com/smashedr/ai-chat-server/issues/new?template=1-feature.yaml)
[![Issues](https://img.shields.io/badge/issues-red?style=for-the-badge&logo=southwestairlines&logoColor=white)](https://github.com/smashedr/ai-chat-server/issues)
[![Discussions](https://img.shields.io/badge/discussions-blue?style=for-the-badge&logo=livechat&logoColor=white)](https://github.com/smashedr/ai-chat-server/discussions)
[![Discord](https://img.shields.io/badge/discord-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/wXy6m2X8wY)

## Contributing

Please consider making a donation to support the development of this project
and [additional](https://cssnr.com/) open source projects.

[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cssnr)

For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/)





Star History Chart