Compare commits

..

3 Commits

Author SHA1 Message Date
rdmclin2 51e3d16795 chore: add permissions 2026-02-11 23:03:00 +08:00
rdmclin2 5643c7815d chore: change main to dev sync workflow to canary 2026-02-11 22:55:55 +08:00
LiJian 6eee83ab4c ♻️ refactor: imporve agent builder prompt (#12259) 2026-02-11 21:16:37 +08:00
4 changed files with 70 additions and 51 deletions
@@ -0,0 +1,46 @@
name: 🔄 Branch Synchronization
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
sync-branches:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global user.name 'lobehubbot'
git config --global user.email 'i@lobehub.com'
- name: Prepare sync branch
id: branch
run: |
echo "SYNC_BRANCH_MAIN_CANARY=sync/main-to-canary-$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Sync main to canary
if: github.ref == 'refs/heads/main'
run: |
# Sync main to canary
git checkout main
SYNC_BRANCH_CANARY=${{ env.SYNC_BRANCH_MAIN_CANARY }}
git checkout -B $SYNC_BRANCH_CANARY
DIFF=$(git diff origin/canary...)
if [ -z "$DIFF" ]; then
echo "No changes to sync"
exit 0
fi
git push origin $SYNC_BRANCH_CANARY -f
gh pr create --base canary --head $SYNC_BRANCH_CANARY --title "Sync main branch to canary branch" --body "Automatic sync" || exit 0
env:
GH_TOKEN: ${{ github.token }}
-42
View File
@@ -1,42 +0,0 @@
name: 🔄 Branch Synchronization
on:
push:
branches:
- main
jobs:
sync-branches:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
- name: Prepare sync branch
id: branch
run: |
echo "SYNC_BRANCH_MAIN_DEV=sync/main-to-dev-$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Sync main to dev
if: github.ref == 'refs/heads/main'
run: |
# Sync main to dev
git checkout main
SYNC_BRANCH_DEV=${{ env.SYNC_BRANCH_MAIN_DEV }}
git checkout -B $SYNC_BRANCH_DEV
DIFF=$(git diff origin/dev...)
if [ -z "$DIFF" ]; then
echo "No changes to sync"
exit 0
fi
git push origin $SYNC_BRANCH_DEV -f
gh pr create --base dev --head $SYNC_BRANCH_DEV --title "Sync main branch to dev branch" --body "Automatic sync" || exit 0
env:
GH_TOKEN: ${{ github.token }}
+1 -1
View File
@@ -474,4 +474,4 @@
"drizzle-orm": "0.44.7"
}
}
}
}
@@ -82,18 +82,22 @@ Always adapt to user's language. Use natural descriptions, not raw field names.
1. **Use injected context**: The current agent's config and meta are already available in the conversation context. Reference them directly instead of calling read APIs.
2. **Explain your changes**: When modifying configurations, explain what you're changing and why it might benefit the user.
3. **Use updateConfig for config changes**: For model, provider, or other config changes, use the updateConfig API.
4. **Validate user intent**: For significant changes (like changing the model or disabling important plugins), confirm with the user before proceeding.
5. **Provide recommendations**: When users ask for advice, explain the trade-offs of different options based on their use case.
6. **Use user's language**: Always respond in the same language the user is using.
7. **Keep it simple**: Focus on core settings. Don't overwhelm users with advanced options unless they ask.
8. **Install plugins one by one**: When multiple plugins need to be installed, install them sequentially one at a time instead of batching. This ensures better error handling, allows users to understand each plugin's purpose, and makes it easier to troubleshoot if something goes wrong.
4. **Batch config updates together**: When multiple config fields need to be updated, ALWAYS merge them into a single updateConfig call instead of making multiple sequential calls. This prevents race conditions and provides a better user experience.
- ✅ Good: Use updateConfig with { config: { model: "claude-sonnet-4-5-20250929", temperature: 0.7, openingMessage: "Hello!" } }
- ❌ Bad: Multiple sequential updateConfig calls for different fields
- Exception: If you must make multiple updateConfig calls (e.g., due to complex logic or different update contexts), ALWAYS report the changes after each update before proceeding to the next one.
5. **Validate user intent**: For significant changes (like changing the model or disabling important plugins), confirm with the user before proceeding.
6. **Provide recommendations**: When users ask for advice, explain the trade-offs of different options based on their use case.
7. **Use user's language**: Always respond in the same language the user is using.
8. **Keep it simple**: Focus on core settings. Don't overwhelm users with advanced options unless they ask.
9. **Install plugins one by one**: When multiple plugins need to be installed, install them sequentially one at a time instead of batching. This ensures better error handling, allows users to understand each plugin's purpose, and makes it easier to troubleshoot if something goes wrong.
</guidelines>
<configuration_knowledge>
**Core Settings (always show when asked about configuration):**
**Model & Provider:**
- model: The AI model identifier (e.g., "gpt-4o", "gpt-4o-mini", "claude-3-5-sonnet-20241022", "gemini-1.5-pro")
- model: The AI model identifier (e.g., "gpt-5.2", "claude-sonnet-4-5-20250929", "gemini-3-pro")
- provider: The AI provider (e.g., "openai", "anthropic", "google", "azure")
- Different models have different capabilities, costs, and speed trade-offs
@@ -144,11 +148,22 @@ Always adapt to user's language. Use natural descriptions, not raw field names.
User: "帮我创建一个代码助手" / "Help me create a coding assistant"
Action: Follow the modification sequence:
1. First, use updateMeta to set identity: { avatar: "👨‍💻", title: "Code Assistant", description: "A helpful coding assistant for debugging and writing code" }
2. Then, use updateConfig to set model and tools: { config: { model: "claude-3-5-sonnet-20241022", provider: "anthropic" } } and enable relevant plugins
2. Then, use updateConfig to set model and tools: { config: { model: "claude-sonnet-4-5-20250929", provider: "anthropic" } } and enable relevant plugins
3. Finally, use updatePrompt to write the system prompt that references the established identity and tools
User: "帮我把模型改成 Claude"
Action: Reference the current model from injected context, then use updateConfig with { config: { model: "claude-3-5-sonnet-20241022", provider: "anthropic" } }
Action: Reference the current model from injected context, then use updateConfig with { config: { model: "claude-sonnet-4-5-20250929", provider: "anthropic" } }
User: "帮我把模型改成 Claude,并且设置 temperature 为 0.7,还要添加开场白" / "Change model to Claude, set temperature to 0.7, and add an opening message"
Action: ✅ CORRECT - Merge all config changes into ONE updateConfig call with all fields:
Use updateConfig with { config: { model: "claude-sonnet-4-5-20250929", provider: "anthropic", params: { temperature: 0.7 }, openingMessage: "Hello! I'm powered by Claude." } }
Then report all changes made in a single summary.
❌ INCORRECT - Do NOT make multiple sequential updateConfig calls like:
- First updateConfig for model/provider
- Then another updateConfig for params
- Then another updateConfig for openingMessage
This creates unnecessary multiple operations and poor user experience.
User: "Enable web browsing for this agent"
Action: Use togglePlugin with pluginId "lobe-web-browsing" and enabled: true