Compare commits

..

1 Commits

7 changed files with 2771 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ import os
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
VERSION = "4.0.0-beta.2"
VERSION = "4.0.0"
DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db")
# 默认配置
@@ -51,6 +51,10 @@ DEFAULT_CONFIG = {
"enable": True,
"default_provider_id": "",
"default_image_caption_provider_id": "",
"default_summarize_provider_id": "",
"context_exceed_calc_method": "token_size",
"max_token_size": 128000,
"max_context_length": 100,
"image_caption_prompt": "Please describe the image using Chinese.",
"provider_pool": ["*"], # "*" 表示使用所有可用的提供者
"wake_prefix": "",
@@ -64,7 +68,6 @@ DEFAULT_CONFIG = {
"default_personality": "default",
"persona_pool": ["*"],
"prompt_prefix": "",
"max_context_length": -1,
"dequeue_context_length": 1,
"streaming_response": False,
"show_tool_use_status": False,
@@ -1832,6 +1835,12 @@ CONFIG_METADATA_3 = {
"_special": "select_provider",
"hint": "留空时使用第一个模型。",
},
"provider_settings.default_summarize_provider_id": {
"description": "默认对话总结模型",
"type": "string",
"_special": "select_provider",
"hint": "留空代表不进行对话总结。可用于压缩上下文以减少 token 用量,并一定程度上保持历史聊天记忆。",
},
"provider_settings.default_image_caption_provider_id": {
"description": "默认图片转述模型",
"type": "string",
@@ -1850,6 +1859,28 @@ CONFIG_METADATA_3 = {
"hint": "留空代表不使用。",
"_special": "select_provider_tts",
},
"provider_settings.context_exceed_calc_method": {
"description": "上下文超限的触发策略",
"type": "string",
"options": ["token_size", "context_length"],
"labels": ["基于 Token 长度(估算)", "基于对话轮数"],
"hint": "如配置了对话总结模型,则触发时总结对话内容,否则丢弃最旧部分。"
},
"provider_settings.max_context_length": {
"description": "对话轮数上限",
"type": "int",
"condition": {
"provider_settings.context_exceed_calc_method": "context_length"
}
},
"provider_settings.max_token_size": {
"description": "Token 长度上限(估算)",
"type": "int",
"hint": "超出这个数量时丢弃最旧的部分。",
"condition": {
"provider_settings.context_exceed_calc_method": "token_size"
}
},
"provider_settings.image_caption_prompt": {
"description": "图片转述提示词",
"type": "text",
@@ -1926,7 +1957,7 @@ CONFIG_METADATA_3 = {
},
"provider_settings.max_agent_step": {
"description": "工具调用轮数上限",
"type": "bool",
"type": "int",
},
"provider_settings.streaming_response": {
"description": "流式回复",
@@ -1936,11 +1967,6 @@ CONFIG_METADATA_3 = {
"description": "不支持流式回复的平台采取分段输出",
"type": "bool",
},
"provider_settings.max_context_length": {
"description": "最多携带对话轮数",
"type": "int",
"hint": "超出这个数量时丢弃最旧的部分,一轮聊天记为 1 条。-1 为不限制。",
},
"provider_settings.dequeue_context_length": {
"description": "丢弃对话轮数",
"type": "int",

View File

@@ -1,3 +0,0 @@
# What's Changed
> 请仔细阅读:**这是 v4.0.0 的测试版本beta.1),功能尚未完全稳定和加入**。v4.0.0 被设计为向前兼容,如有任何插件兼容性问题或者其他异常请在 GitHub 提交 [Issue](https://github.com/AstrBotDevs/AstrBot/issues)。在测试版本期间,您可以无缝回退到旧版本的 AstrBot并且数据不受影响。新版本文档请[从此](https://docs-v4.astrbot.app/)访问,直到第一个 v4.0.0 稳定版本发布。

View File

@@ -1 +0,0 @@
# What's Changed

View File

@@ -29,7 +29,7 @@ class LongTermMemory:
except BaseException as e:
logger.error(e)
max_cnt = 300
image_caption = True if cfg["image_caption_provider_id"] else False
image_caption = cfg["image_caption"]
image_caption_prompt = cfg["image_caption_prompt"]
image_caption_provider_id = cfg["image_caption_provider_id"]
active_reply = cfg["active_reply"]
@@ -112,6 +112,7 @@ class LongTermMemory:
if isinstance(comp, Plain):
final_message += f" {comp.text}"
elif isinstance(comp, Image):
cfg = self.cfg(event)
if cfg["image_caption"]:
try:
caption = await self.get_image_caption(

View File

@@ -1,6 +1,6 @@
[project]
name = "AstrBot"
version = "4.0.0-beta.2"
version = "4.0.0"
description = "易上手的多平台 LLM 聊天机器人及开发框架"
readme = "README.md"
requires-python = ">=3.10"

View File

@@ -39,7 +39,4 @@ faiss-cpu
aiosqlite
py-cord>=2.6.1
slack-sdk
pydub
sqlmodel
deprecated
sqlalchemy[asyncio]
pydub

2733
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff