docs: update docs

This commit is contained in:
JinmingYang
2023-07-09 00:30:55 +08:00
parent b240461789
commit ba0d90ad2d
21 changed files with 916 additions and 89 deletions

View File

@@ -30,6 +30,7 @@
"dylib",
"esbuild",
"esno",
"excludesfile",
"execa",
"fetti",
"fettis",

View File

@@ -37,7 +37,7 @@ Use GPT-Runner to manage your AI presets, engage in AI-powered conversations wit
- [Quick Start](#quick-start)
- [The first way: CLI](#the-first-way-cli)
- [The second way: VSCode Extension](#the-second-way--vscode-extension)
- [Documentation](#documentation)
- [GPT-Runner File](#gpt-runner-file)
- [Road map](#road-map)
- [What's New](#whats-new)
- [FAQ](#faq)
@@ -71,12 +71,16 @@ Use GPT-Runner to manage your AI presets, engage in AI-powered conversations wit
## Quick Start
> 1. Requirements NodeJS >= 16.15.0
> - To check your NodeJS version, run `node -v` in your terminal. If you need to install or update NodeJS, visit [the official NodeJS website](https://nodejs.org/) for download and installation instructions.
> 2. Make sure you have an Open AI Key or a free ChatGPT account.
> Make sure you have an Open AI Key or a Anthropic Key. You can get it from [Open AI](https://platform.openai.com/) or [Anthropic](https://www.anthropic.com/).
### The first way: CLI
> 1. Requirements NodeJS >= 16.15.0
> - To check your NodeJS version, run `node -v` in your terminal. If you need to install or update NodeJS, visit [the official NodeJS website](https://nodejs.org/) for download and installation instructions.
> 2. First run the following command to download this package, which will take a long time, which is normal.
```bash
cd <your project folder>
npx gptr
@@ -86,11 +90,15 @@ You can see the web interface in your browser at [http://localhost:3003](http://
### The second way: VSCode Extension
> Requirements VSCode >= 1.72.0
Install the [GPT-Runner VSCode Extension](https://marketplace.visualstudio.com/items?itemName=nicepkg.gpt-runner) from the VSCode Marketplace.
## Documentation
## GPT-Runner File
Read the [documentation](https://gpt-runner.nicepkg.cn/) for installation instructions, usage guide, and more details on GPT-Runner's features.
For a detailed introduction about `.gpt-runner` directory, `*.gpt.md` files, and `gptr.config.json` files, please see here:
[Introduction to GPT-Runner Files](https://github.com/nicepkg/gpt-runner/blob/main/docs/gpt-config-en.gpt.md)
## Road map

View File

@@ -16,11 +16,11 @@
[终端工具](https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-cli/) / [网页版](https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-web/) / [VSCode 扩展](https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-vscode/) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [打赏开发者](https://github.com/nicepkg/gpt-runner/assets/35005637/98a4962a-8a2e-4177-8781-1e1ee886ecdc)
[cli-url]: https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-cli/
[cli-url]: https://github.com/nicepkg/gpt-runner/blob/main/packages/gpt-runner-cli/README_CN.md
[cli-image]: https://img.shields.io/badge/CLI-Node.js-green?logo=node.js
[web-url]: https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-web/
[web-url]: https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-web/README_CN.md
[web-image]: https://img.shields.io/badge/Web-React-blue?logo=react
[vscode-url]: https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-vscode/
[vscode-url]: https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-vscode/README_CN.md
[vscode-image]: https://img.shields.io/badge/VSCode-Extension-blue?logo=visualstudiocode
</div>
@@ -33,7 +33,7 @@
- [快速开始](#快速开始)
- [方式一CLI](#方式一cli)
- [方式二VSCode 扩展](#方式二vscode-扩展)
- [文档](#文档)
- [GPT-Runner 文件](#gpt-runner-文件)
- [开发计划](#开发计划)
- [最新动态](#最新动态)
- [常见问题](#常见问题)
@@ -66,14 +66,16 @@
## 快速开始
> 1. 要求 NodeJS >= 16.15.0
> - 要检查您的 NodeJS 版本,请在终端中运行 `node -v`。如果您需要安装或更新 NodeJS请访问 [官方 NodeJS 网站](https://nodejs.org/) 以获取下载和安装说明
>
> 2. 确保你有一个 Open AI Key 或一个免费的 ChatGPT 账号。
> 3. 确保你的命令终端能 ping 通 api.openai.com (如果你在中国大陆,你可能需要科学上网)。
> 确保你有一个 Open AI Key 或 Anthropic Key如果没有请访问 [Open AI](https://platform.openai.com/) 或 [Anthropic](https://www.anthropic.com/product/) 申请。
> 2. 确保你的命令终端能 ping 通 google.com (如果你在中国大陆,你可能需要科学上网)
### 方式一CLI
> 1. 要求 NodeJS >= 16.15.0
> - 要检查您的 NodeJS 版本,请在终端中运行 `node -v`。如果您需要安装或更新 NodeJS请访问 [官方 NodeJS 网站](https://nodejs.org/) 以获取下载和安装说明。
> 2. 首次执行以下命令会下载这个包,时间会比较长,这是正常的。
```bash
cd <你的项目路径>
npx gptr
@@ -83,11 +85,15 @@ npx gptr
### 方式二VSCode 扩展
> 要求 VSCode >= 1.72.0
从 VSCode Marketplace 安装 [GPT-Runner VSCode 扩展](https://marketplace.visualstudio.com/items?itemName=nicepkg.gpt-runner)。
## 文档
## GPT-Runner 文件
阅读 [文档](https://gpt-runner.nicepkg.cn/) 以获取安装说明、使用指南和有关 GPT-Runner 功能的更多详细信息。
关于 `.gpt-runner` 目录和 `*.gpt.md` 文件和 `gptr.config.json` 文件详细介绍请看这里:
[GPT-Runner 文件介绍](https://github.com/nicepkg/gpt-runner/blob/main/docs/gpt-config-cn.gpt.md)
## 开发计划

View File

@@ -1 +1,2 @@
faq cn
# 常见问题

View File

@@ -1 +1 @@
faq en
# FAQ

304
docs/gpt-config-cn.gpt.md Normal file
View File

@@ -0,0 +1,304 @@
# GPT-Runner 文件
<details>
<summary>目录</summary><br>
- [GPT-Runner 文件](#gpt-runner-文件)
- [介绍](#介绍)
- [.gpt-runner 目录](#gpt-runner-目录)
- [gptr.config.ts/js/json 配置文件](#gptrconfigtsjsjson-配置文件)
- [xxx.gpt.md AI 预设文件](#xxxgptmd-ai-预设文件)
- [聊天模型配置](#聊天模型配置)
- [OpenAI](#openai)
- [Anthropic](#anthropic)
<br></details>
## 介绍
1. 当你启动 GPT-Runner 时,它会读先读取项目级配置文件。
2. 这不是必要的,但是当你想要覆盖一些全局配置,这很有用。
3. 按优先级排序,优先读取最前面的配置文件。
```yml
<rootPath>/.gpt-runner/gptr.config.ts
<rootPath>/.gpt-runner/gptr.config.js
<rootPath>/.gpt-runner/gptr.config.json
<rootPath>/gptr.config.ts
<rootPath>/gptr.config.js
<rootPath>/gptr.config.json
```
4. 接着 GPT-Runner 会深度检索当前文件夹下所有的 `*.gpt.md` 文件。
5. 这个过程默认是跳过项目的 `.gitignore` 里的文件的。这很省时间。
6. 你可以通过配置 `gptr.config.ts` 文件来改变检索范围。
7. 每个 `*.gpt.md` 文件都会被解析成一个 AI 预设。
### .gpt-runner 目录
1. `<rootPath>/.gpt-runner/` 目录是一个特殊目录,即便你把它包含在 `.gitignore` 里,它也会被检索。这对希望 GPT-Runner 不入侵项目的人很有用。
2. 你可以把 `gptr.config.json``*.gpt.md` 文件都放在这个目录里。
3. 然后再在 `.gitignore` 里添加 `.gpt-runner` 。既可以同时保证项目的干净,又可以让 GPT-Runner 读取到配置文件。
4. 如果你希望一劳永逸地 git ignore .gpt-runner 目录,你可以执行这句命令实现全局 git ignore:
```bash
git config --global core.excludesfile '~/.gitignore_global'
echo '.gpt-runner' >> ~/.gitignore_global
```
## gptr.config.ts/js/json 配置文件
1. gpt.config.ts/js/json 是一个配置文件,它可以覆盖项目级别全局配置。
2. 它的配置类型如下
```ts
export interface UserConfig {
/**
* 模型配置
*/
model?: ModelConfig
/**
* 深度检索包含的文件路径,支持 glob
* @default null
*/
includes?: string | RegExp | string[] | RegExp[] | ((source: string) => boolean) | null
/**
* 深度检索排除的文件路径,支持 glob
* @default [
"** /node_modules",
"** /.git",
"** /__pycache__",
"** /.Python",
"** /.DS_Store",
"** /.cache",
"** /.next",
"** /.nuxt",
"** /.out",
"** /dist",
"** /.serverless",
"** /.parcel-cache"
]
*/
excludes?: string | RegExp | string[] | RegExp[] | ((source: string) => boolean) | null
/**
* 是否跳过 .gitignore 里的文件
* 建议开启,这样可以节省检索时间
* @default true
*/
respectGitIgnore?: boolean
}
export interface ModelConfig {
/**
* 模型类型
*/
type?: 'openai' | 'anthropic'
/**
* 模型名称
*/
modelName?: string
// ...更多配置请参考具体模型
}
```
3. 你可以在 `gptr.config.ts` 里使用 `defineConfig` 函数来配置 `UserConfig` 类型的配置文件。你可以安装 `@nicepkg/gpt-runner` 包。
```bash
npm i @nicepkg/gpt-runner
```
4. 你可以新建一个 `gptr.config.ts` 文件,然后在里填上示例配置:
```ts
import { defineConfig } from '@nicepkg/gpt-runner'
export default defineConfig({
model: {
type: 'openai',
modelName: 'gpt-3.5-turbo-16k',
temperature: 0.9,
},
})
```
5. 当然你也可以装上我们的 VSCode 插件,它会自动根据我们的 [JSON Schema](https://unpkg.com/@nicepkg/gpt-runner-shared@latest/dist/json-schema/user-config.json) 来提示你的配置文件。
6. 这是一个极简的 `gptr.config.json` 的示例:
```json
{
"model": {
"type": "openai",
"modelName": "gpt-3.5-turbo-16k"
}
}
```
7. 这是一个完整的 `gptr.config.json` 的示例:
```json
{
"model": {
"type": "openai",
"modelName": "gpt-3.5-turbo-16k",
"temperature": 0.9,
"maxTokens": 2000,
"topP": 1,
"frequencyPenalty": 0,
"presencePenalty": 0
},
"includes": null,
"excludes": [
"**/node_modules",
"**/.git",
"**/__pycache__",
"**/.Python",
"**/.DS_Store",
"**/.cache",
"**/.next",
"**/.nuxt",
"**/.out",
"**/dist",
"**/.serverless",
"**/.parcel-cache"
],
"respectGitIgnore": true
}
```
## xxx.gpt.md AI 预设文件
1. `xxx.gpt.md` 文件是一个 AI 预设文件,一个文件代表一个 AI 角色。
2. 比如一个 `uni-test.gpt.md` 是专门为这个项目写单元测试的,一个 `doc.gpt.md` 是专门为这个项目写文档的。它具备非常大的价值,而且这对团队成员来说是可以复用的。
3. 为什么不是 `xxx.gpt.json` ?因为那样子的话, `System Prompt``User Prompt` 里的内容经常需要转义字符,这样子写起来很麻烦。
4. `xxx.gpt.md` 易于书写,易于阅读,易于维护。
5. 一个极简的 AI 预设文件如下:
```md
\`\`\`json
{
"title": "分类目录/AI角色名字"
}
\`\`\`
# System Prompt
你是一个编码高手你擅长重构代码请遵循SOLID和KISS和DRY原则然后重构这段代码使其变得更好
```
4. 一个完整的 AI 预设文件如下:
```md
\`\`\`json
{
"title": "分类目录/AI角色名字",
"model": {
"type": "openai",
"modelName": "gpt-3.5-turbo-16k",
"temperature": 0.9,
"maxTokens": 2000,
"topP": 1,
"frequencyPenalty": 0,
"presencePenalty": 0
}
}
\`\`\`
# System Prompt
你是一个编码高手你擅长重构代码请遵循SOLID和KISS和DRY原则然后重构这段代码使其变得更好
# User Prompt
当您使用此预设创建新聊天时User Prompt 文本将自动填充聊天输入框,您可以在发送到人工智能机器人之前对其进行编辑
# 备注
这里可以写你的备注
`model` / `modelName` / `temperature` / `System Prompt` / `User Prompt` 都是**可选**参数,而且可定制参数还有非常多。
你还可以通过项目根目录下的 `gptr.config.json` 覆盖很多参数的默认值
```
## 聊天模型配置
### OpenAI
[官方请求参数文档](https://platform.openai.com/docs/api-reference/chat/create)
```ts
export interface OpenaiModelConfig {
type: 'openai'
/**
* 模型名称
*/
modelName: string
/**
* 温度
*/
temperature?: number
/**
* 最大回复 token 数量
*/
maxTokens?: number
/**
* 每个步骤考虑的 token 的总概率质量
*/
topP?: number
/**
* 根据频率惩罚重复的 token
*/
frequencyPenalty?: number
/**
* Penalizes repeated tokens
*/
presencePenalty?: number
}
```
### Anthropic
[官方请求参数文档](https://docs.anthropic.com/claude/reference/complete_post)
```ts
export interface AnthropicModelConfig {
type: 'anthropic'
/**
* 模型名称
*/
modelName: string
/**
* 温度
*/
temperature?: number
/**
* 最大回复 token 数量
*/
maxTokens?: number
/**
* 每个步骤考虑的 token 的总概率质量
*/
topP?: number
/**
* 仅从前 K 个选项中对每个后续选项进行采样
*/
topK?: number
}
```

307
docs/gpt-config-en.gpt.md Normal file
View File

@@ -0,0 +1,307 @@
# GPT-Runner Files
<details>
<summary>Table of Contents</summary><br>
- [GPT-Runner Files](#gpt-runner-files)
- [Introduction](#introduction)
- [.gpt-runner Directory](#gpt-runner-directory)
- [gptr.config.ts/js/json Configuration Files](#gptrconfigtsjsjson-configuration-files)
- [xxx.gpt.md AI Preset Files](#xxxgptmd-ai-preset-files)
- [Chat Model Configuration](#chat-model-configuration)
- [OpenAI](#openai)
- [Anthropic](#anthropic)
<br></details>
## Introduction
1. When you start GPT-Runner, it first reads the project-level configuration file.
2. This isn't necessary, but it's useful when you want to override some global configurations.
3. Sorted by priority, it prefers to read the file at topmost.
```yml
<rootPath>/.gpt-runner/gptr.config.ts
<rootPath>/.gpt-runner/gptr.config.js
<rootPath>/.gpt-runner/gptr.config.json
<rootPath>/gptr.config.ts
<rootPath>/gptr.config.js
<rootPath>/gptr.config.json
```
4. Then GPT-Runner will deeply retrieve all `*.gpt.md` files under the current folder.
5. This process defaults to skipping the files in the project's `.gitignore` which saves time.
6. You can change the retrieval range by configuring the `gptr.config.ts` file.
7. Each `*.gpt.md` file is parsed into an AI preset.
### .gpt-runner Directory
1. `<rootPath>/.gpt-runner/` directory is a special directory. Even if you include it in `.gitignore`, it will be retrieved. This is useful for people who hope GPT-Runner doesn't intrude into the project.
2. You can put both `gptr.config.json` and `*.gpt.md` files in this directory.
3. Then add `.gpt-runner` in `.gitignore`. So you can keep the project clean and let GPT-Runner read the configuration files at the same time.
4. If you want to git ignore the `.gpt-runner` directory once and for all, you can execute this command to achieve global git ignore:
```bash
git config --global core.excludesfile '~/.gitignore_global'
echo '.gpt-runner' >> ~/.gitignore_global
```
## gptr.config.ts/js/json Configuration Files
1. gpt.config.ts/js/json is a configuration file, it can override project-level global configurations.
2. Its configuration type is as follows
```ts
export interface UserConfig {
/**
* Model configuration
*/
model?: ModelConfig
/**
* Deep retrieval includes file paths, support glob
* @default null
*/
includes?: string | RegExp | string[] | RegExp[] | ((source: string) => boolean) | null
/**
* Deep retrieval excludes file paths, support glob
* @default [
"** /node_modules",
"** /.git",
"** /__pycache__",
"** /.Python",
"** /.DS_Store",
"** /.cache",
"** /.next",
"** /.nuxt",
"** /.out",
"** /dist",
"** /.serverless",
"** /.parcel-cache"
]
*/
excludes?: string | RegExp | string[] | RegExp[] | ((source: string) => boolean) | null
/**
* Skip the files in .gitignore
* Recommended to turn on, this can save retrieval time
* @default true
*/
respectGitIgnore?: boolean
}
export interface ModelConfig {
/**
* Model type
*/
type?: 'openai' | 'anthropic'
/**
* Model name
*/
modelName?: string
// ...more configurations please refer to specific model
}
```
3. You can use `defineConfig` function in `gptr.config.ts` to configure `UserConfig` type configuration file. You can install `@nicepkg/gpt-runner` package.
```bash
npm i @nicepkg/gpt-runner
```
4. You can create a new `gptr.config.ts` file, then fill in the sample configuration:
```ts
import { defineConfig } from '@nicepkg/gpt-runner'
export default defineConfig({
model: {
type: 'openai',
modelName: 'gpt-3.5-turbo-16k',
temperature: 0.9,
},
})
```
5. Of course, you can also install our VSCode plugin, it will automatically prompt your configuration file based on our [JSON Schema](https://unpkg.com/@nicepkg/gpt-runner-shared@latest/dist/json-schema/user-config.json).
6. This is the simple example for `gptr.config.json`:
```json
{
"model": {
"type": "openai",
"modelName": "gpt-3.5-turbo-16k"
}
}
```
7. This is the complete example for `gptr.config.json`:
```json
{
"model": {
"type": "openai",
"modelName": "gpt-3.5-turbo-16k",
"temperature": 0.9,
"maxTokens": 2000,
"topP": 1,
"frequencyPenalty": 0,
"presencePenalty": 0
},
"includes": null,
"excludes": [
"**/node_modules",
"**/.git",
"**/__pycache__",
"**/.Python",
"**/.DS_Store",
"**/.cache",
"**/.next",
"**/.nuxt",
"**/.out",
"**/dist",
"**/.serverless",
"**/.parcel-cache"
],
"respectGitIgnore": true
}
```
## xxx.gpt.md AI Preset Files
1. `xxx.gpt.md` files are AI preset files, each file represents an AI character.
2. For example, a `uni-test.gpt.md` is specifically for this project to write unit tests, and a `doc.gpt.md` is specifically for this project to write documentation. It has great value and can be reused by team members.
3. Why not `xxx.gpt.json`? Because in that case, the content within `System Prompt` and `User Prompt` often need to escape characters, which makes it very troublesome to write.
4. It's easy to write, read, and maintain `xxx.gpt.md`.
5. A minimalist AI preset file looks like this:
```md
\`\`\`json
{
"title": "Category/AI character name"
}
\`\`\`
# System Prompt
You're a coding master specializing in refactoring code. Please follow SOLID, KISS and DRY principles, and refactor this section of code to make it better.
```
6. A complete AI preset file looks like this:
```md
\`\`\`json
{
"title": "Category/AI Character Name",
"model": {
"type": "openai",
"modelName": "gpt-3.5-turbo-16k",
"temperature": 0.9,
"maxTokens": 2000,
"topP": 1,
"frequencyPenalty": 0,
"presencePenalty": 0
}
}
\`\`\`
# System Prompt
You are a coding master, skilled at refactoring code. Please adhere to the SOLID, KISS and DRY principles, and refactor this code to make it better.
# User Prompt
When you use this preset to create a new chat, the User Prompt text will automatically fill in the chat input box. You can edit it before sending it to the AI robot.
# Remark
You can write your remarks here.
`model` / `modelName` / `temperature` / `System Prompt` / `User Prompt` are all **optional** parameters, and there are many more to customize.
You can also override many default parameter values through the `gptr.config.json` at the root directory of the project.
```
## Chat Model Configuration
### OpenAI
[Official Request Parameters Documentation](https://platform.openai.com/docs/api-reference/chat/create)
```ts
export interface OpenaiModelConfig {
type: 'openai'
/**
* Model name
*/
modelName: string
/**
* Temperature
*/
temperature?: number
/**
* Max reply token number
*/
maxTokens?: number
/**
* Total probability mass of tokens per step
*/
topP?: number
/**
* Penalize repeated tokens according to frequency
*/
frequencyPenalty?: number
/**
* Penalizes repeated tokens
*/
presencePenalty?: number
}
```
### Anthropic
[Official Request Parameters Documentation](https://docs.anthropic.com/claude/reference/complete_post)
```ts
export interface AnthropicModelConfig {
type: 'anthropic'
/**
* Model name
*/
modelName: string
/**
* Temperature
*/
temperature?: number
/**
* Max reply token number
*/
maxTokens?: number
/**
* Total probability mass of tokens per step
*/
topP?: number
/**
* Only sample subsequent choices from the top K options
*/
topK?: number
}
```

View File

@@ -1 +0,0 @@
# Gpt-runner Packages

View File

@@ -23,6 +23,7 @@ GPT-Runner CLI 是一款功能强大的命令行工具,可帮助您管理 AI
- [Installation](#installation)
- [Quick Start](#quick-start)
- [CLI Commands](#cli-commands)
- [GPT-Runner File](#gpt-runner-file)
- [FAQ](#faq)
- [Sponsor](#sponsor)
- [Contributor](#contributor)
@@ -43,7 +44,7 @@ GPT-Runner CLI 是一款功能强大的命令行工具,可帮助您管理 AI
> 1. Requirements NodeJS >= 16.15.0
> - To check your NodeJS version, run `node -v` in your terminal. If you need to install or update NodeJS, visit [the official NodeJS website](https://nodejs.org/) for download and installation instructions.
> 2. Make sure you have an Open AI Key or a free ChatGPT account.
> 2. Make sure you have an Open AI Key or a Anthropic Key. You can get it from [Open AI](https://platform.openai.com/) or [Anthropic](https://www.anthropic.com/).
> 3. Slow installation is normal, because the package is a bit big.
To install the GPT-Runner CLI, use npm:
@@ -106,8 +107,13 @@ gptr --port 8080 --config ./gptr.config.json --share --no-open --debug
In this example, the GPT-Runner CLI will start a server available at port 8080, use the [gptr.config.json](https://github.com/nicepkg/gpt-runner/tree/main/docs/gptr.config.json) configuration file, share the server link, not automatically open in the browser, and run in debug mode.
For more detailed guidance, please refer to the project [documentation](https://gpt-runner.nicepkg.cn/).
## GPT-Runner File
For a detailed introduction about `.gpt-runner` directory, `*.gpt.md` files, and `gptr.config.json` files, please see here:
[Introduction to GPT-Runner Files](https://github.com/nicepkg/gpt-runner/blob/main/docs/gpt-config-en.gpt.md)
## FAQ
[English > FAQ](https://github.com/nicepkg/gpt-runner/tree/main/docs/faq-en.md)

View File

@@ -21,6 +21,7 @@ GPT-Runner CLI 是一款功能强大的命令行工具,可帮助您管理 AI
- [安装](#安装)
- [快速开始](#快速开始)
- [CLI 命令](#cli-命令)
- [GPT-Runner 文件](#gpt-runner-文件)
- [常见问题](#常见问题)
- [赞助](#赞助)
- [贡献者](#贡献者)
@@ -40,8 +41,8 @@ GPT-Runner CLI 是一款功能强大的命令行工具,可帮助您管理 AI
> 1. 要求 NodeJS >= 16.15.0
> - 要检查您的 NodeJS 版本,在终端运行 `node -v` 。如果需要安装或更新 NodeJS ,请访问[官方 NodeJS 网站](https://nodejs.org/)以获取下载和安装指南。
> 2. 确保您拥有一个 Open AI Key 或一个免费的 ChatGPT 帐户
> 3. 确保你的命令终端能 ping 通 api.openai.com (如果你在中国大陆,你可能需要科学上网)。
> 2. 确保有一个 Open AI Key 或 Anthropic Key如果没有请访问 [Open AI](https://platform.openai.com/) 或 [Anthropic](https://www.anthropic.com/product/) 申请
> 3. 确保你的命令终端能 ping 通 google.com (如果你在中国大陆,你可能需要科学上网)。
> 4. 安装速度较慢是正常的,因为软件包体积较大。
使用 npm 安装 GPT-Runner CLI :
@@ -104,7 +105,11 @@ gptr --port 8080 --config ./gptr.config.json --share --no-open --debug
在这个例子中GPT-Runner CLI 将在端口 8080 上启动一个服务器,使用 [gptr.config.json](https://github.com/nicepkg/gpt-runner/tree/main/docs/gptr.config.json) 的配置文件,分享服务器链接,不自动在浏览器中打开,并以调试模式运行。
有关更详细的指导,可以参考项目[文档](https://gpt-runner.nicepkg.cn)。
## GPT-Runner 文件
关于 `.gpt-runner` 目录和 `*.gpt.md` 文件和 `gptr.config.json` 文件详细介绍请看这里:
[GPT-Runner 文件介绍](https://github.com/nicepkg/gpt-runner/blob/main/docs/gpt-config-cn.gpt.md)
## 常见问题

View File

@@ -1 +1,5 @@
no...
# GPT-Runner Core
GPT-Runner Core is the core of GPT-Runner.
It contains some parser of gpt runner config file and some llm connection utils.

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023-PRESENT Jinming Yang <https://github.com/2214962083>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1 +1,7 @@
no...
# GPT-Runner Shared
GPT-Runner Shared is the shared code of GPT-Runner.
It contains `browser` and `server` and `common` code for reused in all GPT-Runner packages.
The `common` code can be used in both client side and server side.

View File

@@ -38,6 +38,7 @@ export const UserConfigSchema = z.object({
export const UserConfigForUserSchema = UserConfigSchema.omit({
rootPath: true,
exts: true,
}) satisfies z.ZodType<UserConfigForUser>
export const SingleChatMessageSchema = z.object({

View File

@@ -1 +1,90 @@
no...
<div align="center">
<img src="../../website/static/img/svg/logo-text.svg" alt="icon"/>
<h1 align="center">GPT-Runner VSCode</h1>
[简体中文](https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-cli/README_CN.md) / English
[![VSCode](https://img.shields.io/badge/VSCode-Extension-blue?logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=nicepkg.gpt-runner) [![License](https://img.shields.io/github/license/nicepkg/gpt-runner)](https://github.com/nicepkg/gpt-runner/blob/main/LICENSE)
![GitHub stars](https://img.shields.io/github/stars/nicepkg/gpt-runner?style=social)
The GPT-Runner VSCode extension is the result of integrating GPT-Runner and VSCode.
This extension helps you manage AI presets and drive conversations with code using AI, thereby significantly boosting your development efficiency.
</div>
<details>
<summary>Contents</summary><br>
- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [GPT-Runner File](#gpt-runner-file)
- [Common Questions](#common-questions)
- [Sponsor](#sponsor)
- [Contributors](#contributors)
- [License](#license)
<br></details>
## Features
- **Real-time context:** It can observe the files you have edited and the text you have selected to answer your questions.
- **Multiple chat window instances:** You can not only open a chat in the sidebar, but you can also open a chat page in the editor.
- **Responsive UI:** It adjusts its layout automatically based on the current window width.
- **Shareable LAN links:** Click the `🚀 GPT-Runner` at the bottom to open it in the browser.
- **Conversation with code files:** Select files or folders to chat with AI in real-time.
- **Manage your AI presets:** Manage your AI presets, it's like the local Storybook for AI presets.
- **Custom AI Parameters:** Flexible control over the configuration of AI models.
- **Support for third-party LLMs:** High compatibility and adaptability.
- **Privacy-First:** Local data storage to protect your privacy.
- **Localization:** Support for multiple languages.
## Installation
> 1. Requires VSCode >= 1.72.0
> 2. Make sure you have an Open AI Key or Anthropic Key. If you do not have, please visit [Open AI](https://platform.openai.com/) or [Anthropic](https://www.anthropic.com/product/) to apply.
You can search `GPT Runner` in the VSCode Extension Marketplace for installation.
Or, click here to install [GPT-Runner VSCode Extension](https://marketplace.visualstudio.com/items?itemName=nicepkg.gpt-runner).
## Quick Start
1. Open a project and click on the chat icon on the sidebar.
2. Click to confirm the initialization of the `.gpt.md` file.
3. Click settings in the top right corner and fill in your `Open AI Key` or `Anthropic Key`.
4. Click preset, then click `+` to create a new chat.
5. You are free to explore the functions within.
> 1. Note the chat icon in the top right corner, which is also clickable
> 2. Note the status bar at the bottom, `🚀 GPT-Runner` is also clickable
## GPT-Runner File
For a detailed introduction about `.gpt-runner` directory, `*.gpt.md` files, and `gptr.config.json` files, please see here:
[Introduction to GPT-Runner Files](https://github.com/nicepkg/gpt-runner/blob/main/docs/gpt-config-en.gpt.md)
## Common Questions
[English > Common Questions](https://github.com/nicepkg/gpt-runner/tree/main/docs/faq-en.md)
## Sponsor
Waiting for your sponsorship...
## Contributors
You can check out our [Contribution Guidelines](https://github.com/nicepkg/gpt-runner/tree/main/CONTRIBUTING.md)
This project exists thanks to all the people who contribute:
<a href="https://github.com/nicepkg/gpt-runner/graphs/contributors">
<img src="https://contrib.rocks/image?repo=nicepkg/gpt-runner" />
</a>
## License
[MIT](https://github.com/nicepkg/gpt-runner/tree/main/LICENSE) License &copy; 2023-PRESENT [Jinming Yang](https://github.com/2214962083)

View File

@@ -0,0 +1,92 @@
<div align="center">
<img src="../../website/static/img/svg/logo-text.svg" alt="icon"/>
<h1 align="center">GPT-Runner VSCode</h1>
[English](https://github.com/nicepkg/gpt-runner/tree/main/packages/gpt-runner-cli/README.md) / 简体中文
[![VSCode](https://img.shields.io/badge/VSCode-Extension-blue?logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=nicepkg.gpt-runner) [![License](https://img.shields.io/github/license/nicepkg/gpt-runner)](https://github.com/nicepkg/gpt-runner/blob/main/LICENSE)
![GitHub stars](https://img.shields.io/github/stars/nicepkg/gpt-runner?style=social)
GPT-Runner VSCode 扩展是 GPT-Runner 跟 VSCode 深度结合的结果。
可帮助您管理 AI 预设并与代码进行 AI 驱动的对话,从而显着提高您的开发效率。
</div>
<details>
<summary>目录</summary><br>
- [特性](#特性)
- [安装](#安装)
- [快速开始](#快速开始)
- [GPT-Runner 文件](#gpt-runner-文件)
- [常见问题](#常见问题)
- [赞助](#赞助)
- [贡献者](#贡献者)
- [许可证](#许可证)
<br></details>
## 特性
- **实时上下文:** 它可以观察你已打开编辑的文件和你选中的文字回答你的问题。
- **多个聊天窗口实例:** 你不但可以在侧边栏打开聊天,还可以在编辑器里打开聊天页。
- **响应式 ui:** 它会根据当前窗口宽度自动调整自身布局。
- **可共享的局域网链接:** 点击底部 `🚀 GPT-Runner` 可以在浏览器打开。
- **与代码文件对话:** 选择文件或文件夹与 AI 实时对话。
- **管理你的 AI 预设:** 管理你的 AI 预设,它就像 AI 预设的本地 Storybook。
- **自定义 AI 参数:** 灵活控制 AI 模型的配置。
- **支持第三方 LLM** 具有高度兼容性和适应性。
- **隐私优先:** 本地数据存储保护您的隐私。
- **国际化:** 支持多种语言。
## 安装
> 1. 要求 VSCode >= 1.72.0
> 2. 确保你有一个 Open AI Key 或 Anthropic Key如果没有请访问 [Open AI](https://platform.openai.com/) 或 [Anthropic](https://www.anthropic.com/product/) 申请。
你可以在 VSCode 扩展市场搜索 `GPT Runner` 进行安装。
或者点击这里安装 [GPT-Runner VSCode 扩展](https://marketplace.visualstudio.com/items?itemName=nicepkg.gpt-runner)。
## 快速开始
1. 打开一个项目,点击侧边聊天 icon。
2. 点击确认初始化 `.gpt.md` 文件。
3. 点击右上角设置,填入你的 `Open AI Key``Anthropic Key`
4. 点击预设,点击 `+` 新建聊天。
5. 你可以自由探索里面的功能。
> 1. 注意你的右上角有个聊天 icon那个也能点击
> 2. 注意你的底部状态栏,有个 `🚀 GPT-Runner` 也能点击
## GPT-Runner 文件
关于 `.gpt-runner` 目录和 `*.gpt.md` 文件和 `gptr.config.json` 文件详细介绍请看这里:
[GPT-Runner 文件介绍](https://github.com/nicepkg/gpt-runner/blob/main/docs/gpt-config-cn.gpt.md)
## 常见问题
[简体中文 > 常见问题](https://github.com/nicepkg/gpt-runner/tree/main/docs/faq-cn.md)
## 赞助
等待你的赞助...
## 贡献者
你可以查看我们的[贡献指南](https://github.com/nicepkg/gpt-runner/tree/main/CONTRIBUTING.md)
这个项目得以存在,要感谢所有贡献者:
<a href="https://github.com/nicepkg/gpt-runner/graphs/contributors">
<img src="https://contrib.rocks/image?repo=nicepkg/gpt-runner" />
</a>
## 许可证
[MIT](https://github.com/nicepkg/gpt-runner/tree/main/LICENSE) 许可证 &copy; 2023-PRESENT [Jinming Yang](https://github.com/2214962083)

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023-PRESENT Jinming Yang <https://github.com/2214962083>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1 +1,9 @@
no...
# Gpt-runner Web
Gpt-runner Web is the web interface of GPT-Runner.
It contains both server side and client side code.
Server side is power by express.
Client side is power by react + vite.

View File

@@ -1,61 +1,5 @@
# GPT-Runner
The GPT-Runner package is a powerful and versatile AI-driven tool designed to help developers improve their workflow by integrating AI-powered robot presets into their development environment. This package is a part of the larger GPT-Runner project and serves as the core engine behind its functioning.
It contains `defineConfig` function and `UserConfig` type.
## Overview
GPT-Runner enables developers to create and manage AI-powered robot presets through the use of `xxx.gpt.md` files within their projects. These files contain customizable parameters such as system prompts, user prompts, model names, and temperature, allowing developers to fine-tune the AI settings to suit their specific needs.
By integrating GPT-Runner into their development workflow, developers can enjoy features such as:
- AI Robot Preset-based Chats for efficient team communication and collaboration.
- Seamless integration with any IDE through the GPT-Runner CLI and IDE extensions.
- Customizable AI parameters for enhanced control and adaptability.
## Installation
To install and utilize the GPT-Runner package in your project, follow these steps:
1. Ensure that you have Node.js (version 16.15.0 or higher) installed on your system.
2. Add the GPT-Runner package as a dependency in your project by running the following command:
```sh
npm install @nicepkg/gpt-runner
```
3. Import the GPT-Runner package in your project and utilize its features according to your requirements.
## Usage
Define your project configuration using the `defineConfig` function, providing it with a configuration object containing your project's preferences:
```javascript
import { defineConfig } from '@nicepkg/gpt-runner';
const config = defineConfig({
rootPath: 'path/to/your/project/root',
model: {
type: 'openai',
modelName: 'gpt-4',
secrets: {
apiKey: 'your_api_key'
}
}
});
```
### Other Functions and Utilities
GPT-Runner exposes various other functions and utilities from the shared `@nicepkg/gpt-runner-shared` package, which you can utilize in your project as required. Explore the GPT-Runner package source code and documentation for more information on the available functions and their use cases.
## Troubleshooting
If you encounter any issues or need more information on the GPT-Runner package, refer to the [FAQ](https://github.com/nicepkg/gpt-runner/blob/main/website/faq-en.md) sections in the project documentation. If you can't find a solution there, feel free to open an [issue](https://github.com/nicepkg/gpt-runner/issues) on the project's GitHub page.
## Contributing
Contributions to the GPT-Runner package are welcome! Check out the [contributing guideline](https://github.com/nicepkg/gpt-runner/blob/main/CONTRIBUTING.md) to get started.
## License
The GPT-Runner package is provided under the [MIT License](https://github.com/nicepkg/gpt-runner/blob/main/LICENSE).
It's helpful to config `gptr.config.ts` file with type checking.

View File

@@ -6,7 +6,7 @@ export * from '@nicepkg/gpt-runner-shared/node'
type GetStaticValueFromChatModelType<T extends ChatModelType> = T extends ChatModelType ? `${T}` : never
export type UserConfig = {
[Key in keyof IUserConfig]: Key extends 'model' ? Omit<NonNullable<IUserConfig[Key]>, 'type'> & {
[Key in keyof Omit<IUserConfig, 'rootPath' | 'exts'>]: Key extends 'model' ? Omit<NonNullable<IUserConfig[Key]>, 'type'> & {
type: GetStaticValueFromChatModelType<NonNullable<IUserConfig[Key]>['type']>
} : IUserConfig[Key]
}

View File

@@ -1 +1,5 @@
...no
# GPT-Runner Website
Copy from docusaurus official code.
Wait for work... (´・ω・`