Skip to content

Commit cbb73bf

Browse files
feat: 同步upstream v4.11.2并解决冲突,保留MOD管理器新布局
- 合并upstream27个新提交 - 解决4个冲突文件(i18n、ReadmeDialog、ExtensionPage) - 保留MOD管理器架构重构 - 吸收upstream的视图模式持久化功能
1 parent 34921e9 commit cbb73bf

7 files changed

Lines changed: 757 additions & 539 deletions

File tree

astrbot/builtin_stars/astrbot/process_llm_request.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,20 @@ async def _ensure_persona(self, req: ProviderRequest, cfg: dict, umo: str):
3737

3838
if not persona_id:
3939
persona_id = req.conversation.persona_id or cfg.get("default_personality")
40-
if not persona_id and persona_id != "[%None]": # [%None] 为用户取消人格
41-
default_persona = self.ctx.persona_manager.selected_default_persona_v3
42-
if default_persona:
43-
persona_id = default_persona["name"]
40+
41+
# [%None] 为用户取消人格
42+
# 同时兼容配置为 "default" 但库中不存在该 persona 的情况:
43+
# - 优先使用当前 persona_manager 选中的默认 persona(会被插件如 meme_manager 修改)
44+
# - 再兜底用 get_default_persona_v3()
45+
if (not persona_id or persona_id == "default") and persona_id != "[%None]":
46+
default_persona = self.ctx.persona_manager.selected_default_persona_v3
47+
if not default_persona:
48+
try:
49+
default_persona = await self.ctx.persona_manager.get_default_persona_v3(umo)
50+
except Exception:
51+
default_persona = None
52+
if default_persona:
53+
persona_id = default_persona.get("name") or persona_id
4454

4555
persona = next(
4656
builtins.filter(
@@ -49,6 +59,16 @@ async def _ensure_persona(self, req: ProviderRequest, cfg: dict, umo: str):
4959
),
5060
None,
5161
)
62+
63+
# 兼容:配置指向的 persona 不存在时,回退到默认 persona,避免 system_prompt 为空
64+
if not persona and persona_id != "[%None]":
65+
persona = self.ctx.persona_manager.selected_default_persona_v3
66+
if not persona:
67+
try:
68+
persona = await self.ctx.persona_manager.get_default_persona_v3(umo)
69+
except Exception:
70+
persona = None
71+
5272
if persona:
5373
if prompt := persona["prompt"]:
5474
req.system_prompt += prompt

astrbot/dashboard/routes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .knowledge_base import KnowledgeBaseRoute
99
from .log import LogRoute
1010
from .persona import PersonaRoute
11+
from .pipeline import PipelineRoute
1112
from .platform import PlatformRoute
1213
from .plugin import PluginRoute
1314
from .session_management import SessionManagementRoute
@@ -27,6 +28,7 @@
2728
"KnowledgeBaseRoute",
2829
"LogRoute",
2930
"PersonaRoute",
31+
"PipelineRoute",
3032
"PlatformRoute",
3133
"PluginRoute",
3234
"SessionManagementRoute",

astrbot/dashboard/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __init__(
6969
core_lifecycle.plugin_manager,
7070
)
7171
self.command_route = CommandRoute(self.context)
72+
self.pipeline_route = PipelineRoute(self.context, core_lifecycle)
7273
self.cr = ConfigRoute(self.context, core_lifecycle)
7374
self.lr = LogRoute(self.context, core_lifecycle.log_broker)
7475
self.sfr = StaticFileRoute(self.context)

dashboard/src/components/shared/ReadmeDialog.vue

