kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
Porównaj commity
4 Commity
e38a617bbe
...
f860d9dbec
Autor | SHA1 | Data |
---|---|---|
LiYang | f860d9dbec | |
LiYang | e20ddacf24 | |
LiYang | bcfd174294 | |
LiYang | 4d2825f30f |
18
package.json
18
package.json
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
"name": "chatgpt",
|
||||
"version": "5.2.5",
|
||||
"name": "chatgpt-better",
|
||||
"version": "1.0.2",
|
||||
"description": "Node.js client for the official ChatGPT API.",
|
||||
"author": "Travis Fischer <travis@transitivebullsh.it>",
|
||||
"repository": "transitive-bullshit/chatgpt-api",
|
||||
"author": "LiYang <cctv1005s@gmail.com>",
|
||||
"repository": "cctv1005s/chatgpt-api",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"source": "./src/index.ts",
|
||||
"types": "./build/index.d.ts",
|
||||
"main": "./build/index.js",
|
||||
"module": "./build/index.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
|
@ -34,7 +35,8 @@
|
|||
"prepare": "husky install",
|
||||
"pre-commit": "lint-staged",
|
||||
"test": "run-p test:*",
|
||||
"test:prettier": "prettier '**/*.{js,jsx,ts,tsx}' --check"
|
||||
"test:prettier": "prettier '**/*.{js,jsx,ts,tsx}' --check",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"dependencies": {
|
||||
"cac": "^6.7.14",
|
||||
|
@ -42,8 +44,8 @@
|
|||
"eventsource-parser": "^1.0.0",
|
||||
"js-tiktoken": "^1.0.5",
|
||||
"keyv": "^4.5.2",
|
||||
"p-timeout": "^6.1.1",
|
||||
"quick-lru": "^6.1.1",
|
||||
"p-timeout": "^4.1.0",
|
||||
"quick-lru": "^5.1.1",
|
||||
"read-pkg-up": "^9.1.0",
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# ChatGPT API <!-- omit in toc -->
|
||||
|
||||
> Node.js client for the official [ChatGPT](https://openai.com/blog/chatgpt/) API.
|
||||
> Node.js client for the official [ChatGPT](https://openai.com/blog/chatgpt/) API, support commonjs & esm
|
||||
|
||||
[![NPM](https://img.shields.io/npm/v/chatgpt.svg)](https://www.npmjs.com/package/chatgpt) [![Build Status](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml/badge.svg)](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/transitive-bullshit/chatgpt-api/blob/main/license) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
|
||||
|
||||
|
|
|
@ -333,10 +333,11 @@ export class ChatGPTAPI {
|
|||
}
|
||||
}
|
||||
|
||||
return pTimeout(responseP, {
|
||||
milliseconds: timeoutMs,
|
||||
message: 'OpenAI timed out waiting for response'
|
||||
})
|
||||
return pTimeout(
|
||||
responseP,
|
||||
timeoutMs,
|
||||
'OpenAI timed out waiting for response'
|
||||
)
|
||||
} else {
|
||||
return responseP
|
||||
}
|
||||
|
|
|
@ -257,10 +257,11 @@ export class ChatGPTUnofficialProxyAPI {
|
|||
}
|
||||
}
|
||||
|
||||
return pTimeout(responseP, {
|
||||
milliseconds: timeoutMs,
|
||||
message: 'ChatGPT timed out waiting for response'
|
||||
})
|
||||
return pTimeout(
|
||||
responseP,
|
||||
timeoutMs,
|
||||
'ChatGPT timed out waiting for response'
|
||||
)
|
||||
} else {
|
||||
return responseP
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { Tiktoken } from 'js-tiktoken/lite'
|
||||
import cl100k_base from 'js-tiktoken/ranks/cl100k_base'
|
||||
import { getEncoding } from 'js-tiktoken'
|
||||
|
||||
// TODO: make this configurable
|
||||
const encoding = new Tiktoken(cl100k_base)
|
||||
const encoding = getEncoding('cl100k_base')
|
||||
|
||||
export function encode(input: string): Uint32Array {
|
||||
return new Uint32Array(encoding.encode(input))
|
||||
|
|
|
@ -6,7 +6,7 @@ export default defineConfig([
|
|||
outDir: 'build',
|
||||
target: 'node16',
|
||||
platform: 'node',
|
||||
format: ['esm'],
|
||||
format: ['cjs', 'esm'],
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
minify: false,
|
||||
|
|
Ładowanie…
Reference in New Issue