Skip to content

Commit 57b3206

Browse files
authored
FIX: fixes multiple issues in the OpenViking chat functionality and unifies session ID generation logic between Python and Rust CLI implementations. (#446)
* refactor(sandbox): remove docker/aiosandbox backends, simplify SRT config - Remove docker and aiosandbox from available backends - Remove settings_path from SrtBackendConfig (now auto-generated in workspace) - Update SRT settings path to workspace/sandboxes/{session}-srt-settings.json - Update README examples to use srt backend and remove settingsPath * refactor(sandbox): remove docker/aiosandbox backends, simplify SRT config - Remove docker and aiosandbox from available backends - Remove settings_path from SrtBackendConfig (now auto-generated in workspace) - Update SRT settings path to workspace/sandboxes/{session}-srt-settings.json - Update README examples to use srt backend and remove settingsPath * fix: remove unused handle_chat_direct function and fix unused logs variable * Fix UTF-8 issues in chat command * Add tab indentation to Think, Calling, and Result lines in CLI output * Add first release workflow * Update release workflow with correct working directory * 修改 SessionKey 构建逻辑:统一使用 type="cli",channel_id 默认 "default",chat_id 作为 session_id 使用 * Implement machine unique ID as default session ID for ov chat * Remove unsupported --logs parameter from chat command * 统一 Python 和 Rust CLI 的默认 session ID 生成逻辑 * 修改日志 * 去掉log依赖 * docs: add VikingBot quick start section to READMEs * fix: use vikingbot chat instead of ov chat in READMEs * Revert "fix: use vikingbot chat instead of ov chat in READMEs" This reverts commit 59f4e87. * fix: use UUID v4 for machine ID generation in both Rust and Python * refactor: move truncate_utf8 to utils, fix chat history path, and use BotProcess dataclass * refactor: update machine ID generation and remove unused chat_v2 - Update Python to use py-machineid library - Update Rust to use machine-uid crate - Remove unused chat_v2.rs - Move machine ID from file storage to system-provided IDs - Add fallback to "default" if system ID is unavailable * 优化格式 * ruff format .
1 parent 226db50 commit 57b3206

File tree

95 files changed

+1489
-1117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1489
-1117
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: First Release to PyPI
2+
3+
on:
4+
workflow_dispatch: # 手动触发
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
working-directory: bot
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.11'
18+
19+
- name: Install build dependencies
20+
run: pip install build
21+
22+
- name: Build package
23+
run: python -m build
24+
25+
- name: Publish to PyPI
26+
uses: pypa/gh-action-pypi-publish@release/v1
27+
with:
28+
password: ${{ secrets.VIKINGBOT_PYPI_API_TOKEN }}
29+
packages-dir: bot/dist/

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,21 @@ ov grep "openviking" --uri viking://resources/volcengine/OpenViking/docs/zh
437437

438438
Congratulations! You have successfully run OpenViking 🎉
439439

440+
### VikingBot Quick Start
441+
442+
VikingBot is an AI agent framework built on top of OpenViking. Here's how to get started:
443+
444+
```bash
445+
# Install VikingBot from source (in OpenViking root directory)
446+
uv pip install -e bot/
447+
448+
# Start OpenViking server with Bot enabled
449+
openviking-server --with-bot
450+
451+
# In another terminal, start interactive chat
452+
ov chat
453+
```
454+
440455
---
441456

442457
## Server Deployment Details

README_CN.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,21 @@ ov grep "openviking" --uri viking://resources/volcengine/OpenViking/docs/zh
436436

437437
恭喜!您已成功运行 OpenViking 🎉
438438

439+
### VikingBot 快速开始
440+
441+
VikingBot 是构建在 OpenViking 之上的 AI 智能体框架。以下是快速开始指南:
442+
443+
```bash
444+
# 在 OpenViking 源码根目录下安装 VikingBot
445+
uv pip install -e bot/
446+
447+
# 启动 OpenViking 服务器(同时启动 Bot)
448+
openviking-server --with-bot
449+
450+
# 在另一个终端启动交互式聊天
451+
ov chat
452+
```
453+
439454
---
440455

441456
## 服务器部署详情

bot/.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.11'
23+
24+
- name: Install build dependencies
25+
run: |
26+
pip install build
27+
28+
- name: Build package
29+
run: |
30+
python -m build
31+
32+
- name: Publish to PyPI
33+
uses: pypa/gh-action-pypi-publish@release/v1

bot/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ You only need to add sandbox configuration when you want to change these default
461461
{
462462
"bot": {
463463
"sandbox": {
464-
"backend": "opensandbox",
464+
"backend": "srt",
465465
"mode": "per-session"
466466
}
467467
}
@@ -472,10 +472,8 @@ You only need to add sandbox configuration when you want to change these default
472472
| Backend | Description |
473473
|---------|-------------|
474474
| `direct` | (Default) Runs code directly on the host |
475-
| `docker` | Uses Docker containers for isolation |
476475
| `opensandbox` | Uses OpenSandbox service |
477476
| `srt` | Uses Anthropic's SRT sandbox runtime |
478-
| `aiosandbox` | Uses AIO Sandbox service |
479477

480478
**Available Modes:**
481479
| Mode | Description |
@@ -543,7 +541,6 @@ You only need to add sandbox configuration when you want to change these default
543541
"backend": "srt",
544542
"backends": {
545543
"srt": {
546-
"settingsPath": "~/.vikingbot/srt-settings.json",
547544
"nodePath": "node",
548545
"network": {
549546
"allowedDomains": [],

bot/README_CN.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,8 @@ vikingbot 支持沙箱执行以增强安全性。
475475
| 后端 | 描述 |
476476
|---------|-------------|
477477
| `direct` | (默认)直接在主机上运行代码 |
478-
| `docker` | 使用 Docker 容器进行隔离 |
479478
| `opensandbox` | 使用 OpenSandbox 服务 |
480479
| `srt` | 使用 Anthropic 的 SRT 沙箱运行时 |
481-
| `aiosandbox` | 使用 AIO Sandbox 服务 |
482480

483481
**可用模式:**
484482
| 模式 | 描述 |
@@ -521,23 +519,6 @@ vikingbot 支持沙箱执行以增强安全性。
521519
}
522520
```
523521

524-
**Docker 后端:**
525-
```json
526-
{
527-
"bot": {
528-
"sandbox": {
529-
"backend": "docker",
530-
"backends": {
531-
"docker": {
532-
"image": "python:3.11-slim",
533-
"networkMode": "bridge"
534-
}
535-
}
536-
}
537-
}
538-
}
539-
```
540-
541522
**SRT 后端:**
542523
```json
543524
{
@@ -546,7 +527,6 @@ vikingbot 支持沙箱执行以增强安全性。
546527
"backend": "srt",
547528
"backends": {
548529
"srt": {
549-
"settingsPath": "~/.vikingbot/srt-settings.json",
550530
"nodePath": "node",
551531
"network": {
552532
"allowedDomains": [],
@@ -569,22 +549,6 @@ vikingbot 支持沙箱执行以增强安全性。
569549
}
570550
```
571551

572-
**AIO Sandbox 后端:**
573-
```json
574-
{
575-
"bot": {
576-
"sandbox": {
577-
"backend": "aiosandbox",
578-
"backends": {
579-
"aiosandbox": {
580-
"baseUrl": "http://localhost:18794"
581-
}
582-
}
583-
}
584-
}
585-
}
586-
```
587-
588552
**SRT 后端设置:**
589553

590554
SRT 后端使用 `@anthropic-ai/sandbox-runtime`

bot/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ dependencies = [
4141
"openviking>=0.1.18",
4242
"ddgs>=9.0.0",
4343
"gradio>=6.6.0",
44+
"py-machineid>=1.0.0",
45+
"ruff>=0.15.1",
4446
]
4547

4648
[project.optional-dependencies]

bot/scripts/clean_vikingbot.py

Lines changed: 0 additions & 155 deletions
This file was deleted.

bot/scripts/clean_vikingbot.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
BOT_DIR="$HOME/.openviking/data/bot"
3+
4+
echo "🧹 Cleaning VikingBot data directory..."
5+
echo "📂 Cleaning contents of: $BOT_DIR"
6+
7+
if [ -d "$BOT_DIR" ]; then
8+
echo "🗑️ Deleting items:"
9+
for item in "$BOT_DIR"/*; do
10+
if [ -e "$item" ]; then
11+
echo " - $(basename "$item")"
12+
rm -rf "$item"
13+
fi
14+
done
15+
echo "✅ Done!"
16+
else
17+
echo "⚠️ Directory does not exist: $BOT_DIR"
18+
fi
19+

0 commit comments

Comments
 (0)