mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-18 02:00:09 +08:00
Merge remote-tracking branch 'origin' into dev
This commit is contained in:
2
.github/workflows/build-docs.yml
vendored
2
.github/workflows/build-docs.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.7
|
||||
uses: pnpm/action-setup@v6.0.8
|
||||
with:
|
||||
version: 10.28.2
|
||||
- name: Setup Node.js
|
||||
|
||||
2
.github/workflows/dashboard_ci.yml
vendored
2
.github/workflows/dashboard_ci.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.7
|
||||
uses: pnpm/action-setup@v6.0.8
|
||||
with:
|
||||
version: 10.28.2
|
||||
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -51,7 +51,7 @@ jobs:
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.7
|
||||
uses: pnpm/action-setup@v6.0.8
|
||||
with:
|
||||
version: 10.28.2
|
||||
|
||||
|
||||
@@ -236,11 +236,15 @@ class LLMSummaryCompressor:
|
||||
# generate summary
|
||||
try:
|
||||
response = await self.provider.text_chat(contexts=llm_payload)
|
||||
summary_content = response.completion_text
|
||||
summary_content = (response.completion_text or "").strip()
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to generate summary: {e}")
|
||||
return messages
|
||||
|
||||
if not summary_content:
|
||||
logger.warning("LLM context compression returned an empty summary.")
|
||||
return messages
|
||||
|
||||
# build result
|
||||
result = []
|
||||
result.extend(system_messages)
|
||||
|
||||
@@ -51,7 +51,7 @@ Set dashboard.host in data/cmd_config.json to enable remote access.
|
||||
},
|
||||
```
|
||||
|
||||
删除 `username`, `password`, `pbkdf2_password`, `password_storage_upgraded`, `password_change_required`, `jwt_secret` 五个字段(连同值一起),然后保存。上述片段修改类似如下:
|
||||
删除 `username`, `password`, `pbkdf2_password`, `password_storage_upgraded`, `password_change_required`, `jwt_secret` 六个字段(连同值一起),然后保存。上述片段修改类似如下:
|
||||
|
||||
|
||||
```json
|
||||
|
||||
@@ -94,6 +94,25 @@ class TestContextManager:
|
||||
|
||||
assert isinstance(manager.compressor, TruncateByTurnsCompressor)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_llm_compressor_keeps_history_when_summary_is_empty(self):
|
||||
from astrbot.core.agent.context.compressor import LLMSummaryCompressor
|
||||
|
||||
provider = MockProvider()
|
||||
provider.text_chat = AsyncMock(
|
||||
return_value=LLMResponse(role="assistant", completion_text=" ")
|
||||
)
|
||||
compressor = LLMSummaryCompressor(provider=provider, keep_recent=2) # type: ignore[arg-type]
|
||||
messages = self.create_messages(6)
|
||||
|
||||
with patch("astrbot.core.agent.context.compressor.logger") as mock_logger:
|
||||
result = await compressor(messages)
|
||||
|
||||
assert result == messages
|
||||
mock_logger.warning.assert_called_once_with(
|
||||
"LLM context compression returned an empty summary."
|
||||
)
|
||||
|
||||
# ==================== Empty and Edge Cases ====================
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user