update readme
This commit is contained in:
@@ -154,6 +154,11 @@ Start Claude Code using the router:
|
|||||||
ccr code
|
ccr code
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note**: After modifying the configuration file, you need to restart the service for the changes to take effect:
|
||||||
|
> ```shell
|
||||||
|
> ccr restart
|
||||||
|
> ```
|
||||||
|
|
||||||
#### Providers
|
#### Providers
|
||||||
|
|
||||||
The `Providers` array is where you define the different model providers you want to use. Each provider object requires:
|
The `Providers` array is where you define the different model providers you want to use. Each provider object requires:
|
||||||
@@ -413,5 +418,8 @@ A huge thank you to all our sponsors for their generous support!
|
|||||||
- @*成
|
- @*成
|
||||||
- @Z*o
|
- @Z*o
|
||||||
- @*琨
|
- @*琨
|
||||||
|
- [@congzhangzh](https://github.com/congzhangzh)
|
||||||
|
- @*_
|
||||||
|
|
||||||
|
|
||||||
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
||||||
|
|||||||
@@ -151,6 +151,11 @@ npm install -g @musistudio/claude-code-router
|
|||||||
ccr code
|
ccr code
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **注意**: 修改配置文件后,需要重启服务使配置生效:
|
||||||
|
> ```shell
|
||||||
|
> ccr restart
|
||||||
|
> ```
|
||||||
|
|
||||||
#### Providers
|
#### Providers
|
||||||
|
|
||||||
`Providers` 数组是您定义要使用的不同模型提供商的地方。每个提供商对象都需要:
|
`Providers` 数组是您定义要使用的不同模型提供商的地方。每个提供商对象都需要:
|
||||||
@@ -408,6 +413,8 @@ jobs:
|
|||||||
- @*琢
|
- @*琢
|
||||||
- @*成
|
- @*成
|
||||||
- @Z*o
|
- @Z*o
|
||||||
|
- [@congzhangzh](https://github.com/congzhangzh)
|
||||||
|
- @*_
|
||||||
|
|
||||||
(如果您的名字被屏蔽,请通过我的主页电子邮件与我联系,以便使用您的 GitHub 用户名进行更新。)
|
(如果您的名字被屏蔽,请通过我的主页电子邮件与我联系,以便使用您的 GitHub 用户名进行更新。)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 243 KiB |
35
src/cli.ts
35
src/cli.ts
@@ -109,6 +109,41 @@ async function main() {
|
|||||||
case "version":
|
case "version":
|
||||||
console.log(`claude-code-router version: ${version}`);
|
console.log(`claude-code-router version: ${version}`);
|
||||||
break;
|
break;
|
||||||
|
case "restart":
|
||||||
|
// Stop the service if it's running
|
||||||
|
try {
|
||||||
|
const pid = parseInt(readFileSync(PID_FILE, "utf-8"));
|
||||||
|
process.kill(pid);
|
||||||
|
cleanupPidFile();
|
||||||
|
if (existsSync(REFERENCE_COUNT_FILE)) {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(REFERENCE_COUNT_FILE);
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore cleanup errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("claude code router service has been stopped.");
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Service was not running or failed to stop.");
|
||||||
|
cleanupPidFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the service again in the background
|
||||||
|
console.log("Starting claude code router service...");
|
||||||
|
const cliPath = join(__dirname, "cli.js");
|
||||||
|
const startProcess = spawn("node", [cliPath, "start"], {
|
||||||
|
detached: true,
|
||||||
|
stdio: "ignore",
|
||||||
|
});
|
||||||
|
|
||||||
|
startProcess.on("error", (error) => {
|
||||||
|
console.error("Failed to start service:", error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
startProcess.unref();
|
||||||
|
console.log("✅ Service started successfully in the background.");
|
||||||
|
break;
|
||||||
case "-h":
|
case "-h":
|
||||||
case "help":
|
case "help":
|
||||||
console.log(HELP_TEXT);
|
console.log(HELP_TEXT);
|
||||||
|
|||||||
Reference in New Issue
Block a user