Lines changed: 88 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,27 @@ const _show = computed({
247247
</template>
248248

249249
<style>
250+
/* 更贴近 GitHub 的 markdown 展示样式(不引入新依赖,仅调整样式)
251+
* 合并策略:颜色/背景走 upstream 的 var(--v-theme-*) token;保留本地布局增强(word-wrap、首尾 margin、task list、表格横向滚动)
252+
*/
250253
.markdown-body {
251254
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
252255
sans-serif;
256+
font-size: 16px;
253257
line-height: 1.6;
258+
word-wrap: break-word;
254259
padding: 8px 0;
255260
color: var(--v-theme-secondaryText);
256261
}
257262
263+
.markdown-body > :first-child {
264+
margin-top: 0;
265+
}
266+
267+
.markdown-body > :last-child {
268+
margin-bottom: 0;
269+
}
270+
258271
.markdown-body h1,
259272
.markdown-body h2,
260273
.markdown-body h3,
@@ -279,17 +292,66 @@ const _show = computed({
279292
padding-bottom: 0.3em;
280293
}
281294
295+
.markdown-body h3 {
296+
font-size: 1.25em;
297+
}
298+
282299
.markdown-body p {
283300
margin-top: 0;
284301
margin-bottom: 16px;
285302
}
286303
304+
.markdown-body hr {
305+
height: 0.25em;
306+
padding: 0;
307+
margin: 24px 0;
308+
background-color: var(--v-theme-containerBg);
309+
border: 0;
310+
}
311+
312+
.markdown-body a {
313+
color: var(--v-theme-primary);
314+
text-decoration: none;
315+
}
316+
317+
.markdown-body a:hover {
318+
text-decoration: underline;
319+
}
320+
321+
/* Lists */
322+
.markdown-body ul,
323+
.markdown-body ol {
324+
padding-left: 2em;
325+
margin-top: 0;
326+
margin-bottom: 16px;
327+
}
328+
329+
.markdown-body li + li {
330+
margin-top: 0.25em;
331+
}
332+
333+
.markdown-body li > p {
334+
margin-top: 0;
335+
}
336+
337+
/* Task list */
338+
.markdown-body .task-list-item {
339+
list-style-type: none;
340+
}
341+
342+
.markdown-body .task-list-item input[type="checkbox"] {
343+
margin: 0 0.35em 0 0;
344+
vertical-align: middle;
345+
}
346+
347+
/* Code */
287348
.markdown-body code {
288349
padding: 0.2em 0.4em;
289350
margin: 0;
290351
background-color: var(--v-theme-codeBg);
291-
border-radius: 3px;
292-
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
352+
border-radius: 6px;
353+
font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo,
354+
monospace;
293355
font-size: 85%;
294356
}
295357
@@ -299,57 +361,53 @@ const _show = computed({
299361
font-size: 85%;
300362
line-height: 1.45;
301363
background-color: var(--v-theme-containerBg);
302-
border-radius: 3px;
303-
margin-bottom: 16px;
364+
border: 1px solid var(--v-theme-border);
365+
border-radius: 6px;
366+
margin: 0 0 16px;
304367
}
305368
306369
.markdown-body pre code {
307370
background-color: transparent;
308371
padding: 0;
309372
}
310373
311-
.markdown-body ul,
312-
.markdown-body ol {
313-
padding-left: 2em;
314-
margin-bottom: 16px;
315-
}
316-
317-
.markdown-body img {
318-
max-width: 100%;
319-
margin: 8px 0;
320-
box-sizing: border-box;
321-
background-color: var(--v-theme-background);
322-
border-radius: 3px;
323-
}
324-
374+
/* Blockquote */
325375
.markdown-body blockquote {
326376
padding: 0 1em;
327377
color: var(--v-theme-secondaryText);
328378
border-left: 0.25em solid var(--v-theme-border);
329-
margin-bottom: 16px;
330-
}
331-
332-
.markdown-body a {
333-
color: var(--v-theme-primary);
334-
text-decoration: none;
379+
margin: 0 0 16px;
335380
}
336381
337-
.markdown-body a:hover {
338-
text-decoration: underline;
382+
/* Images */
383+
.markdown-body img {
384+
max-width: 100%;
385+
height: auto;
386+
margin: 0.5em 0;
387+
box-sizing: border-box;
388+
background-color: var(--v-theme-background);
389+
border-radius: 6px;
339390
}
340391
392+
/* Tables (GitHub-like + 横向滚动) */
341393
.markdown-body table {
342394
border-spacing: 0;
343395
border-collapse: collapse;
344-
width: 100%;
345-
overflow: auto;
346-
margin-bottom: 16px;
396+
width: max-content;
397+
min-width: 100%;
398+
display: block;
399+
overflow-x: auto;
400+
margin: 0 0 16px;
347401
}
348402
349403
.markdown-body table th,
350404
.markdown-body table td {
351405
padding: 6px 13px;
352-
border: 1px solid var(--v-theme-background);
406+
border: 1px solid var(--v-theme-border);
407+
}
408+
409+
.markdown-body table th {
410+
font-weight: 600;
353411
}
354412
355413
.markdown-body table tr {
@@ -358,15 +416,7 @@ const _show = computed({
358416
}
359417
360418
.markdown-body table tr:nth-child(2n) {
361-
background-color: var(--v-theme-background);
362-
}
363-
364-
.markdown-body hr {
365-
height: 0.25em;
366-
padding: 0;
367-
margin: 24px 0;
368419
background-color: var(--v-theme-containerBg);
369-
border: 0;
370420
}
371421
</style>
372422

dashboard/src/i18n/locales/en-US/features/extension.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
"handlersOperation": "Manage Handlers",
88
"market": "Extension Market"
99
},
10+
"modManager": {
11+
"panelTabs": {
12+
"info": "Info",
13+
"config": "Configuration",
14+
"behavior": "Behavior",
15+
"overview": "Overview"
16+
}
17+
},
1018
"search": {
1119
"placeholder": "Search extensions...",
1220
"marketPlaceholder": "Search market extensions..."
@@ -216,5 +224,71 @@
216224
},
217225
"pluginChangelog": {
218226
"menuTitle": "View Changelog"
227+
},
228+
"pipeline": {
229+
"tabTitle": "Execution Chain",
230+
"traceTabTitle": "Impact Chain",
231+
"toolbar": {
232+
"refresh": "Refresh Snapshot",
233+
"promptPreview": "Prompt Preview"
234+
},
235+
"scope": {
236+
"label": "Scope",
237+
"global": "Global",
238+
"session": "Session",
239+
"sessionUmo": "Session UMO"
240+
},
241+
"rightTabs": {
242+
"detail": "Stage Detail",
243+
"conflicts": "Conflict List"
244+
},
245+
"fishbone": {
246+
"noSnapshot": "No snapshot data",
247+
"noParticipants": "No participants",
248+
"viewDetail": "View detail"
249+
},
250+
"detail": {
251+
"viewImpactChain": "View Impact Chain",
252+
"noSnapshot": "No snapshot data",
253+
"noStageSelected": "No stage selected",
254+
"noStageSelectedHint": "Select a stage from the fishbone on the left",
255+
"noParticipants": "No participants",
256+
"noParticipantsHint": "No plugins participated in this stage",
257+
"participants": " participants",
258+
"conflicts": " conflicts",
259+
"plugin": "Plugin",
260+
"trigger": "Trigger"
261+
},
262+
"conflictList": {
263+
"title": "Conflict List",
264+
"total": "{count} total",
265+
"none": "No conflicts",
266+
"noneHint": "No conflicts detected",
267+
"severity": {
268+
"error": "Critical",
269+
"warn": "Warning",
270+
"info": "Info"
271+
},
272+
"involved": "Involved"
273+
},
274+
"promptPreview": {
275+
"title": "Prompt Injection Preview",
276+
"emptyTitle": "No data",
277+
"emptyHint": "This snapshot does not contain prompt preview information",
278+
"overwriteWarn": "Multiple overwrite operations detected; final prompt may be overwritten and order may be unstable.",
279+
"contexts": "contexts",
280+
"injectedBy": "injected_by",
281+
"chain": "Injection chain",
282+
"headers": {
283+
"plugin": "Plugin",
284+
"handler": "Handler",
285+
"priority": "Priority",
286+
"field": "Field",
287+
"mutation": "Mutation"
288+
},
289+
"finalSystemPrompt": "Final System Prompt",
290+
"finalPrompt": "Final Prompt",
291+
"close": "Close"
292+
}
219293
}
220294
}

0 commit comments

Comments
 (0)