Skip to content

Commit 6ffd866

Browse files
committed
docs: fix examples file, closed #24
1 parent 6c8d5ed commit 6ffd866

4 files changed

Lines changed: 72 additions & 54 deletions

File tree

README.cn.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ cd llamacpp/build/bin
196196

197197
```bash
198198
# 进入交互对话模式
199-
$ai run --interactive --script examples/char-dobby
199+
$ai run --interactive --script examples/char-dobby.ai.yaml
200200
```
201201

202202
直接运行 `translator` 脚本库:
@@ -316,14 +316,14 @@ cd build/bin
316316
#默认脚本的搜索路径是当前目录和`~/.local/share/ai/agent`目录 . 你可以在`agentDirs`中配置, 或者直接在命令行中指定,注意命令行指定将覆盖配置文件中的设置.
317317
#`-f` means the agent file
318318
#`-i` means 进入交互模式, char-dobby 是一个角色智能体脚本,扮演哈利波特中的dobby.
319-
$ai run -if examples/char-dobby
319+
$ai run -if examples/char-dobby.ai.yaml
320320
Dobby: I am Dobby. Dobby is happy.
321321
You: intro yourself pls.
322322
Dobby: I am Dobby. I'm a brave and loyal house-elf, and I'm very proud to be a free elf. I love socks and wearing mismatched pairs.
323323

324324
#在命令行上输入内容(content)和内容的json schema 规范(output), 它就会产出该内容对应的json数据.
325325
#注意其生成质量受所选脑子🧠的影响.
326-
$ai run -f examples/json '{content: "I recently purchased the Razer BlackShark V2 X Gaming Headset, and it has significantly enhanced my gaming experience. This headset offers incredible sound quality, comfort, and features that are perfect for any serious gamer. Here’s why I highly recommend it: The 7.1 surround sound feature is a game-changer. The audio quality is superb, providing a truly immersive experience. I can clearly hear directional sounds, which is crucial for competitive gaming. The depth and clarity of the sound make it feel like I’m right in the middle of the action. The 50mm drivers deliver powerful, high-quality sound. The bass is deep and punchy without being overwhelming, while the mids and highs are crisp and clear. This balance makes the headset versatile, not only for gaming but also for listening to music and watching movies.", "output":{"type":"object","properties":{"sentiment":{"type":"string","description":"Sentiment (positive or negative)"},"products":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Name of the product"},"brand":{"type":"string","description":"Company that made the product"}}},"description":"Products mentioned in the review"},"anger":{"type":"boolean","description":"Is the reviewer expressing anger?"}},"required":["sentiment","products","anger"]}}'
326+
$ai run -f examples/json.ai.yaml '{content: "I recently purchased the Razer BlackShark V2 X Gaming Headset, and it has significantly enhanced my gaming experience. This headset offers incredible sound quality, comfort, and features that are perfect for any serious gamer. Here’s why I highly recommend it: The 7.1 surround sound feature is a game-changer. The audio quality is superb, providing a truly immersive experience. I can clearly hear directional sounds, which is crucial for competitive gaming. The depth and clarity of the sound make it feel like I’m right in the middle of the action. The 50mm drivers deliver powerful, high-quality sound. The bass is deep and punchy without being overwhelming, while the mids and highs are crisp and clear. This balance makes the headset versatile, not only for gaming but also for listening to music and watching movies.", "output":{"type":"object","properties":{"sentiment":{"type":"string","description":"Sentiment (positive or negative)"},"products":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Name of the product"},"brand":{"type":"string","description":"Company that made the product"}}},"description":"Products mentioned in the review"},"anger":{"type":"boolean","description":"Is the reviewer expressing anger?"}},"required":["sentiment","products","anger"]}}'
327327

