Merge branch 'AstrBotDevs:master' into master

This commit is contained in:
Richard X.
2025-05-30 10:37:59 +08:00
committed by GitHub
7 changed files with 32 additions and 20 deletions
+14 -7
View File
@@ -13,7 +13,6 @@ import traceback
from types import ModuleType
from typing import List
import nh3
import yaml
from astrbot.core import logger, pip_installer, sp
@@ -38,6 +37,12 @@ except ImportError:
if os.getenv("ASTRBOT_RELOAD", "0") == "1":
logger.warning("未安装 watchfiles,无法实现插件的热重载。")
try:
import nh3
except ImportError:
logger.warning("未安装 nh3 库,无法清理插件 README.md 中的 HTML 标签。")
nh3 = None
class PluginManager:
def __init__(self, context: Context, config: AstrBotConfig):
@@ -141,11 +146,13 @@ class PluginManager:
if os.path.exists(os.path.join(path, d, "main.py")) or os.path.exists(
os.path.join(path, d, d + ".py")
):
modules.append({
"pname": d,
"module": module_str,
"module_path": os.path.join(path, d, module_str),
})
modules.append(
{
"pname": d,
"module": module_str,
"module_path": os.path.join(path, d, module_str),
}
)
return modules
def _get_plugin_modules(self) -> List[dict]:
@@ -635,7 +642,7 @@ class PluginManager:
if not os.path.exists(readme_path):
readme_path = os.path.join(plugin_path, "readme.md")
if os.path.exists(readme_path):
if os.path.exists(readme_path) and nh3:
try:
with open(readme_path, "r", encoding="utf-8") as f:
readme_content = f.read()
+5 -1
View File
@@ -21,7 +21,11 @@ class AuthRoute(Route):
post_data = await request.json
if post_data["username"] == username and post_data["password"] == password:
change_pwd_hint = False
if username == "astrbot" and password == "77b90590a8945a7d36c963981a307dc9":
if (
username == "astrbot"
and password == "77b90590a8945a7d36c963981a307dc9"
and not DEMO_MODE
):
change_pwd_hint = True
logger.warning("为了保证安全,请尽快修改默认密码。")
+9 -1
View File
@@ -4,7 +4,6 @@ import os
import ssl
import certifi
import nh3
from .route import Route, Response, RouteContext
from astrbot.core import logger
@@ -19,6 +18,12 @@ from astrbot.core.star.filter.regex import RegexFilter
from astrbot.core.star.star_handler import EventType
from astrbot.core import DEMO_MODE
try:
import nh3
except ImportError:
logger.warning("未安装 nh3 库,无法清理插件 README.md 中的 HTML 标签。")
nh3 = None
class PluginRoute(Route):
def __init__(
@@ -327,6 +332,9 @@ class PluginRoute(Route):
return Response().error(str(e)).__dict__
async def get_plugin_readme(self):
if not nh3:
return Response().error("未安装 nh3 库").__dict__
plugin_name = request.args.get("name")
logger.debug(f"正在获取插件 {plugin_name} 的README文件内容")
@@ -77,7 +77,7 @@ const viewReadme = () => {
<template>
<v-card class="mx-auto d-flex flex-column" :elevation="highlight ? 0 : 1"
:style="{ height: $vuetify.display.xs ? '250px' : '220px',
backgroundColor: useCustomizerStore().uiTheme==='PurpleTheme' ? '#eef2f6' : '#282833',
backgroundColor: useCustomizerStore().uiTheme==='PurpleTheme' ? '#ffffff' : '#282833',
color: useCustomizerStore().uiTheme==='PurpleTheme' ? '#000000dd' : '#ffffff'}">
<v-card-text style="padding: 16px; padding-bottom: 0px; display: flex; justify-content: space-between;">
-8
View File
@@ -13,17 +13,10 @@ marked.setOptions({
<v-card-text class="chat-page-container">
<div class="chat-layout">
<div class="sidebar-panel">
<div class="sidebar-header">
<v-btn icon variant="plain">
<v-icon icon="mdi-menu" color="deep-purple"></v-icon>
</v-btn>
</div>
<div style="padding: 16px; padding-top: 8px;">
<v-btn variant="elevated" rounded="lg" class="new-chat-btn" @click="newC" :disabled="!currCid"
prepend-icon="mdi-plus">创建对话</v-btn>
</div>
<div class="conversations-container">
<v-card class="conversation-list-card" v-if="conversations.length > 0" flat>
@@ -718,7 +711,6 @@ export default {
height: 100%;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
background-color: var(--v-theme-surface);
}
.chat-page-container {
+1 -1
View File
@@ -20,7 +20,7 @@ dependencies = [
"defusedxml>=0.7.1",
"dingtalk-stream>=0.22.1",
"docstring-parser>=0.16",
"faiss-cpu>=1.11.0",
"faiss-cpu>=1.10.0",
"filelock>=3.18.0",
"google-genai>=1.14.0",
"googlesearch-python>=1.3.0",
+2 -1
View File
@@ -36,4 +36,5 @@ filelock
watchfiles
websockets
faiss-cpu
aiosqlite
aiosqlite
nh3