- Works: http://ftqq.com
- Weibo: http://weibo.com/easy
easychen / book-by-ai Goto Github PK
View Code? Open in Web Editor NEWGenerate high-quality books with AI
License: MIT License
Generate high-quality books with AI
License: MIT License
使用gpt-3.5-turbo-16k
部分情况下会有这个报错,看起来是部分情况下模型返回没有按照 json 格式。
SyntaxError: Unexpected number in JSON at position 48
at JSON.parse (<anonymous>)
at canJsonParse (file:///Users/NAME/Code/Github/book-by-ai/lib/functions_cn.js:132:14)
at extractJSON (file:///Users/NAME/Code/Github/book-by-ai/lib/functions_cn.js:117:24)
at gen (file:///Users/NAME/Code/Github/book-by-ai/lib/functions_cn.js:70:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GenBook.sections (file:///Users/NAME/Code/Github/book-by-ai/actions/book_cn.js:165:32)
at async GenBook.main (file:///Users/NAME/Code/Github/book-by-ai/actions/book_cn.js:15:9)
file:///Users/NAME/Code/Github/book-by-ai/actions/book_cn.js:167
if( result.json.sections )
^
TypeError: Cannot read properties of null (reading 'sections')
at GenBook.sections (file:///Users/NAME/Code/Github/book-by-ai/actions/book_cn.js:167:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GenBook.main (file:///Users/NAME/Code/Github/book-by-ai/actions/book_cn.js:15:9)
Node.js v18.17.0
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'https://oa.api2d.net//sd/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image',
status: 400,
statusText: 'Bad Request',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
Error: ChatGPT error 400: {
"error": {
"message": "This model's maximum context length is 16385 tokens. However, your messages resulted in 19500 tokens. Please reduce the length of the messages.",
"type": "invalid_request_error",
"param": "messages",
"code": "context_length_exceeded"
}
}
at fetchSSE (/node_modules/api2d/cjs/fetchSSE.js:16:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /node_modules/api2d/cjs/index.js:147:38 {
因为会从互联网搜索内容进行写作,那也可以用于一般情况的主题搜索和报告了。 但这种一般要求要严谨点,可否增加temprature控制变量。或者像new bing那样,给出精准,平衡,创意 三钟写作模式。
win11,wsl2,ubuntu已经安装chrome,win11也安装了。
具体报错如下:
book_cn@write []
请稍候,正在发起搜索请求…
file:///home/pico/BBA/node_modules/@puppeteer/browsers/lib/esm/launch.js:268
reject(new Error([
^
Error: Failed to launch the browser process! spawn /Applications/Google Chrome.app/Contents/MacOS/Google Chrome ENOENT
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (file:///home/pico/BBA/node_modules/@puppeteer/browsers/lib/esm/launch.js:268:24)
at ChildProcess.emit (node:events:514:28)
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.17.1
用的是Api2D接口,win11 wsl2系统。
运行过程中难免会由于网络,字符长度等问题产生中断,希望能增加断点断续重跑能力,这样能更高效的完成写作。
.env 用的 aiapi配置
OPENAI_API_KEY=sk-1234567890abcdef1234567890abcdef
OPENAI_API_ENDPOINT=http://172.17.128.1:3456
OPENAI_API_MODEL=gpt-3.5-turbo-16k
http://172.17.128.1:3456 这个地址是在AiAPI的 about里复制的,也是通的
wsl下
/mnt/d/book/book-by-ai# curl http://172.17.128.1:3456
AiAPI server works!
后来 换成 http://192.168.0.101:3456 也是通的 ,但都是超时。
用的美国vpn ,claude.ai 可以正常访问
输入了描述后,等半天:
/mnt/d/book/book-by-ai/node_modules/api2d/cjs/index.js:142
reject(new Error([408]:Timeout by ${this.timeout} ms
));
^
Error: [408]:Timeout by 300000 ms
at Timeout._onTimeout (/mnt/d/book/book-by-ai/node_modules/api2d/cjs/index.js:142:32)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
卡在这里
const response = await api.completion({
请问为啥 如何整
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.