328328
{
329329
"sentiment": "positive",
@@ -351,7 +351,7 @@ import { AIScriptServer } from '@isdk/ai-tool-agent';
351351

352352
// 配置你的脚本搜索路径
353353
AIScriptEx.searchPaths = ['.']
354-
const script = AIScriptServer.load('examples/json')
354+
const script = AIScriptServer.load('examples/json.ai.yaml')
355355
// 设置默认为大模型流式响应
356356
script.llmStream = stream
357357

README.md

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ npm install -g @offline-ai/cli
200200
run your ai agent script, eg, the `Dobby` character:
201201

202202
```bash
203-
$ai run --interactive --script examples/char-dobby
203+
$ai run --interactive --script examples/char-dobby.ai.yaml
204204
```
205205

206206
run the `translator` script lib directly:
@@ -324,13 +324,13 @@ Now you can run your AI agent:
324324
#defaults will search current working dir. you can config the search paths in `agentDirs`.
325325
#`-f` means the agent file
326326
#`-i` means entering the interactive mode
327-
$ai run -if examples/char-dobby
327+
$ai run -if examples/char-dobby.ai.yaml
328328
Dobby: I am Dobby. Dobby is happy.
329329
You: intro yourself pls.
330330
Dobby: I am Dobby. I'm a brave and loyal house-elf, and I'm very proud to be a free elf. I love socks and wearing mismatched pairs.
331331

332332
#provide the content and the json schema in output field, it will output the json data.
333-
$ai run -f examples/json '{content: "I recently purchased the Razer BlackShark V2 X Gaming Headset, and it has significantly enhanced my gaming experience. This headset offers incredible sound quality, comfort, and features that are perfect for any serious gamer. Here’s why I highly recommend it: The 7.1 surround sound feature is a game-changer. The audio quality is superb, providing a truly immersive experience. I can clearly hear directional sounds, which is crucial for competitive gaming. The depth and clarity of the sound make it feel like I’m right in the middle of the action. The 50mm drivers deliver powerful, high-quality sound. The bass is deep and punchy without being overwhelming, while the mids and highs are crisp and clear. This balance makes the headset versatile, not only for gaming but also for listening to music and watching movies.", "output":{"type":"object","properties":{"sentiment":{"type":"string","description":"Sentiment (positive or negative)"},"products":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Name of the product"},"brand":{"type":"string","description":"Company that made the product"}}},"description":"Products mentioned in the review"},"anger":{"type":"boolean","description":"Is the reviewer expressing anger?"}},"required":["sentiment","products","anger"]}}'
333+
$ai run -f examples/json.ai.yaml '{content: "I recently purchased the Razer BlackShark V2 X Gaming Headset, and it has significantly enhanced my gaming experience. This headset offers incredible sound quality, comfort, and features that are perfect for any serious gamer. Here’s why I highly recommend it: The 7.1 surround sound feature is a game-changer. The audio quality is superb, providing a truly immersive experience. I can clearly hear directional sounds, which is crucial for competitive gaming. The depth and clarity of the sound make it feel like I’m right in the middle of the action. The 50mm drivers deliver powerful, high-quality sound. The bass is deep and punchy without being overwhelming, while the mids and highs are crisp and clear. This balance makes the headset versatile, not only for gaming but also for listening to music and watching movies.", "output":{"type":"object","properties":{"sentiment":{"type":"string","description":"Sentiment (positive or negative)"},"products":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Name of the product"},"brand":{"type":"string","description":"Company that made the product"}}},"description":"Products mentioned in the review"},"anger":{"type":"boolean","description":"Is the reviewer expressing anger?"}},"required":["sentiment","products","anger"]}}'
334334

335335
{
336336
"sentiment": "positive",
@@ -358,7 +358,7 @@ import { AIScriptServer } from '@isdk/ai-tool-agent';
358358

359359
// Configure your script search path
360360
AIScriptEx.searchPaths = ['.']
361-
const script = AIScriptServer.load('examples/json')
361+
const script = AIScriptServer.load('examples/json.ai.yaml')
362362
// Set the default to large model streaming response
363363
script.llmStream = stream
364364

@@ -401,31 +401,45 @@ Specific script instruction manual see: [Programmable Prompt Engine Specificatio
401401
# Commands
402402

403403
<!-- commands -->
404-
* [`ai agent`](#ai-agent)
405-
* [`ai autocomplete [SHELL]`](#ai-autocomplete-shell)
406-
* [`ai brain [NAME]`](#ai-brain-name)
407-
* [`ai brain dn [NAME]`](#ai-brain-dn-name)
408-
* [`ai brain down [NAME]`](#ai-brain-down-name)
409-
* [`ai brain download [NAME]`](#ai-brain-download-name)
410-
* [`ai brain list [NAME]`](#ai-brain-list-name)
411-
* [`ai brain refresh`](#ai-brain-refresh)
412-
* [`ai brain search [NAME]`](#ai-brain-search-name)
413-
* [`ai config [ITEM_NAME]`](#ai-config-item_name)
414-
* [`ai config save [DATA]`](#ai-config-save-data)
415-
* [`ai help [COMMAND]`](#ai-help-command)
416-
* [`ai plugins`](#ai-plugins)
417-
* [`ai plugins add PLUGIN`](#ai-plugins-add-plugin)
418-
* [`ai plugins:inspect PLUGIN...`](#ai-pluginsinspect-plugin)
419-
* [`ai plugins install PLUGIN`](#ai-plugins-install-plugin)
420-
* [`ai plugins link PATH`](#ai-plugins-link-path)
421-
* [`ai plugins remove [PLUGIN]`](#ai-plugins-remove-plugin)
422-
* [`ai plugins reset`](#ai-plugins-reset)
423-
* [`ai plugins uninstall [PLUGIN]`](#ai-plugins-uninstall-plugin)
424-
* [`ai plugins unlink [PLUGIN]`](#ai-plugins-unlink-plugin)
425-
* [`ai plugins update`](#ai-plugins-update)
426-
* [`ai run [FILE] [DATA]`](#ai-run-file-data)
427-
* [`ai test [FILE]`](#ai-test-file)
428-
* [`ai version`](#ai-version)
404+
- [Offline AI PPE CLI(WIP)](#offline-ai-ppe-cliwip)
405+
- [Quick Start](#quick-start)
406+
- [PPE CLI Command](#ppe-cli-command)
407+
- [Programmable Prompt Engine Language](#programmable-prompt-engine-language)
408+
- [I. Core Structure](#i-core-structure)
409+
- [II. Reusability \& Configuration](#ii-reusability--configuration)
410+
- [III. AI Capabilities](#iii-ai-capabilities)
411+
- [IV. Message Text Formatting](#iv-message-text-formatting)
412+
- [V. Script Capabilities](#v-script-capabilities)
413+
- [Install](#install)
414+
- [Run](#run)
415+
- [Usage](#usage)
416+
- [Commands](#commands)
417+
- [`ai agent`](#ai-agent)
418+
- [`ai autocomplete [SHELL]`](#ai-autocomplete-shell)
419+
- [`ai brain [NAME]`](#ai-brain-name)
420+
- [`ai brain dn [NAME]`](#ai-brain-dn-name)
421+
- [`ai brain down [NAME]`](#ai-brain-down-name)
422+
- [`ai brain download [NAME]`](#ai-brain-download-name)
423+
- [`ai brain list [NAME]`](#ai-brain-list-name)
424+
- [`ai brain refresh`](#ai-brain-refresh)
425+
- [`ai brain search [NAME]`](#ai-brain-search-name)
426+
- [`ai config [ITEM_NAME]`](#ai-config-item_name)
427+
- [`ai config save [DATA]`](#ai-config-save-data)
428+
- [`ai help [COMMAND]`](#ai-help-command)
429+
- [`ai plugins`](#ai-plugins)
430+
- [`ai plugins add PLUGIN`](#ai-plugins-add-plugin)
431+
- [`ai plugins:inspect PLUGIN...`](#ai-pluginsinspect-plugin)
432+
- [`ai plugins install PLUGIN`](#ai-plugins-install-plugin)
433+
- [`ai plugins link PATH`](#ai-plugins-link-path)
434+
- [`ai plugins remove [PLUGIN]`](#ai-plugins-remove-plugin)
435+
- [`ai plugins reset`](#ai-plugins-reset)
436+
- [`ai plugins uninstall [PLUGIN]`](#ai-plugins-uninstall-plugin)
437+
- [`ai plugins unlink [PLUGIN]`](#ai-plugins-unlink-plugin)
438+
- [`ai plugins update`](#ai-plugins-update)
439+
- [`ai run [FILE] [DATA]`](#ai-run-file-data)
440+
- [`ai test [FILE]`](#ai-test-file)
441+
- [`ai version`](#ai-version)
442+
- [Credit](#credit)
429443

430444
## `ai agent`
431445

package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,45 @@
1010
"repository": "https://github.com/offline-ai/cli",
1111
"bugs": "https://github.com/@offline-ai/cli/issues",
1212
"dependencies": {
13-
"@oclif/core": "^4.2.10",
14-
"@oclif/plugin-autocomplete": "^3.2.25",
15-
"@oclif/plugin-help": "^6.2.26",
16-
"@oclif/plugin-not-found": "^3.2.45",
13+
"@oclif/core": "^4.5.3",
14+
"@oclif/plugin-autocomplete": "^3.2.34",
15+
"@oclif/plugin-help": "^6.2.33",
16+
"@oclif/plugin-not-found": "^3.2.68",
1717
"@oclif/plugin-plugins": "^5",
18-
"@oclif/plugin-version": "^2.2.25",
19-
"@oclif/plugin-warn-if-update-available": "^3.1.37",
18+
"@oclif/plugin-version": "^2.2.33",
19+
"@oclif/plugin-warn-if-update-available": "^3.1.48",
2020
"@offline-ai/cli-common": "workspace:*",
2121
"@offline-ai/cli-plugin-cmd-brain": "workspace:*",
2222
"@offline-ai/cli-plugin-cmd-config": "workspace:*",
2323
"@offline-ai/cli-plugin-cmd-test": "workspace:*",
2424
"@offline-ai/cli-plugin-core": "workspace:*",
2525
"ansi-colors": "^4.1.3",
26-
"better-sqlite3": "^11.8.1",
26+
"better-sqlite3": "*",
2727
"color-json": "^3.0.5",
2828
"enquirer": "^2.4.1",
2929
"lodash-es": "^4.17.21",
30-
"log-update": "^6.1.0",
31-
"node-fetch-native": "^1.6.6",
32-
"util-ex": "2.2.1"
30+
"log-update": "^7.0.0",
31+
"node-fetch-native": "^1.6.7",
32+
"util-ex": "2.3.0"
3333
},
3434
"devDependencies": {
35-
"@oclif/prettier-config": "^0.2.1",
3635
"@oclif/test": "^4",
3736
"@types/chai": "^5",
3837
"@types/lodash-es": "^4.17.12",
3938
"@types/mocha": "^10",
40-
"@types/node": "^22",
39+
"@types/node": "^24.3.0",
4140
"chai": "^5",
42-
"eslint": "^9",
43-
"eslint-config-oclif": "^6.0.28",
44-
"eslint-config-prettier": "^10",
41+
"eslint": "^9.34.0",
42+
"eslint-config-oclif": "^6.0.104",
43+
"eslint-config-prettier": "^10.1.8",
4544
"mocha": "^11",
46-
"oclif": "^4.17.41",
45+
"oclif": "^4.22.16",
4746
"shx": "^0.3.4",
48-
"terser": "^5.39.0",
47+
"terser": "^5.44.0",
4948
"ts-node": "^10",
50-
"tsup": "^8.4.0",
51-
"tsx": "^4.19.3",
52-
"typescript": "^5"
49+
"tsup": "^8.5.0",
50+
"tsx": "^4.20.5",
51+
"typescript": "~5.7.3"
5352
},
5453
"engines": {
5554
"node": ">=18.0.0"

tsup.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ export default defineConfig({
77
// splitting: true,
88
// sourcemap: true,
99
clean: true,
10-
minify: 'terser',
10+
// minify: 'terser',
11+
// esbuildOptions: (options) => {
12+
// options.banner = {
13+
// js: "import { createRequire } from 'module'; const require = createRequire(import.meta.url);",
14+
// }
15+
// },
1116
terserOptions: {
1217
// compress: {
1318
// drop_console: true,

0 commit comments

Comments
 (0)