Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
CommonstackAI
TokenSlim
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
TokenSlim
/
test_openclaw_integration.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
54 lines (44 loc) · 2.08 KB
main
Breadcrumbs
TokenSlim
/
test_openclaw_integration.sh
Copy path
Top
File metadata and controls
Code
Blame
54 lines (44 loc) · 2.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# OpenClaw + STG 集成测试脚本
echo "=========================================="
echo "OpenClaw + STG 集成测试"
echo "=========================================="
echo ""
# 设置代理
export HTTPS_PROXY=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890
# 测试 1: 简单对话(不触发压缩)
echo "测试 1: 简单对话(应该不触发压缩)"
echo "------------------------------------------"
echo "请解释什么是 CAP 定理" | openclaw chat --model openrouter:auto --no-stream 2>&1 | tail -20
echo ""
echo ""
# 测试 2: 创建一个长对话来触发压缩
echo "测试 2: 长对话测试(应该触发压缩)"
echo "------------------------------------------"
# 创建临时会话文件
SESSION_FILE="/tmp/openclaw_stg_test_session.txt"
cat > "$SESSION_FILE" << 'EOF'
请详细解释分布式系统中的 CAP 定理,包括一致性、可用性和分区容错性的含义。
EOF
echo "第 1 轮: 询问 CAP 定理"
cat "$SESSION_FILE" | openclaw chat --model openrouter:auto --no-stream --session stg-test 2>&1 | tail -20
echo ""
# 第 2 轮
echo "第 2 轮: 询问实际案例"
echo "请举几个实际的分布式系统案例,说明它们如何在 CAP 中做出权衡选择。" | openclaw chat --model openrouter:auto --no-stream --session stg-test 2>&1 | tail -20
echo ""
# 第 3 轮
echo "第 3 轮: 询问 BASE 理论"
echo "那么 BASE 理论和 CAP 定理有什么关系?请详细说明。" | openclaw chat --model openrouter:auto --no-stream --session stg-test 2>&1 | tail -20
echo ""
# 第 4 轮 - 这一轮应该触发压缩
echo "第 4 轮: 总结(应该触发压缩)"
echo "请总结一下我们讨论的所有内容,包括 CAP 定理、实际案例和 BASE 理论。" | openclaw chat --model openrouter:auto --no-stream --session stg-test 2>&1 | tail -20
echo ""
echo "=========================================="
echo "测试完成!"
echo "=========================================="
echo ""
echo "请检查 STG 服务器日志,查看压缩是否被触发。"
echo "预期:第 4 轮对话应该触发压缩(总 tokens > 4096)"
You can’t perform that action at this time.