v0.1.4-p4
parent
5058599de4
commit
3ca7eff38b
|
|
@ -27,16 +27,11 @@ PANEL_ACCESS_PASSWORD=
|
|||
# The following platform-level items are now managed in sys_setting / 平台参数:
|
||||
# - page_size
|
||||
# - chat_pull_page_size
|
||||
# - command_auto_unlock_seconds
|
||||
# - upload_max_mb
|
||||
# - allowed_attachment_extensions
|
||||
# - workspace_download_extensions
|
||||
# - speech_enabled
|
||||
# - speech_max_audio_seconds
|
||||
# - speech_default_language
|
||||
# - speech_force_simplified
|
||||
# - speech_audio_preprocess
|
||||
# - speech_audio_filter
|
||||
# - speech_initial_prompt
|
||||
|
||||
# Local speech-to-text (Whisper via whisper.cpp model file)
|
||||
STT_MODEL=ggml-small-q8_0.bin
|
||||
|
|
|
|||
|
|
@ -45,11 +45,6 @@ def _reconcile_registered_images(session: Session) -> None:
|
|||
session.commit()
|
||||
|
||||
|
||||
def reconcile_image_registry(session: Session) -> None:
|
||||
"""Backward-compatible alias for older callers after router refactor."""
|
||||
_reconcile_registered_images(session)
|
||||
|
||||
|
||||
@router.get("/api/images")
|
||||
def list_images(session: Session = Depends(get_session)):
|
||||
cached = cache.get_json(_cache_key_images())
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ def get_system_defaults():
|
|||
"bot": {
|
||||
"system_timezone": _get_default_system_timezone(),
|
||||
},
|
||||
"loading_page": platform_settings.loading_page.model_dump(),
|
||||
"chat": {
|
||||
"pull_page_size": platform_settings.chat_pull_page_size,
|
||||
"page_size": platform_settings.page_size,
|
||||
|
|
|
|||
|
|
@ -3,12 +3,6 @@ from typing import Any, Dict, List, Optional
|
|||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class LoadingPageSettings(BaseModel):
|
||||
title: str = "Dashboard Nanobot"
|
||||
subtitle: str = "平台正在准备管理面板"
|
||||
description: str = "请稍候,正在加载 Bot 平台数据。"
|
||||
|
||||
|
||||
class PlatformSettingsPayload(BaseModel):
|
||||
page_size: int = Field(default=10, ge=1, le=100)
|
||||
chat_pull_page_size: int = Field(default=60, ge=10, le=500)
|
||||
|
|
@ -17,15 +11,6 @@ class PlatformSettingsPayload(BaseModel):
|
|||
allowed_attachment_extensions: List[str] = Field(default_factory=list)
|
||||
workspace_download_extensions: List[str] = Field(default_factory=list)
|
||||
speech_enabled: bool = True
|
||||
speech_max_audio_seconds: int = Field(default=20, ge=5, le=600)
|
||||
speech_default_language: str = Field(default="zh", min_length=1, max_length=16)
|
||||
speech_force_simplified: bool = True
|
||||
speech_audio_preprocess: bool = True
|
||||
speech_audio_filter: str = Field(default="highpass=f=120,lowpass=f=7600,afftdn=nf=-20")
|
||||
speech_initial_prompt: str = Field(
|
||||
default="以下内容可能包含简体中文和英文术语。请优先输出简体中文,英文单词、缩写、品牌名和数字保持原文,不要翻译。"
|
||||
)
|
||||
loading_page: LoadingPageSettings = Field(default_factory=LoadingPageSettings)
|
||||
|
||||
|
||||
class PlatformUsageItem(BaseModel):
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from core.settings import (
|
|||
STT_MODEL,
|
||||
)
|
||||
from models.platform import PlatformSetting
|
||||
from schemas.platform import LoadingPageSettings, PlatformSettingsPayload
|
||||
from schemas.platform import PlatformSettingsPayload
|
||||
from services.platform_settings_core import (
|
||||
SETTING_KEYS,
|
||||
SYSTEM_SETTING_DEFINITIONS,
|
||||
|
|
@ -36,13 +36,6 @@ def default_platform_settings() -> PlatformSettingsPayload:
|
|||
allowed_attachment_extensions=list(bootstrap["allowed_attachment_extensions"]),
|
||||
workspace_download_extensions=list(bootstrap["workspace_download_extensions"]),
|
||||
speech_enabled=bool(bootstrap["speech_enabled"]),
|
||||
speech_max_audio_seconds=DEFAULT_STT_MAX_AUDIO_SECONDS,
|
||||
speech_default_language=DEFAULT_STT_DEFAULT_LANGUAGE,
|
||||
speech_force_simplified=DEFAULT_STT_FORCE_SIMPLIFIED,
|
||||
speech_audio_preprocess=DEFAULT_STT_AUDIO_PREPROCESS,
|
||||
speech_audio_filter=DEFAULT_STT_AUDIO_FILTER,
|
||||
speech_initial_prompt=DEFAULT_STT_INITIAL_PROMPT,
|
||||
loading_page=LoadingPageSettings(),
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -67,14 +60,6 @@ def get_platform_settings(session: Session) -> PlatformSettingsPayload:
|
|||
data.get("workspace_download_extensions", merged["workspace_download_extensions"])
|
||||
)
|
||||
merged["speech_enabled"] = bool(data.get("speech_enabled", merged["speech_enabled"]))
|
||||
loading_page = data.get("loading_page")
|
||||
if isinstance(loading_page, dict):
|
||||
current = dict(merged["loading_page"])
|
||||
for key in ("title", "subtitle", "description"):
|
||||
value = str(loading_page.get(key) or "").strip()
|
||||
if value:
|
||||
current[key] = value
|
||||
merged["loading_page"] = current
|
||||
return PlatformSettingsPayload.model_validate(merged)
|
||||
|
||||
|
||||
|
|
@ -87,7 +72,6 @@ def save_platform_settings(session: Session, payload: PlatformSettingsPayload) -
|
|||
allowed_attachment_extensions=_normalize_extension_list(payload.allowed_attachment_extensions),
|
||||
workspace_download_extensions=_normalize_extension_list(payload.workspace_download_extensions),
|
||||
speech_enabled=bool(payload.speech_enabled),
|
||||
loading_page=LoadingPageSettings.model_validate(payload.loading_page.model_dump()),
|
||||
)
|
||||
payload_by_key = normalized.model_dump()
|
||||
for key in SETTING_KEYS:
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 148 KiB |
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
|
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 4.0 KiB |
|
|
@ -18,6 +18,8 @@
|
|||
.drawer-shell {
|
||||
height: 100dvh;
|
||||
max-width: 100vw;
|
||||
padding: 10px 0 10px 14px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.drawer-shell.drawer-shell-standard {
|
||||
|
|
@ -29,16 +31,26 @@
|
|||
}
|
||||
|
||||
.drawer-shell-surface {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
background:
|
||||
linear-gradient(180deg, color-mix(in oklab, var(--panel) 96%, var(--brand-soft) 4%), var(--panel)),
|
||||
radial-gradient(circle at top left, color-mix(in oklab, var(--brand-soft) 34%, transparent), transparent 30%),
|
||||
radial-gradient(circle at left center, color-mix(in oklab, var(--brand-soft) 16%, transparent), transparent 36%),
|
||||
linear-gradient(180deg, color-mix(in oklab, var(--panel) 95%, var(--brand-soft) 5%), color-mix(in oklab, var(--panel-soft) 98%, transparent)),
|
||||
var(--panel);
|
||||
border-left: 1px solid color-mix(in oklab, var(--line) 78%, transparent);
|
||||
box-shadow: -18px 0 42px rgba(13, 24, 45, 0.22);
|
||||
border: 1px solid color-mix(in oklab, var(--line) 74%, transparent);
|
||||
border-right: 0;
|
||||
border-top-left-radius: 24px;
|
||||
border-bottom-left-radius: 24px;
|
||||
box-shadow:
|
||||
-24px 0 54px rgba(13, 24, 45, 0.2),
|
||||
-1px 0 0 color-mix(in oklab, var(--brand) 8%, transparent);
|
||||
opacity: 0.98;
|
||||
transform: translateX(56px);
|
||||
transition:
|
||||
|
|
@ -48,6 +60,23 @@
|
|||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.drawer-shell-surface::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 16px auto 16px 0;
|
||||
width: 2px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
color-mix(in oklab, var(--brand) 42%, transparent),
|
||||
color-mix(in oklab, var(--brand-soft) 24%, transparent)
|
||||
);
|
||||
box-shadow: 0 0 0 1px color-mix(in oklab, var(--brand) 8%, transparent);
|
||||
opacity: 0.84;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.drawer-shell-surface.is-open {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
|
|
@ -56,7 +85,9 @@
|
|||
.drawer-shell-header,
|
||||
.drawer-shell-footer {
|
||||
flex: 0 0 auto;
|
||||
background: inherit;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.drawer-shell-header {
|
||||
|
|
@ -104,6 +135,8 @@
|
|||
overflow: auto;
|
||||
padding: 20px 24px 24px;
|
||||
overscroll-behavior: contain;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.drawer-shell-footer {
|
||||
|
|
@ -137,6 +170,7 @@
|
|||
.drawer-shell.drawer-shell-standard,
|
||||
.drawer-shell.drawer-shell-extend {
|
||||
width: 100vw;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer-shell-header,
|
||||
|
|
@ -152,6 +186,17 @@
|
|||
.drawer-shell-header {
|
||||
padding-top: calc(18px + env(safe-area-inset-top, 0px));
|
||||
}
|
||||
|
||||
.drawer-shell-surface {
|
||||
border-radius: 0;
|
||||
border-inline: 0;
|
||||
border-block: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.drawer-shell-surface::before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ export function LucentTooltip({ content, children, side = 'top' }: LucentTooltip
|
|||
|
||||
const child = useMemo(() => {
|
||||
const first = Children.only(children) as ReactNode;
|
||||
return isValidElement(first) ? (first as ReactElement<{ 'aria-describedby'?: string }>) : null;
|
||||
return isValidElement(first) ? (first as ReactElement<{ 'aria-describedby'?: string; disabled?: boolean }>) : null;
|
||||
}, [children]);
|
||||
const childDisabled = Boolean(child?.props.disabled);
|
||||
|
||||
const updatePosition = useCallback(() => {
|
||||
const wrap = wrapRef.current;
|
||||
|
|
@ -104,14 +105,32 @@ export function LucentTooltip({ content, children, side = 'top' }: LucentTooltip
|
|||
useEffect(() => {
|
||||
if (!visible) return;
|
||||
const handleWindowChange = () => updatePosition();
|
||||
const handleDismiss = () => setVisible(false);
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
setVisible(false);
|
||||
}
|
||||
};
|
||||
window.addEventListener('scroll', handleWindowChange, true);
|
||||
window.addEventListener('resize', handleWindowChange);
|
||||
window.addEventListener('blur', handleDismiss);
|
||||
document.addEventListener('pointerdown', handleDismiss, true);
|
||||
document.addEventListener('keydown', handleKeyDown, true);
|
||||
return () => {
|
||||
window.removeEventListener('scroll', handleWindowChange, true);
|
||||
window.removeEventListener('resize', handleWindowChange);
|
||||
window.removeEventListener('blur', handleDismiss);
|
||||
document.removeEventListener('pointerdown', handleDismiss, true);
|
||||
document.removeEventListener('keydown', handleKeyDown, true);
|
||||
};
|
||||
}, [updatePosition, visible]);
|
||||
|
||||
useEffect(() => {
|
||||
if (childDisabled) {
|
||||
setVisible(false);
|
||||
}
|
||||
}, [childDisabled]);
|
||||
|
||||
if (!text) return <>{children}</>;
|
||||
|
||||
const enhancedChild = child
|
||||
|
|
@ -127,7 +146,14 @@ export function LucentTooltip({ content, children, side = 'top' }: LucentTooltip
|
|||
className="lucent-tooltip-wrap"
|
||||
onMouseEnter={() => setVisible(true)}
|
||||
onMouseLeave={() => setVisible(false)}
|
||||
onPointerDownCapture={() => setVisible(false)}
|
||||
onClickCapture={() => setVisible(false)}
|
||||
onFocusCapture={() => setVisible(true)}
|
||||
onKeyDownCapture={(event) => {
|
||||
if (event.key === 'Enter' || event.key === ' ' || event.key === 'Escape') {
|
||||
setVisible(false);
|
||||
}
|
||||
}}
|
||||
onBlurCapture={(event) => {
|
||||
if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {
|
||||
setVisible(false);
|
||||
|
|
|
|||
|
|
@ -275,10 +275,46 @@
|
|||
max-width: 720px;
|
||||
}
|
||||
|
||||
.skill-market-drawer-body {
|
||||
.skill-market-form-drawer-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
padding-bottom: 28px;
|
||||
}
|
||||
|
||||
.skill-market-form-modal {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.skill-market-form-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.skill-market-inline-actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.skill-market-inline-actions-wrap {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.skill-market-button-with-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.skill-market-editor-textarea {
|
||||
min-height: 180px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ export const dashboardEn = {
|
|||
quotedReplyLabel: 'Quoted reply',
|
||||
clearQuote: 'Clear quote',
|
||||
quoteOnlyMessage: '[quoted reply]',
|
||||
stagedSubmissionEmpty: 'Attachments or quoted reply only',
|
||||
stagedSubmissionRestore: 'Edit',
|
||||
stagedSubmissionRemove: 'Remove',
|
||||
stagedSubmissionQueued: 'Added to the staged queue. It will auto-send after earlier tasks finish.',
|
||||
stagedSubmissionRestored: 'Staged prompt restored to the composer.',
|
||||
stagedSubmissionAttachmentCount: (count: number) => `${count} attachment${count === 1 ? '' : 's'}`,
|
||||
goodReply: 'Good reply',
|
||||
badReply: 'Bad reply',
|
||||
feedbackUpSaved: 'Marked as good reply.',
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ export const dashboardZhCn = {
|
|||
quotedReplyLabel: '已引用回复',
|
||||
clearQuote: '取消引用',
|
||||
quoteOnlyMessage: '[引用回复]',
|
||||
stagedSubmissionEmpty: '仅包含附件或引用内容',
|
||||
stagedSubmissionRestore: '编辑',
|
||||
stagedSubmissionRemove: '移除',
|
||||
stagedSubmissionQueued: '已加入暂存队列,前序任务结束后会自动提交。',
|
||||
stagedSubmissionRestored: '暂存内容已恢复到输入框。',
|
||||
stagedSubmissionAttachmentCount: (count: number) => `附件 ${count}`,
|
||||
goodReply: '好回复',
|
||||
badReply: '坏回复',
|
||||
feedbackUpSaved: '已标记为好回复。',
|
||||
|
|
|
|||
|
|
@ -121,11 +121,6 @@
|
|||
background: color-mix(in oklab, var(--panel) 92%, white 8%);
|
||||
}
|
||||
|
||||
.ops-chat-topic-frame {
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ops-main-mode-tab {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
|
@ -221,41 +216,8 @@
|
|||
grid-template-rows: auto auto minmax(0, 1fr) auto;
|
||||
}
|
||||
|
||||
.ops-status-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ops-status-pill {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
padding: 5px 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
color: var(--text);
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.ops-status-pill.running {
|
||||
border-color: #2ca476;
|
||||
background: rgba(44, 164, 118, 0.16);
|
||||
}
|
||||
|
||||
.ops-status-pill.stopped,
|
||||
.ops-status-pill.exited {
|
||||
border-color: #d28686;
|
||||
background: rgba(209, 75, 75, 0.16);
|
||||
}
|
||||
|
||||
.ops-status-pill.error {
|
||||
border-color: #d14b4b;
|
||||
background: rgba(209, 75, 75, 0.2);
|
||||
}
|
||||
|
||||
.ops-status-pill.idle {
|
||||
border-color: #4b79d4;
|
||||
background: rgba(47, 105, 226, 0.16);
|
||||
.ops-panel-empty-copy {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.ops-switch-dot {
|
||||
|
|
@ -319,7 +281,3 @@
|
|||
0 16px 32px rgba(63, 116, 223, 0.26),
|
||||
inset 0 0 0 1px rgba(63, 116, 223, 0.78);
|
||||
}
|
||||
|
||||
.app-shell[data-theme='light'] .ops-status-pill {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,10 @@ export function BotDashboardModule({
|
|||
interrupt: dashboard.t.interrupt,
|
||||
noConversation: dashboard.t.noConversation,
|
||||
previewTitle: dashboard.t.previewTitle,
|
||||
stagedSubmissionAttachmentCount: dashboard.t.stagedSubmissionAttachmentCount,
|
||||
stagedSubmissionEmpty: dashboard.t.stagedSubmissionEmpty,
|
||||
stagedSubmissionRestore: dashboard.t.stagedSubmissionRestore,
|
||||
stagedSubmissionRemove: dashboard.t.stagedSubmissionRemove,
|
||||
quoteReply: dashboard.t.quoteReply,
|
||||
quotedReplyLabel: dashboard.t.quotedReplyLabel,
|
||||
send: dashboard.t.send,
|
||||
|
|
@ -169,6 +173,9 @@ export function BotDashboardModule({
|
|||
selectedBotControlState: dashboard.selectedBotControlState,
|
||||
quotedReply: dashboard.quotedReply,
|
||||
onClearQuotedReply: () => dashboard.setQuotedReply(null),
|
||||
stagedSubmissions: dashboard.selectedBotStagedSubmissions,
|
||||
onRestoreStagedSubmission: dashboard.restoreStagedSubmission,
|
||||
onRemoveStagedSubmission: dashboard.removeStagedSubmission,
|
||||
pendingAttachments: dashboard.pendingAttachments,
|
||||
onRemovePendingAttachment: (path: string) =>
|
||||
dashboard.setPendingAttachments((prev) => prev.filter((value) => value !== path)),
|
||||
|
|
@ -208,8 +215,8 @@ export function BotDashboardModule({
|
|||
voiceCountdown: dashboard.voiceCountdown,
|
||||
onVoiceInput: dashboard.onVoiceInput,
|
||||
onTriggerPickAttachments: dashboard.triggerPickAttachments,
|
||||
showInterruptSubmitAction: dashboard.showInterruptSubmitAction,
|
||||
onSubmitAction: () => (dashboard.showInterruptSubmitAction ? dashboard.interruptExecution() : dashboard.send()),
|
||||
submitActionMode: dashboard.submitActionMode,
|
||||
onSubmitAction: dashboard.handlePrimarySubmitAction,
|
||||
};
|
||||
|
||||
const runtimePanelProps = {
|
||||
|
|
@ -230,7 +237,6 @@ export function BotDashboardModule({
|
|||
workspaceFileLoading: dashboard.workspaceFileLoading,
|
||||
workspaceDownloadExtensionSet: dashboard.workspaceDownloadExtensionSet,
|
||||
workspaceAutoRefresh: dashboard.workspaceAutoRefresh,
|
||||
hasPreviewFiles: dashboard.workspaceFiles.length > 0,
|
||||
isCompactHidden: dashboard.compactMode && (dashboard.isCompactListPage || dashboard.compactPanelTab !== 'runtime'),
|
||||
showCompactSurface: dashboard.showCompactBotPageClose,
|
||||
emptyStateText: dashboard.forcedBotMissing ? `${dashboard.t.noTelemetry}: ${String(dashboard.forcedBotId).trim()}` : dashboard.t.noTelemetry,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export function BotDashboardView({
|
|||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ color: 'var(--muted)' }}>{selectBotText}</div>
|
||||
<div className="ops-panel-empty-copy">{selectBotText}</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ export function ChannelConfigModal({
|
|||
</div>
|
||||
<div className="row-between ops-config-footer">
|
||||
<span className="field-label">{labels.channelAddHint}</span>
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
|
||||
<div className="ops-inline-actions">
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => {
|
||||
|
|
@ -900,7 +900,7 @@ export function TopicConfigModal({
|
|||
</div>
|
||||
<div className="row-between ops-config-footer">
|
||||
<span className="field-label">{labels.topicAddHint}</span>
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, flexWrap: 'wrap', justifyContent: 'flex-end' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap ops-inline-actions-end">
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={isSavingTopic}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
gap: 10px;
|
||||
}
|
||||
|
||||
.ops-hidden-file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ops-chat-frame.is-disabled .ops-chat-scroll,
|
||||
.ops-chat-frame.is-disabled .ops-composer {
|
||||
filter: grayscale(0.2) opacity(0.75);
|
||||
|
|
@ -170,6 +174,10 @@
|
|||
gap: 8px;
|
||||
}
|
||||
|
||||
.ops-control-date-submit-label {
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.ops-control-command-toggle {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
|
|
@ -204,6 +212,107 @@
|
|||
min-width: 0;
|
||||
}
|
||||
|
||||
.ops-staged-submission-queue {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
padding: 10px;
|
||||
border: 1px dashed color-mix(in oklab, #6f94ff 46%, var(--line) 54%);
|
||||
border-radius: 14px;
|
||||
background:
|
||||
linear-gradient(180deg, color-mix(in oklab, var(--panel) 68%, #dfe9ff 32%), color-mix(in oklab, var(--panel) 82%, #d5e3ff 18%));
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
|
||||
}
|
||||
|
||||
.ops-staged-submission-item {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid color-mix(in oklab, #7aa2ff 18%, var(--line) 82%);
|
||||
border-radius: 12px;
|
||||
background: color-mix(in oklab, var(--panel) 84%, white 16%);
|
||||
}
|
||||
|
||||
.ops-staged-submission-index {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 999px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
color: var(--brand);
|
||||
background: color-mix(in oklab, var(--panel) 64%, white 36%);
|
||||
border: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
|
||||
}
|
||||
|
||||
.ops-staged-submission-body {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.ops-staged-submission-text {
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
color: var(--text);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ops-staged-submission-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ops-staged-submission-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
border: 1px solid color-mix(in oklab, var(--line) 74%, transparent);
|
||||
border-radius: 999px;
|
||||
padding: 2px 8px;
|
||||
font-size: 11px;
|
||||
color: var(--subtitle);
|
||||
background: color-mix(in oklab, var(--panel) 82%, transparent);
|
||||
}
|
||||
|
||||
.ops-staged-submission-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ops-staged-submission-icon-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
border: 1px solid color-mix(in oklab, var(--line) 76%, transparent);
|
||||
border-radius: 999px;
|
||||
background: color-mix(in oklab, var(--panel) 88%, white 12%);
|
||||
color: var(--icon-muted);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
|
||||
}
|
||||
|
||||
.ops-staged-submission-icon-btn:hover:not(:disabled) {
|
||||
color: var(--icon);
|
||||
background: color-mix(in oklab, var(--panel) 70%, var(--brand-soft) 30%);
|
||||
border-color: color-mix(in oklab, var(--brand) 38%, var(--line) 62%);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.ops-staged-submission-icon-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ops-composer-quote-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -514,6 +623,16 @@
|
|||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.ops-staged-submission-item {
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.ops-staged-submission-actions {
|
||||
grid-column: 2;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.ops-control-command-drawer.is-open {
|
||||
max-width: 288px;
|
||||
flex-wrap: wrap;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import { ArrowUp, ChevronLeft, Clock3, Command, Download, Eye, FileText, Mic, Paperclip, Plus, RefreshCw, RotateCcw, Square, X } from 'lucide-react';
|
||||
import { ArrowUp, ChevronLeft, Clock3, Command, Download, Eye, FileText, Mic, Paperclip, Pencil, Plus, RefreshCw, RotateCcw, Square, Trash2, X } from 'lucide-react';
|
||||
import type { Components } from 'react-markdown';
|
||||
import type { ChangeEventHandler, KeyboardEventHandler, RefObject } from 'react';
|
||||
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import nanobotLogo from '../../../assets/nanobot-logo.png';
|
||||
import type { ChatMessage } from '../../../types/bot';
|
||||
import { normalizeAssistantMessageText } from '../messageParser';
|
||||
import { normalizeAssistantMessageText, normalizeUserMessageText } from '../messageParser';
|
||||
import { normalizeDashboardAttachmentPath } from '../shared/workspaceMarkdown';
|
||||
import type { StagedSubmissionDraft } from '../types';
|
||||
import { formatDateInputValue, workspaceFileAction } from '../utils';
|
||||
import { DashboardConversationMessages } from './DashboardConversationMessages';
|
||||
import './DashboardChatPanel.css';
|
||||
|
|
@ -32,6 +33,10 @@ interface DashboardChatPanelLabels {
|
|||
interrupt: string;
|
||||
noConversation: string;
|
||||
previewTitle: string;
|
||||
stagedSubmissionAttachmentCount: (count: number) => string;
|
||||
stagedSubmissionEmpty: string;
|
||||
stagedSubmissionRestore: string;
|
||||
stagedSubmissionRemove: string;
|
||||
quoteReply: string;
|
||||
quotedReplyLabel: string;
|
||||
send: string;
|
||||
|
|
@ -74,6 +79,9 @@ interface DashboardChatPanelProps {
|
|||
selectedBotControlState?: 'starting' | 'stopping' | 'enabling' | 'disabling';
|
||||
quotedReply: { text: string } | null;
|
||||
onClearQuotedReply: () => void;
|
||||
stagedSubmissions: StagedSubmissionDraft[];
|
||||
onRestoreStagedSubmission: (stagedSubmissionId: string) => void;
|
||||
onRemoveStagedSubmission: (stagedSubmissionId: string) => void;
|
||||
pendingAttachments: string[];
|
||||
onRemovePendingAttachment: (path: string) => void;
|
||||
attachmentUploadPercent: number | null;
|
||||
|
|
@ -109,7 +117,7 @@ interface DashboardChatPanelProps {
|
|||
voiceCountdown: number;
|
||||
onVoiceInput: () => Promise<void> | void;
|
||||
onTriggerPickAttachments: () => Promise<void> | void;
|
||||
showInterruptSubmitAction: boolean;
|
||||
submitActionMode: 'interrupt' | 'send' | 'stage';
|
||||
onSubmitAction: () => Promise<void> | void;
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +150,9 @@ export function DashboardChatPanel({
|
|||
selectedBotControlState,
|
||||
quotedReply,
|
||||
onClearQuotedReply,
|
||||
stagedSubmissions,
|
||||
onRestoreStagedSubmission,
|
||||
onRemoveStagedSubmission,
|
||||
pendingAttachments,
|
||||
onRemovePendingAttachment,
|
||||
attachmentUploadPercent,
|
||||
|
|
@ -177,9 +188,11 @@ export function DashboardChatPanel({
|
|||
voiceCountdown,
|
||||
onVoiceInput,
|
||||
onTriggerPickAttachments,
|
||||
showInterruptSubmitAction,
|
||||
submitActionMode,
|
||||
onSubmitAction,
|
||||
}: DashboardChatPanelProps) {
|
||||
const showInterruptSubmitAction = submitActionMode === 'interrupt';
|
||||
const hasComposerDraft = Boolean(String(command || '').trim()) || pendingAttachments.length > 0 || Boolean(quotedReply);
|
||||
return (
|
||||
<div className={`ops-chat-frame ${isChatEnabled ? '' : 'is-disabled'}`}>
|
||||
<div className="ops-chat-scroll" ref={chatScrollRef} onScroll={onChatScroll}>
|
||||
|
|
@ -246,6 +259,52 @@ export function DashboardChatPanel({
|
|||
</div>
|
||||
|
||||
<div className="ops-chat-dock">
|
||||
{stagedSubmissions.length > 0 ? (
|
||||
<div className="ops-staged-submission-queue" aria-live="polite">
|
||||
{stagedSubmissions.map((stagedSubmission, index) => (
|
||||
<div key={stagedSubmission.id} className="ops-staged-submission-item">
|
||||
<span className="ops-staged-submission-index mono">{index + 1}</span>
|
||||
<div className="ops-staged-submission-body">
|
||||
<div className="ops-staged-submission-text">
|
||||
{normalizeUserMessageText(stagedSubmission.command) || labels.stagedSubmissionEmpty}
|
||||
</div>
|
||||
{(stagedSubmission.quotedReply || stagedSubmission.attachments.length > 0) ? (
|
||||
<div className="ops-staged-submission-meta">
|
||||
{stagedSubmission.quotedReply ? (
|
||||
<span className="ops-staged-submission-pill">{labels.quotedReplyLabel}</span>
|
||||
) : null}
|
||||
{stagedSubmission.attachments.length > 0 ? (
|
||||
<span className="ops-staged-submission-pill">
|
||||
{labels.stagedSubmissionAttachmentCount(stagedSubmission.attachments.length)}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="ops-staged-submission-actions">
|
||||
<button
|
||||
type="button"
|
||||
className="ops-staged-submission-icon-btn"
|
||||
onClick={() => onRestoreStagedSubmission(stagedSubmission.id)}
|
||||
aria-label={labels.stagedSubmissionRestore}
|
||||
title={labels.stagedSubmissionRestore}
|
||||
>
|
||||
<Pencil size={14} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="ops-staged-submission-icon-btn"
|
||||
onClick={() => onRemoveStagedSubmission(stagedSubmission.id)}
|
||||
aria-label={labels.stagedSubmissionRemove}
|
||||
title={labels.stagedSubmissionRemove}
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
{(quotedReply || pendingAttachments.length > 0) ? (
|
||||
<div className="ops-chat-top-context">
|
||||
{quotedReply ? (
|
||||
|
|
@ -331,7 +390,7 @@ export function DashboardChatPanel({
|
|||
multiple
|
||||
accept={allowedAttachmentExtensions.length > 0 ? allowedAttachmentExtensions.join(',') : undefined}
|
||||
onChange={onPickAttachments}
|
||||
style={{ display: 'none' }}
|
||||
className="ops-hidden-file-input"
|
||||
/>
|
||||
<div className={`ops-composer-shell ${controlCommandPanelOpen ? 'is-command-open' : ''}`}>
|
||||
<div className="ops-composer-float-controls" ref={controlCommandPanelRef}>
|
||||
|
|
@ -412,7 +471,7 @@ export function DashboardChatPanel({
|
|||
onClick={() => void onJumpConversationToDate()}
|
||||
>
|
||||
{chatDateJumping ? <RefreshCw size={14} className="animate-spin" /> : null}
|
||||
<span style={{ marginLeft: chatDateJumping ? 6 : 0 }}>
|
||||
<span className={chatDateJumping ? 'ops-control-date-submit-label' : undefined}>
|
||||
{isZh ? '跳转' : 'Jump'}
|
||||
</span>
|
||||
</button>
|
||||
|
|
@ -488,13 +547,21 @@ export function DashboardChatPanel({
|
|||
<button
|
||||
className={`ops-composer-submit-btn ${showInterruptSubmitAction ? 'is-interrupt' : ''}`}
|
||||
disabled={
|
||||
showInterruptSubmitAction
|
||||
submitActionMode === 'interrupt'
|
||||
? isInterrupting
|
||||
: (
|
||||
submitActionMode === 'stage'
|
||||
? (
|
||||
isVoiceRecording
|
||||
|| isVoiceTranscribing
|
||||
|| !hasComposerDraft
|
||||
)
|
||||
: (
|
||||
!isChatEnabled
|
||||
|| isVoiceRecording
|
||||
|| isVoiceTranscribing
|
||||
|| (!command.trim() && pendingAttachments.length === 0 && !quotedReply)
|
||||
|| !hasComposerDraft
|
||||
)
|
||||
)
|
||||
}
|
||||
onClick={() => void onSubmitAction()}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import { PlugZap, RefreshCw, X } from 'lucide-react';
|
||||
import { PlugZap, RefreshCw } from 'lucide-react';
|
||||
|
||||
import { DrawerShell } from '../../../components/DrawerShell';
|
||||
import { LucentSelect } from '../../../components/lucent/LucentSelect';
|
||||
import { PasswordInput } from '../../../components/PasswordInput';
|
||||
import { buildLlmProviderOptions } from '../../../utils/llmProviders';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { DashboardModalCardShell } from './DashboardModalCardShell';
|
||||
import type { BotState } from '../../../types/bot';
|
||||
import type { SystemTimezoneOption } from '../../../utils/systemTimezones';
|
||||
import type { BaseImageOption, BotEditForm, BotParamDraft, BotResourceSnapshot } from '../types';
|
||||
import { clampTemperature, formatBytes, formatPercent } from '../utils';
|
||||
import './DashboardManagementModals.css';
|
||||
import './DashboardConfigModals.css';
|
||||
|
||||
interface PasswordToggleLabels {
|
||||
|
|
@ -44,14 +46,10 @@ export function ResourceMonitorModal({
|
|||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className="modal-card modal-wide" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '资源监测' : 'Resource Monitor'}</h3>
|
||||
<span className="modal-sub mono">{resourceBot?.name || botId}</span>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<DashboardModalCardShell
|
||||
cardClassName="modal-wide"
|
||||
closeLabel={closeLabel}
|
||||
headerActions={(
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={() => void onRefresh(botId)}
|
||||
|
|
@ -60,12 +58,11 @@ export function ResourceMonitorModal({
|
|||
>
|
||||
<RefreshCw size={14} className={resourceLoading ? 'animate-spin' : ''} />
|
||||
</LucentIconButton>
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={closeLabel} aria-label={closeLabel}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
)}
|
||||
onClose={onClose}
|
||||
subtitle={<span className="mono">{resourceBot?.name || botId}</span>}
|
||||
title={isZh ? '资源监测' : 'Resource Monitor'}
|
||||
>
|
||||
{resourceError ? <div className="card">{resourceError}</div> : null}
|
||||
{resourceSnapshot ? (
|
||||
<div className="stack">
|
||||
|
|
@ -78,7 +75,7 @@ export function ResourceMonitorModal({
|
|||
<div>{isZh ? '策略说明' : 'Policy'}: <strong>{isZh ? '资源值 0 = 不限制' : 'Value 0 = Unlimited'}</strong></div>
|
||||
</div>
|
||||
|
||||
<div className="grid-2" style={{ gridTemplateColumns: '1fr 1fr' }}>
|
||||
<div className="grid-2">
|
||||
<div className="card stack">
|
||||
<div className="section-mini-title">{isZh ? '配置配额' : 'Configured Limits'}</div>
|
||||
<div className="ops-runtime-row"><span>CPU</span><strong>{Number(resourceSnapshot.configured.cpu_cores) === 0 ? (isZh ? '不限' : 'Unlimited') : resourceSnapshot.configured.cpu_cores}</strong></div>
|
||||
|
|
@ -114,8 +111,7 @@ export function ResourceMonitorModal({
|
|||
) : (
|
||||
<div className="ops-empty-inline">{resourceLoading ? (isZh ? '读取中...' : 'Loading...') : (isZh ? '暂无监控数据' : 'No metrics')}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</DashboardModalCardShell>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -176,19 +172,22 @@ export function BaseConfigModal({
|
|||
title={labels.baseConfig}
|
||||
subtitle={isZh ? '在这里维护 Bot 的基础信息和资源配额。' : 'Maintain the bot basics and resource limits here.'}
|
||||
size="standard"
|
||||
bodyClassName="ops-form-drawer-body"
|
||||
closeLabel={labels.close}
|
||||
footer={(
|
||||
<div className="drawer-shell-footer-content">
|
||||
<div className="drawer-shell-footer-main field-label">
|
||||
{isZh ? '保存后基础配置会同步到当前 Bot。' : 'Saving syncs the latest base configuration to the current bot.'}
|
||||
</div>
|
||||
<div style={{ display: 'inline-flex', gap: 8, flexWrap: 'wrap' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap">
|
||||
<button className="btn btn-secondary" onClick={onClose}>{labels.cancel}</button>
|
||||
<button className="btn btn-primary" disabled={isSaving} onClick={() => void onSave()}>{labels.save}</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<div className="ops-form-modal">
|
||||
<div className="ops-form-scroll">
|
||||
<div>
|
||||
<div className="section-mini-title">{isZh ? '基础信息' : 'Basic Info'}</div>
|
||||
<label className="field-label">{labels.botIdReadonly}</label>
|
||||
|
|
@ -265,6 +264,8 @@ export function BaseConfigModal({
|
|||
/>
|
||||
<div className="field-label">{isZh ? '提示:填写 0 表示不限制(保存后需手动重启 Bot 生效)。' : 'Tip: value 0 means unlimited (takes effect after manual bot restart).'}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DrawerShell>
|
||||
);
|
||||
}
|
||||
|
|
@ -327,6 +328,7 @@ export function ParamConfigModal({
|
|||
title={labels.modelParams}
|
||||
subtitle={isZh ? '维护 Provider、模型、密钥和采样参数。' : 'Maintain the provider, model, key, and sampling parameters.'}
|
||||
size="standard"
|
||||
bodyClassName="ops-form-drawer-body"
|
||||
closeLabel={labels.close}
|
||||
footer={(
|
||||
<div className="drawer-shell-footer-content">
|
||||
|
|
@ -335,13 +337,15 @@ export function ParamConfigModal({
|
|||
? labels.testing
|
||||
: (providerTestResult || (isZh ? '保存后模型参数会同步到当前 Bot。' : 'Saving syncs the latest model parameters to the current bot.'))}
|
||||
</div>
|
||||
<div style={{ display: 'inline-flex', gap: 8, flexWrap: 'wrap' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap">
|
||||
<button className="btn btn-secondary" onClick={onClose}>{labels.cancel}</button>
|
||||
<button className="btn btn-primary" disabled={isSaving} onClick={() => void onSave()}>{labels.saveParams}</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<div className="ops-form-modal">
|
||||
<div className="ops-form-scroll">
|
||||
<div>
|
||||
<label className="field-label">Provider</label>
|
||||
<LucentSelect value={editForm.llm_provider} onChange={(e) => onProviderChange(e.target.value)}>
|
||||
|
|
@ -394,7 +398,7 @@ export function ParamConfigModal({
|
|||
value={paramDraft.max_tokens}
|
||||
onChange={(e) => onParamDraftChange({ max_tokens: e.target.value })}
|
||||
/>
|
||||
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap">
|
||||
{[4096, 8192, 16384, 32768].map((value) => (
|
||||
<button
|
||||
key={value}
|
||||
|
|
@ -407,6 +411,8 @@ export function ParamConfigModal({
|
|||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DrawerShell>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,46 @@
|
|||
.ops-skills-list-scroll {
|
||||
max-height: min(56vh, 520px);
|
||||
.ops-form-drawer-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ops-form-modal {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.ops-form-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.ops-modal-scrollable {
|
||||
max-height: min(92vh, 860px);
|
||||
.ops-skills-drawer-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ops-skills-modal {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.ops-skills-list-scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.ops-config-modal {
|
||||
|
|
@ -156,49 +189,17 @@
|
|||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ops-config-weixin-login-hint,
|
||||
.ops-config-weixin-login-note {
|
||||
.ops-config-weixin-login-hint {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ops-config-weixin-login-status {
|
||||
color: var(--text);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ops-config-weixin-login-body {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.ops-config-weixin-qr-frame {
|
||||
width: min(100%, 240px);
|
||||
aspect-ratio: 1;
|
||||
border-radius: 14px;
|
||||
padding: 12px;
|
||||
background: rgba(255, 255, 255, 0.96);
|
||||
border: 1px solid color-mix(in oklab, var(--line) 72%, white 28%);
|
||||
}
|
||||
|
||||
.ops-config-weixin-qr {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.ops-config-weixin-login-url-label {
|
||||
color: var(--muted);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.ops-config-weixin-login-url {
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
|
|
@ -236,15 +237,6 @@
|
|||
gap: 12px;
|
||||
}
|
||||
|
||||
.ops-skill-add-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid color-mix(in oklab, var(--line) 82%, transparent);
|
||||
}
|
||||
|
||||
.ops-skill-add-hint {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
|
|
@ -262,6 +254,20 @@
|
|||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.ops-inline-actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ops-inline-actions-wrap {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ops-inline-actions-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.ops-topic-create-menu {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
|
@ -313,11 +319,6 @@
|
|||
max-width: 100%;
|
||||
}
|
||||
|
||||
.ops-skill-add-bar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.ops-skill-create-trigger {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
import type { ReactNode } from 'react';
|
||||
import { X } from 'lucide-react';
|
||||
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
|
||||
interface DashboardModalCardShellProps {
|
||||
cardClassName?: string;
|
||||
children: ReactNode;
|
||||
closeLabel: string;
|
||||
headerActions?: ReactNode;
|
||||
onClose: () => void;
|
||||
subtitle?: ReactNode;
|
||||
title: ReactNode;
|
||||
}
|
||||
|
||||
function joinClassNames(...values: Array<string | false | null | undefined>) {
|
||||
return values.filter(Boolean).join(' ');
|
||||
}
|
||||
|
||||
export function DashboardModalCardShell({
|
||||
cardClassName,
|
||||
children,
|
||||
closeLabel,
|
||||
headerActions,
|
||||
onClose,
|
||||
subtitle,
|
||||
title,
|
||||
}: DashboardModalCardShellProps) {
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className={joinClassNames('modal-card', cardClassName)} onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{title}</h3>
|
||||
{subtitle ? <span className="modal-sub">{subtitle}</span> : null}
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
{headerActions}
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={closeLabel} aria-label={closeLabel}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import type { ReactNode } from 'react';
|
||||
import { X } from 'lucide-react';
|
||||
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
|
||||
interface DashboardPreviewModalShellProps {
|
||||
cardClassName?: string;
|
||||
children: ReactNode;
|
||||
closeLabel: string;
|
||||
headerActions?: ReactNode;
|
||||
onClose: () => void;
|
||||
subtitle?: ReactNode;
|
||||
title: ReactNode;
|
||||
}
|
||||
|
||||
function joinClassNames(...values: Array<string | false | null | undefined>) {
|
||||
return values.filter(Boolean).join(' ');
|
||||
}
|
||||
|
||||
export function DashboardPreviewModalShell({
|
||||
cardClassName,
|
||||
children,
|
||||
closeLabel,
|
||||
headerActions,
|
||||
onClose,
|
||||
subtitle,
|
||||
title,
|
||||
}: DashboardPreviewModalShellProps) {
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className={joinClassNames('modal-card modal-preview', cardClassName)} onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row workspace-preview-header">
|
||||
<div className="workspace-preview-header-text">
|
||||
<h3>{title}</h3>
|
||||
{subtitle ? <span className="modal-sub">{subtitle}</span> : null}
|
||||
</div>
|
||||
<div className="workspace-preview-header-actions">
|
||||
{headerActions}
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={onClose}
|
||||
tooltip={closeLabel}
|
||||
aria-label={closeLabel}
|
||||
>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -59,6 +59,7 @@ export function SkillsModal({
|
|||
title={labels.skillsPanel}
|
||||
subtitle={isZh ? '查看当前 Bot 已安装的技能。' : 'View the skills already installed for this bot.'}
|
||||
size="standard"
|
||||
bodyClassName="ops-skills-drawer-body"
|
||||
closeLabel={labels.close}
|
||||
headerActions={(
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={() => void onRefreshSkills()} tooltip={isZh ? '刷新已安装技能' : 'Refresh installed skills'} aria-label={isZh ? '刷新已安装技能' : 'Refresh installed skills'}>
|
||||
|
|
@ -101,8 +102,7 @@ export function SkillsModal({
|
|||
</div>
|
||||
)}
|
||||
>
|
||||
<div className="stack">
|
||||
<div className="stack">
|
||||
<div className="ops-skills-modal">
|
||||
<div className="ops-section-header">
|
||||
<div className="section-mini-title">{isZh ? '已安装技能' : 'Installed Skills'}</div>
|
||||
<div className="field-label">
|
||||
|
|
@ -132,7 +132,6 @@ export function SkillsModal({
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DrawerShell>
|
||||
);
|
||||
}
|
||||
|
|
@ -341,7 +340,7 @@ export function McpConfigModal({
|
|||
</div>
|
||||
<div className="row-between ops-config-footer">
|
||||
<span className="field-label">{labels.mcpHint}</span>
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
|
||||
<div className="ops-inline-actions">
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,17 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ops-agent-files-layout {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.ops-agent-files-layout .agent-tabs-vertical {
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.ops-cron-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { DrawerShell } from '../../../components/DrawerShell';
|
|||
import { PasswordInput } from '../../../components/PasswordInput';
|
||||
import { MarkdownLiteEditor } from '../../../components/markdown/MarkdownLiteEditor';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { DashboardModalCardShell } from './DashboardModalCardShell';
|
||||
import type { AgentTab, CronJob } from '../types';
|
||||
import './DashboardManagementModals.css';
|
||||
import './DashboardSupportModals.css';
|
||||
|
|
@ -61,6 +62,8 @@ interface RuntimeActionModalLabels {
|
|||
lastAction: string;
|
||||
}
|
||||
|
||||
const AGENT_FILE_TABS: AgentTab[] = ['AGENTS', 'SOUL', 'USER', 'TOOLS', 'IDENTITY'];
|
||||
|
||||
interface EnvParamsModalProps {
|
||||
open: boolean;
|
||||
envEntries: Array<[string, string]>;
|
||||
|
|
@ -256,7 +259,7 @@ export function EnvParamsModal({
|
|||
</div>
|
||||
<div className="row-between ops-config-footer">
|
||||
<span className="field-label">{labels.envParamsHint}</span>
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, flexWrap: 'wrap', justifyContent: 'flex-end' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap ops-inline-actions-end">
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => {
|
||||
|
|
@ -325,13 +328,10 @@ export function CronJobsModal({
|
|||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className="modal-card modal-wide" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{labels.cronViewer}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<DashboardModalCardShell
|
||||
cardClassName="modal-wide"
|
||||
closeLabel={labels.close}
|
||||
headerActions={(
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={() => void onReload()}
|
||||
|
|
@ -341,11 +341,10 @@ export function CronJobsModal({
|
|||
>
|
||||
<RefreshCw size={14} className={cronLoading ? 'animate-spin' : ''} />
|
||||
</LucentIconButton>
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={labels.close} aria-label={labels.close}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
onClose={onClose}
|
||||
title={labels.cronViewer}
|
||||
>
|
||||
{cronLoading ? (
|
||||
<div className="ops-empty-inline">{labels.cronLoading}</div>
|
||||
) : cronJobs.length === 0 ? (
|
||||
|
|
@ -406,8 +405,7 @@ export function CronJobsModal({
|
|||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</DashboardModalCardShell>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -444,24 +442,27 @@ export function TemplateManagerModal({
|
|||
}: TemplateManagerModalProps) {
|
||||
if (!open) return null;
|
||||
|
||||
const activeTemplateCount = templateTab === 'agent' ? templateAgentCount : templateTopicCount;
|
||||
const activeTemplateLabel = templateTab === 'agent' ? labels.templateTabAgent : labels.templateTabTopic;
|
||||
const activeTemplateText = templateTab === 'agent' ? templateAgentText : templateTopicText;
|
||||
const activeTemplatePlaceholder = templateTab === 'agent' ? '{"agents_md":"..."}' : '{"presets":[...]}';
|
||||
const handleTemplateTextChange = templateTab === 'agent' ? onTemplateAgentTextChange : onTemplateTopicTextChange;
|
||||
|
||||
return (
|
||||
<DrawerShell
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
title={labels.templateManagerTitle}
|
||||
subtitle={templateTab === 'agent'
|
||||
? `${labels.templateTabAgent} (${templateAgentCount})`
|
||||
: `${labels.templateTabTopic} (${templateTopicCount})`}
|
||||
subtitle={`${activeTemplateLabel} (${activeTemplateCount})`}
|
||||
size="extend"
|
||||
bodyClassName="ops-form-drawer-body"
|
||||
closeLabel={labels.close}
|
||||
footer={(
|
||||
<div className="drawer-shell-footer-content">
|
||||
<div className="drawer-shell-footer-main field-label">
|
||||
{templateTab === 'agent'
|
||||
? `${labels.templateTabAgent} (${templateAgentCount})`
|
||||
: `${labels.templateTabTopic} (${templateTopicCount})`}
|
||||
{`${activeTemplateLabel} (${activeTemplateCount})`}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap">
|
||||
<button className="btn btn-secondary" onClick={onClose}>{labels.cancel}</button>
|
||||
<button className="btn btn-primary" disabled={isSavingTemplates} onClick={() => void onSave(templateTab)}>
|
||||
{isSavingTemplates ? labels.processing : labels.save}
|
||||
|
|
@ -470,8 +471,7 @@ export function TemplateManagerModal({
|
|||
</div>
|
||||
)}
|
||||
>
|
||||
<div>
|
||||
|
||||
<div className="ops-form-modal">
|
||||
<div className="ops-template-tabs" role="tablist" aria-label={labels.templateManagerTitle}>
|
||||
<button
|
||||
className={`ops-template-tab ${templateTab === 'agent' ? 'is-active' : ''}`}
|
||||
|
|
@ -491,28 +491,18 @@ export function TemplateManagerModal({
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<div className="ops-form-scroll">
|
||||
<div className="ops-config-grid" style={{ gridTemplateColumns: '1fr' }}>
|
||||
{templateTab === 'agent' ? (
|
||||
<div className="ops-config-field">
|
||||
<textarea
|
||||
className="textarea md-area mono"
|
||||
rows={16}
|
||||
value={templateAgentText}
|
||||
onChange={(e) => onTemplateAgentTextChange(e.target.value)}
|
||||
placeholder='{"agents_md":"..."}'
|
||||
value={activeTemplateText}
|
||||
onChange={(e) => handleTemplateTextChange(e.target.value)}
|
||||
placeholder={activeTemplatePlaceholder}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="ops-config-field">
|
||||
<textarea
|
||||
className="textarea md-area mono"
|
||||
rows={16}
|
||||
value={templateTopicText}
|
||||
onChange={(e) => onTemplateTopicTextChange(e.target.value)}
|
||||
placeholder='{"presets":[...]}'
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</DrawerShell>
|
||||
|
|
@ -551,27 +541,29 @@ export function AgentFilesModal({
|
|||
title={labels.agentFiles}
|
||||
subtitle="AGENTS.md, SOUL.md, USER.md, TOOLS.md, IDENTITY.md"
|
||||
size="extend"
|
||||
bodyClassName="ops-form-drawer-body"
|
||||
closeLabel={labels.close}
|
||||
footer={(
|
||||
<div className="drawer-shell-footer-content">
|
||||
<div className="drawer-shell-footer-main field-label">{`${agentTab}.md`}</div>
|
||||
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
||||
<div className="ops-inline-actions ops-inline-actions-wrap">
|
||||
<button className="btn btn-secondary" onClick={onClose}>{labels.cancel}</button>
|
||||
<button className="btn btn-primary" disabled={isSaving} onClick={() => void onSave()}>{labels.saveFiles}</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<div>
|
||||
<div className="wizard-agent-layout">
|
||||
<div className="ops-form-modal">
|
||||
<div className="wizard-agent-layout ops-agent-files-layout">
|
||||
<div className="agent-tabs-vertical">
|
||||
{(['AGENTS', 'SOUL', 'USER', 'TOOLS', 'IDENTITY'] as AgentTab[]).map((tab) => (
|
||||
{AGENT_FILE_TABS.map((tab) => (
|
||||
<button key={tab} className={`agent-tab ${agentTab === tab ? 'active' : ''}`} onClick={() => onAgentTabChange(tab)}>{tab}.md</button>
|
||||
))}
|
||||
</div>
|
||||
<MarkdownLiteEditor
|
||||
value={tabValue}
|
||||
onChange={onTabValueChange}
|
||||
fullHeight
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -595,22 +587,15 @@ export function RuntimeActionModal({
|
|||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className="modal-card modal-preview" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{labels.lastAction}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={labels.close} aria-label={labels.close}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
<DashboardModalCardShell
|
||||
cardClassName="modal-preview"
|
||||
closeLabel={labels.close}
|
||||
onClose={onClose}
|
||||
title={labels.lastAction}
|
||||
>
|
||||
<div className="workspace-preview-body">
|
||||
<pre>{runtimeAction}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DashboardModalCardShell>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.ops-runtime-heading {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.ops-panel-tools {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
|
@ -39,7 +43,6 @@
|
|||
gap: 8px;
|
||||
}
|
||||
|
||||
|
||||
.ops-runtime-state-card {
|
||||
min-height: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type { RefObject } from 'react';
|
|||
import { ProtectedSearchInput } from '../../../components/ProtectedSearchInput';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import type { BotState } from '../../../types/bot';
|
||||
import { isPreviewableWorkspaceFile } from '../utils';
|
||||
import type { WorkspaceNode } from '../types';
|
||||
import { WorkspaceEntriesList } from './WorkspaceEntriesList';
|
||||
import './DashboardMenus.css';
|
||||
|
|
@ -63,7 +64,6 @@ interface RuntimePanelProps {
|
|||
workspaceFileLoading: boolean;
|
||||
workspaceDownloadExtensionSet: ReadonlySet<string>;
|
||||
workspaceAutoRefresh: boolean;
|
||||
hasPreviewFiles: boolean;
|
||||
isCompactHidden: boolean;
|
||||
showCompactSurface: boolean;
|
||||
emptyStateText: string;
|
||||
|
|
@ -110,7 +110,6 @@ export function RuntimePanel({
|
|||
workspaceFileLoading,
|
||||
workspaceDownloadExtensionSet,
|
||||
workspaceAutoRefresh,
|
||||
hasPreviewFiles,
|
||||
isCompactHidden,
|
||||
showCompactSurface,
|
||||
emptyStateText,
|
||||
|
|
@ -139,13 +138,20 @@ export function RuntimePanel({
|
|||
onHideWorkspaceHoverCard,
|
||||
}: RuntimePanelProps) {
|
||||
const normalizedWorkspaceQuery = workspaceQuery.trim().toLowerCase();
|
||||
const hasVisibleWorkspaceEntries = filteredWorkspaceEntries.length > 0;
|
||||
const visibleWorkspaceFiles = filteredWorkspaceEntries.filter((entry) => entry.type === 'file');
|
||||
const hasVisiblePreviewableFiles = visibleWorkspaceFiles.some((entry) =>
|
||||
isPreviewableWorkspaceFile(entry, workspaceDownloadExtensionSet),
|
||||
);
|
||||
const showWorkspaceEmptyState = !workspaceLoading && !workspaceSearchLoading && !workspaceError && !hasVisibleWorkspaceEntries;
|
||||
const showNoPreviewableFilesHint = !workspaceError && !normalizedWorkspaceQuery && visibleWorkspaceFiles.length > 0 && !hasVisiblePreviewableFiles;
|
||||
|
||||
return (
|
||||
<section className={`panel stack ops-runtime-panel ${isCompactHidden ? 'ops-compact-hidden' : ''} ${showCompactSurface ? 'ops-compact-bot-surface' : ''}`}>
|
||||
{selectedBot ? (
|
||||
<div className="ops-runtime-shell">
|
||||
<div className="row-between ops-runtime-head">
|
||||
<h2 style={{ fontSize: 18 }}>{labels.runtime}</h2>
|
||||
<h2 className="ops-runtime-heading">{labels.runtime}</h2>
|
||||
<div className="ops-panel-tools" ref={runtimeMenuRef}>
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
|
|
@ -283,9 +289,9 @@ export function RuntimePanel({
|
|||
<div className="workspace-list">
|
||||
{workspaceLoading || workspaceSearchLoading ? (
|
||||
<div className="ops-empty-inline">{labels.loadingDir}</div>
|
||||
) : filteredWorkspaceEntries.length === 0 && workspaceParentPath === null ? (
|
||||
<div className="ops-empty-inline">{normalizedWorkspaceQuery ? labels.workspaceSearchNoResult : labels.emptyDir}</div>
|
||||
) : (
|
||||
<>
|
||||
{(workspaceParentPath !== null || hasVisibleWorkspaceEntries) ? (
|
||||
<WorkspaceEntriesList
|
||||
nodes={filteredWorkspaceEntries}
|
||||
workspaceParentPath={workspaceParentPath}
|
||||
|
|
@ -306,20 +312,27 @@ export function RuntimePanel({
|
|||
onShowWorkspaceHoverCard={onShowWorkspaceHoverCard}
|
||||
onHideWorkspaceHoverCard={onHideWorkspaceHoverCard}
|
||||
/>
|
||||
) : null}
|
||||
{showWorkspaceEmptyState ? (
|
||||
<div className="ops-empty-inline">
|
||||
{normalizedWorkspaceQuery ? labels.workspaceSearchNoResult : labels.emptyDir}
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="workspace-hint">
|
||||
{workspaceFileLoading ? labels.openingPreview : labels.workspaceHint}
|
||||
</div>
|
||||
</div>
|
||||
{!hasPreviewFiles ? (
|
||||
{showNoPreviewableFilesHint ? (
|
||||
<div className="ops-empty-inline">{labels.noPreviewFile}</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ color: 'var(--muted)' }}>{emptyStateText}</div>
|
||||
<div className="ops-panel-empty-copy">{emptyStateText}</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { ChevronLeft, ChevronRight, Hammer, RefreshCw, X } from 'lucide-react';
|
||||
import { ChevronLeft, ChevronRight, Hammer, RefreshCw } from 'lucide-react';
|
||||
import '../../../components/skill-market/SkillMarketShared.css';
|
||||
import type { BotSkillMarketItem } from '../../platform/types';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { ProtectedSearchInput } from '../../../components/ProtectedSearchInput';
|
||||
import { fetchPlatformSettings } from '../../platform/api/settings';
|
||||
import {
|
||||
normalizePlatformPageSize,
|
||||
readCachedPlatformPageSize,
|
||||
writeCachedPlatformPageSize,
|
||||
} from '../../../utils/platformPageSize';
|
||||
import { fetchPreferredPlatformPageSize } from '../../platform/api/settings';
|
||||
import { readCachedPlatformPageSize } from '../../../utils/platformPageSize';
|
||||
import { DashboardModalCardShell } from './DashboardModalCardShell';
|
||||
|
||||
interface SkillMarketInstallModalProps {
|
||||
isZh: boolean;
|
||||
|
|
@ -44,14 +41,7 @@ export function SkillMarketInstallModal({
|
|||
setPage(1);
|
||||
void onRefresh();
|
||||
void (async () => {
|
||||
try {
|
||||
const data = await fetchPlatformSettings();
|
||||
const normalized = normalizePlatformPageSize(data?.page_size, readCachedPlatformPageSize(10));
|
||||
writeCachedPlatformPageSize(normalized);
|
||||
setPageSize(normalized);
|
||||
} catch {
|
||||
setPageSize(readCachedPlatformPageSize(10));
|
||||
}
|
||||
setPageSize(await fetchPreferredPlatformPageSize(10));
|
||||
})();
|
||||
}, [open]);
|
||||
|
||||
|
|
@ -79,13 +69,10 @@ export function SkillMarketInstallModal({
|
|||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className="modal-card modal-wide platform-modal skill-market-browser-shell" onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '从市场安装技能' : 'Install From Marketplace'}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<DashboardModalCardShell
|
||||
cardClassName="modal-wide platform-modal skill-market-browser-shell"
|
||||
closeLabel={isZh ? '关闭' : 'Close'}
|
||||
headerActions={(
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={() => void onRefresh()}
|
||||
|
|
@ -94,12 +81,10 @@ export function SkillMarketInstallModal({
|
|||
>
|
||||
<RefreshCw size={14} className={loading ? 'animate-spin' : ''} />
|
||||
</LucentIconButton>
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
)}
|
||||
onClose={onClose}
|
||||
title={isZh ? '从市场安装技能' : 'Install From Marketplace'}
|
||||
>
|
||||
<div className="skill-market-browser-toolbar">
|
||||
<ProtectedSearchInput
|
||||
className="platform-searchbar skill-market-search"
|
||||
|
|
@ -200,7 +185,6 @@ export function SkillMarketInstallModal({
|
|||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DashboardModalCardShell>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,6 +156,12 @@
|
|||
right: 0;
|
||||
}
|
||||
|
||||
.workspace-preview-footer-actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.workspace-preview-body {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Copy, Maximize2, Minimize2, RefreshCw, Save, X } from 'lucide-react';
|
||||
import { Copy, Maximize2, Minimize2, RefreshCw, Save } from 'lucide-react';
|
||||
import ReactMarkdown, { type Components } from 'react-markdown';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import rehypeSanitize from 'rehype-sanitize';
|
||||
|
|
@ -6,6 +6,7 @@ import remarkGfm from 'remark-gfm';
|
|||
|
||||
import { MarkdownLiteEditor } from '../../../components/markdown/MarkdownLiteEditor';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { DashboardPreviewModalShell } from './DashboardPreviewModalShell';
|
||||
import { MARKDOWN_SANITIZE_SCHEMA } from '../constants';
|
||||
import type { WorkspacePreviewState } from '../types';
|
||||
import { renderWorkspacePathSegments } from '../utils';
|
||||
|
|
@ -75,12 +76,22 @@ export function WorkspacePreviewModal({
|
|||
: (isZh ? '全屏预览' : 'Full screen');
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className={`modal-card modal-preview ${previewFullscreen ? 'modal-preview-fullscreen' : ''}`} onClick={(e) => e.stopPropagation()}>
|
||||
<div className="modal-title-row workspace-preview-header">
|
||||
<div className="workspace-preview-header-text">
|
||||
<h3>{previewEditorEnabled ? labels.editFile : labels.filePreview}</h3>
|
||||
<span className="modal-sub mono workspace-preview-path-row">
|
||||
<DashboardPreviewModalShell
|
||||
cardClassName={previewFullscreen ? 'modal-preview-fullscreen' : undefined}
|
||||
closeLabel={labels.close}
|
||||
headerActions={(
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={onToggleFullscreen}
|
||||
tooltip={fullscreenLabel}
|
||||
aria-label={fullscreenLabel}
|
||||
>
|
||||
{previewFullscreen ? <Minimize2 size={14} /> : <Maximize2 size={14} />}
|
||||
</LucentIconButton>
|
||||
)}
|
||||
onClose={onClose}
|
||||
subtitle={(
|
||||
<span className="mono workspace-preview-path-row">
|
||||
<span className="workspace-path-segments" title={preview.path}>
|
||||
{renderWorkspacePathSegments(preview.path, 'preview-path')}
|
||||
</span>
|
||||
|
|
@ -93,26 +104,9 @@ export function WorkspacePreviewModal({
|
|||
<Copy size={12} />
|
||||
</LucentIconButton>
|
||||
</span>
|
||||
</div>
|
||||
<div className="workspace-preview-header-actions">
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={onToggleFullscreen}
|
||||
tooltip={fullscreenLabel}
|
||||
aria-label={fullscreenLabel}
|
||||
)}
|
||||
title={previewEditorEnabled ? labels.editFile : labels.filePreview}
|
||||
>
|
||||
{previewFullscreen ? <Minimize2 size={14} /> : <Maximize2 size={14} />}
|
||||
</LucentIconButton>
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={onClose}
|
||||
tooltip={labels.close}
|
||||
aria-label={labels.close}
|
||||
>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`workspace-preview-body ${preview.isMarkdown ? 'markdown' : ''} ${previewEditorEnabled ? 'is-editing' : ''} ${preview.isImage || preview.isVideo || preview.isAudio ? 'media' : ''}`}
|
||||
>
|
||||
|
|
@ -173,7 +167,7 @@ export function WorkspacePreviewModal({
|
|||
) : null}
|
||||
<div className="row-between">
|
||||
<span className="workspace-preview-meta mono">{preview.ext || '-'}</span>
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
|
||||
<div className="workspace-preview-footer-actions">
|
||||
{previewEditorEnabled ? (
|
||||
<>
|
||||
<button
|
||||
|
|
@ -220,7 +214,6 @@ export function WorkspacePreviewModal({
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DashboardPreviewModalShell>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,6 @@ export function useBotDashboardModule({
|
|||
workspaceDownloadExtensionSet,
|
||||
workspaceError,
|
||||
workspaceFileLoading,
|
||||
workspaceFiles,
|
||||
workspaceHoverCard,
|
||||
workspaceLoading,
|
||||
workspaceParentPath,
|
||||
|
|
@ -398,6 +397,7 @@ export function useBotDashboardModule({
|
|||
canChat,
|
||||
conversation,
|
||||
hasTopicUnread,
|
||||
isThinking: isBotThinking,
|
||||
selectedBotControlState,
|
||||
selectedBotEnabled,
|
||||
systemTimezoneOptions,
|
||||
|
|
@ -437,6 +437,7 @@ export function useBotDashboardModule({
|
|||
interruptExecution,
|
||||
isCommandAutoUnlockWindowActive,
|
||||
isInterrupting,
|
||||
isTaskRunning,
|
||||
isSendingBlocked,
|
||||
jumpConversationToDate,
|
||||
loadInitialChatPage,
|
||||
|
|
@ -444,13 +445,18 @@ export function useBotDashboardModule({
|
|||
onComposerKeyDown,
|
||||
quoteAssistantReply,
|
||||
quotedReply,
|
||||
restoreStagedSubmission,
|
||||
removeStagedSubmission,
|
||||
scrollConversationToBottom,
|
||||
send,
|
||||
selectedBotStagedSubmissions,
|
||||
sendControlCommand,
|
||||
setChatDatePickerOpen,
|
||||
setChatDateValue,
|
||||
setCommand,
|
||||
setQuotedReply,
|
||||
submitActionMode,
|
||||
handlePrimarySubmitAction,
|
||||
submitAssistantFeedback,
|
||||
toggleChatDatePicker,
|
||||
toggleProgressExpanded,
|
||||
|
|
@ -462,6 +468,7 @@ export function useBotDashboardModule({
|
|||
messages,
|
||||
conversation,
|
||||
canChat,
|
||||
isTaskRunningExternally: isBotThinking,
|
||||
chatPullPageSize,
|
||||
commandAutoUnlockSeconds,
|
||||
pendingAttachments,
|
||||
|
|
@ -675,6 +682,9 @@ export function useBotDashboardModule({
|
|||
selectedBotControlState,
|
||||
quotedReply,
|
||||
setQuotedReply,
|
||||
selectedBotStagedSubmissions,
|
||||
restoreStagedSubmission,
|
||||
removeStagedSubmission,
|
||||
pendingAttachments,
|
||||
setPendingAttachments,
|
||||
attachmentUploadPercent,
|
||||
|
|
@ -709,8 +719,11 @@ export function useBotDashboardModule({
|
|||
voiceCountdown,
|
||||
onVoiceInput,
|
||||
triggerPickAttachments,
|
||||
submitActionMode,
|
||||
isTaskRunning,
|
||||
showInterruptSubmitAction,
|
||||
send,
|
||||
handlePrimarySubmitAction,
|
||||
runtimeMenuOpen,
|
||||
runtimeMenuRef,
|
||||
displayState,
|
||||
|
|
@ -724,7 +737,6 @@ export function useBotDashboardModule({
|
|||
workspaceParentPath,
|
||||
workspaceFileLoading,
|
||||
workspaceAutoRefresh,
|
||||
workspaceFiles,
|
||||
restartBot,
|
||||
setRuntimeMenuOpen,
|
||||
openBaseConfigModal,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import axios from 'axios';
|
|||
import { APP_ENDPOINTS } from '../../../config/env';
|
||||
import type { ChatMessage } from '../../../types/bot';
|
||||
import { normalizeAssistantMessageText, normalizeUserMessageText } from '../messageParser';
|
||||
import type { QuotedReply } from '../types';
|
||||
import type { QuotedReply, StagedSubmissionDraft } from '../types';
|
||||
import { loadComposerDraft, persistComposerDraft } from '../utils';
|
||||
|
||||
type PromptTone = 'info' | 'success' | 'warning' | 'error';
|
||||
|
|
@ -19,6 +19,7 @@ interface UseDashboardChatComposerOptions {
|
|||
selectedBotId: string;
|
||||
selectedBot?: { id: string } | null;
|
||||
canChat: boolean;
|
||||
isTaskRunningExternally: boolean;
|
||||
commandAutoUnlockSeconds: number;
|
||||
pendingAttachments: string[];
|
||||
setPendingAttachments: Dispatch<SetStateAction<string[]>>;
|
||||
|
|
@ -35,6 +36,7 @@ export function useDashboardChatComposer({
|
|||
selectedBotId,
|
||||
selectedBot,
|
||||
canChat,
|
||||
isTaskRunningExternally,
|
||||
commandAutoUnlockSeconds,
|
||||
pendingAttachments,
|
||||
setPendingAttachments,
|
||||
|
|
@ -50,20 +52,29 @@ export function useDashboardChatComposer({
|
|||
const [composerDraftHydrated, setComposerDraftHydrated] = useState(false);
|
||||
const [quotedReply, setQuotedReply] = useState<QuotedReply | null>(null);
|
||||
const [sendingByBot, setSendingByBot] = useState<Record<string, number>>({});
|
||||
const [stagedSubmissionQueueByBot, setStagedSubmissionQueueByBot] = useState<Record<string, StagedSubmissionDraft[]>>({});
|
||||
const [commandAutoUnlockDeadlineByBot, setCommandAutoUnlockDeadlineByBot] = useState<Record<string, number>>({});
|
||||
const [interruptingByBot, setInterruptingByBot] = useState<Record<string, boolean>>({});
|
||||
const [controlCommandByBot, setControlCommandByBot] = useState<Record<string, string>>({});
|
||||
|
||||
const filePickerRef = useRef<HTMLInputElement | null>(null);
|
||||
const composerTextareaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const stagedAutoSubmitAttemptByBotRef = useRef<Record<string, string>>({});
|
||||
|
||||
const selectedBotSendingCount = selectedBot ? Number(sendingByBot[selectedBot.id] || 0) : 0;
|
||||
const selectedBotStagedSubmissions = selectedBot ? stagedSubmissionQueueByBot[selectedBot.id] || [] : [];
|
||||
const nextQueuedSubmission = selectedBotStagedSubmissions[0] || null;
|
||||
const selectedBotAutoUnlockDeadline = selectedBot ? Number(commandAutoUnlockDeadlineByBot[selectedBot.id] || 0) : 0;
|
||||
const activeControlCommand = selectedBot ? controlCommandByBot[selectedBot.id] || '' : '';
|
||||
const isSending = selectedBotSendingCount > 0;
|
||||
const isTaskRunning = Boolean(selectedBot && (isSending || isTaskRunningExternally));
|
||||
const isCommandAutoUnlockWindowActive = selectedBotAutoUnlockDeadline > Date.now();
|
||||
const isSendingBlocked = isSending && isCommandAutoUnlockWindowActive;
|
||||
const isInterrupting = Boolean(selectedBot && interruptingByBot[selectedBot.id]);
|
||||
const hasComposerDraft = Boolean(String(command || '').trim()) || pendingAttachments.length > 0 || Boolean(quotedReply);
|
||||
const submitActionMode: 'interrupt' | 'send' | 'stage' = isTaskRunning
|
||||
? (hasComposerDraft ? 'stage' : 'interrupt')
|
||||
: 'send';
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedBot?.id || selectedBotAutoUnlockDeadline <= 0) return;
|
||||
|
|
@ -110,7 +121,11 @@ export function useDashboardChatComposer({
|
|||
}, [selectedBotId]);
|
||||
|
||||
useEffect(() => {
|
||||
const hasDraft = Boolean(String(command || '').trim()) || pendingAttachments.length > 0 || Boolean(quotedReply);
|
||||
const hasDraft =
|
||||
Boolean(String(command || '').trim())
|
||||
|| pendingAttachments.length > 0
|
||||
|| Boolean(quotedReply)
|
||||
|| selectedBotStagedSubmissions.length > 0;
|
||||
if (!hasDraft && !isUploadingAttachments) return;
|
||||
const onBeforeUnload = (event: BeforeUnloadEvent) => {
|
||||
event.preventDefault();
|
||||
|
|
@ -118,7 +133,7 @@ export function useDashboardChatComposer({
|
|||
};
|
||||
window.addEventListener('beforeunload', onBeforeUnload);
|
||||
return () => window.removeEventListener('beforeunload', onBeforeUnload);
|
||||
}, [command, isUploadingAttachments, pendingAttachments.length, quotedReply]);
|
||||
}, [command, isUploadingAttachments, pendingAttachments.length, quotedReply, selectedBotStagedSubmissions.length]);
|
||||
|
||||
const copyTextToClipboard = async (textRaw: string, successMsg: string, failMsg: string) => {
|
||||
const text = String(textRaw || '');
|
||||
|
|
@ -140,15 +155,27 @@ export function useDashboardChatComposer({
|
|||
}
|
||||
};
|
||||
|
||||
const send = async () => {
|
||||
if (!selectedBot || !canChat || isSendingBlocked) return;
|
||||
if (!command.trim() && pendingAttachments.length === 0 && !quotedReply) return;
|
||||
const text = normalizeUserMessageText(command);
|
||||
const quoteText = normalizeAssistantMessageText(quotedReply?.text || '');
|
||||
const sendPayload = async ({
|
||||
commandRaw,
|
||||
attachmentsRaw,
|
||||
quotedReplyRaw,
|
||||
clearComposerOnSuccess,
|
||||
clearStagedSubmissionId,
|
||||
}: {
|
||||
commandRaw: string;
|
||||
attachmentsRaw: string[];
|
||||
quotedReplyRaw: QuotedReply | null;
|
||||
clearComposerOnSuccess: boolean;
|
||||
clearStagedSubmissionId?: string;
|
||||
}) => {
|
||||
if (!selectedBot || !canChat) return false;
|
||||
const attachments = [...attachmentsRaw];
|
||||
const text = normalizeUserMessageText(commandRaw);
|
||||
const quoteText = normalizeAssistantMessageText(quotedReplyRaw?.text || '');
|
||||
const quoteBlock = quoteText ? `[Quoted Reply]\n${quoteText}\n[/Quoted Reply]\n` : '';
|
||||
const payloadCore = text || (pendingAttachments.length > 0 ? t.attachmentMessage : '') || (quoteText ? t.quoteOnlyMessage : '');
|
||||
const payloadCore = text || (attachments.length > 0 ? t.attachmentMessage : '') || (quoteText ? t.quoteOnlyMessage : '');
|
||||
const payloadText = `${quoteBlock}${payloadCore}`.trim();
|
||||
if (!payloadText && pendingAttachments.length === 0) return;
|
||||
if (!payloadText && attachments.length === 0) return false;
|
||||
|
||||
try {
|
||||
requestAnimationFrame(() => scrollConversationToBottom('auto'));
|
||||
|
|
@ -159,7 +186,7 @@ export function useDashboardChatComposer({
|
|||
}));
|
||||
const res = await axios.post(
|
||||
`${APP_ENDPOINTS.apiBase}/bots/${selectedBot.id}/command`,
|
||||
{ command: payloadText, attachments: pendingAttachments },
|
||||
{ command: payloadText, attachments },
|
||||
{ timeout: 12000 },
|
||||
);
|
||||
if (!res.data?.success) {
|
||||
|
|
@ -168,14 +195,34 @@ export function useDashboardChatComposer({
|
|||
addBotMessage(selectedBot.id, {
|
||||
role: 'user',
|
||||
text: payloadText,
|
||||
attachments: [...pendingAttachments],
|
||||
attachments,
|
||||
ts: Date.now(),
|
||||
kind: 'final',
|
||||
});
|
||||
requestAnimationFrame(() => scrollConversationToBottom('auto'));
|
||||
if (clearComposerOnSuccess) {
|
||||
setCommand('');
|
||||
setPendingAttachments([]);
|
||||
setQuotedReply(null);
|
||||
}
|
||||
if (clearStagedSubmissionId) {
|
||||
setStagedSubmissionQueueByBot((prev) => {
|
||||
const currentQueue = prev[selectedBot.id] || [];
|
||||
const current = currentQueue[0];
|
||||
if (!current || current.id !== clearStagedSubmissionId) {
|
||||
return prev;
|
||||
}
|
||||
const remainingQueue = currentQueue.slice(1);
|
||||
const next = { ...prev };
|
||||
if (remainingQueue.length > 0) {
|
||||
next[selectedBot.id] = remainingQueue;
|
||||
} else {
|
||||
delete next[selectedBot.id];
|
||||
}
|
||||
return next;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
const msg = error?.response?.data?.detail || error?.message || t.sendFail;
|
||||
setCommandAutoUnlockDeadlineByBot((prev) => {
|
||||
|
|
@ -190,6 +237,7 @@ export function useDashboardChatComposer({
|
|||
});
|
||||
requestAnimationFrame(() => scrollConversationToBottom('auto'));
|
||||
notify(msg, { tone: 'error' });
|
||||
return false;
|
||||
} finally {
|
||||
setSendingByBot((prev) => {
|
||||
const next = { ...prev };
|
||||
|
|
@ -204,6 +252,95 @@ export function useDashboardChatComposer({
|
|||
}
|
||||
};
|
||||
|
||||
const send = async () => {
|
||||
if (!selectedBot || !canChat || isTaskRunning) return false;
|
||||
if (!hasComposerDraft) return false;
|
||||
return sendPayload({
|
||||
commandRaw: command,
|
||||
attachmentsRaw: pendingAttachments,
|
||||
quotedReplyRaw: quotedReply,
|
||||
clearComposerOnSuccess: true,
|
||||
});
|
||||
};
|
||||
|
||||
const removeStagedSubmission = (stagedSubmissionId: string) => {
|
||||
if (!selectedBot) return;
|
||||
setStagedSubmissionQueueByBot((prev) => {
|
||||
const currentQueue = prev[selectedBot.id] || [];
|
||||
const nextQueue = currentQueue.filter((item) => item.id !== stagedSubmissionId);
|
||||
if (nextQueue.length === currentQueue.length) return prev;
|
||||
const next = { ...prev };
|
||||
if (nextQueue.length > 0) {
|
||||
next[selectedBot.id] = nextQueue;
|
||||
} else {
|
||||
delete next[selectedBot.id];
|
||||
}
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const restoreStagedSubmission = (stagedSubmissionId: string) => {
|
||||
if (!selectedBot) return;
|
||||
const targetSubmission = selectedBotStagedSubmissions.find((item) => item.id === stagedSubmissionId);
|
||||
if (!targetSubmission) return;
|
||||
setCommand(targetSubmission.command);
|
||||
setPendingAttachments(targetSubmission.attachments);
|
||||
setQuotedReply(targetSubmission.quotedReply);
|
||||
removeStagedSubmission(stagedSubmissionId);
|
||||
composerTextareaRef.current?.focus();
|
||||
notify(t.stagedSubmissionRestored, { tone: 'success' });
|
||||
};
|
||||
|
||||
const stageCurrentSubmission = () => {
|
||||
if (!selectedBot || !hasComposerDraft) return;
|
||||
const nextStagedSubmission: StagedSubmissionDraft = {
|
||||
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
||||
command,
|
||||
attachments: [...pendingAttachments],
|
||||
quotedReply,
|
||||
updated_at_ms: Date.now(),
|
||||
};
|
||||
setStagedSubmissionQueueByBot((prev) => ({
|
||||
...prev,
|
||||
[selectedBot.id]: [...(prev[selectedBot.id] || []), nextStagedSubmission],
|
||||
}));
|
||||
setCommand('');
|
||||
setPendingAttachments([]);
|
||||
setQuotedReply(null);
|
||||
notify(t.stagedSubmissionQueued, { tone: 'success' });
|
||||
};
|
||||
|
||||
const handlePrimarySubmitAction = async () => {
|
||||
if (!selectedBot || !canChat) return;
|
||||
if (isTaskRunning) {
|
||||
if (hasComposerDraft) {
|
||||
stageCurrentSubmission();
|
||||
return;
|
||||
}
|
||||
await interruptExecution();
|
||||
return;
|
||||
}
|
||||
await send();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedBot || !canChat || !nextQueuedSubmission || isTaskRunning || isUploadingAttachments) {
|
||||
return;
|
||||
}
|
||||
const lastAttemptedSubmissionId = stagedAutoSubmitAttemptByBotRef.current[selectedBot.id];
|
||||
if (lastAttemptedSubmissionId === nextQueuedSubmission.id) {
|
||||
return;
|
||||
}
|
||||
stagedAutoSubmitAttemptByBotRef.current[selectedBot.id] = nextQueuedSubmission.id;
|
||||
void sendPayload({
|
||||
commandRaw: nextQueuedSubmission.command,
|
||||
attachmentsRaw: nextQueuedSubmission.attachments,
|
||||
quotedReplyRaw: nextQueuedSubmission.quotedReply,
|
||||
clearComposerOnSuccess: false,
|
||||
clearStagedSubmissionId: nextQueuedSubmission.id,
|
||||
});
|
||||
}, [canChat, isTaskRunning, isUploadingAttachments, nextQueuedSubmission, selectedBot]);
|
||||
|
||||
const sendControlCommand = async (slashCommand: '/new' | '/restart') => {
|
||||
if (!selectedBot || !canChat || activeControlCommand) return;
|
||||
try {
|
||||
|
|
@ -302,7 +439,7 @@ export function useDashboardChatComposer({
|
|||
const isEnter = event.key === 'Enter' || event.key === 'NumpadEnter';
|
||||
if (!isEnter || event.shiftKey) return;
|
||||
event.preventDefault();
|
||||
void send();
|
||||
void handlePrimarySubmitAction();
|
||||
};
|
||||
|
||||
const triggerPickAttachments = () => {
|
||||
|
|
@ -318,18 +455,24 @@ export function useDashboardChatComposer({
|
|||
copyUserPrompt,
|
||||
editUserPrompt,
|
||||
filePickerRef,
|
||||
handlePrimarySubmitAction,
|
||||
interruptExecution,
|
||||
isCommandAutoUnlockWindowActive,
|
||||
isInterrupting,
|
||||
isSending,
|
||||
isTaskRunning,
|
||||
isSendingBlocked,
|
||||
onComposerKeyDown,
|
||||
quoteAssistantReply,
|
||||
quotedReply,
|
||||
restoreStagedSubmission,
|
||||
removeStagedSubmission,
|
||||
send,
|
||||
sendControlCommand,
|
||||
setCommand,
|
||||
setQuotedReply,
|
||||
selectedBotStagedSubmissions,
|
||||
submitActionMode,
|
||||
triggerPickAttachments,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ interface UseDashboardConversationOptions {
|
|||
messages: ChatMessage[];
|
||||
conversation: ChatMessage[];
|
||||
canChat: boolean;
|
||||
isTaskRunningExternally: boolean;
|
||||
chatPullPageSize: number;
|
||||
commandAutoUnlockSeconds: number;
|
||||
pendingAttachments: string[];
|
||||
|
|
@ -62,6 +63,7 @@ export function useDashboardConversation(options: UseDashboardConversationOption
|
|||
selectedBotId: options.selectedBotId,
|
||||
selectedBot: options.selectedBot,
|
||||
canChat: options.canChat,
|
||||
isTaskRunningExternally: options.isTaskRunningExternally,
|
||||
commandAutoUnlockSeconds: options.commandAutoUnlockSeconds,
|
||||
pendingAttachments: options.pendingAttachments,
|
||||
setPendingAttachments: options.setPendingAttachments,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { Eye, RefreshCw, Trash2, X } from 'lucide-react';
|
||||
import { Eye, RefreshCw, Trash2 } from 'lucide-react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import rehypeSanitize from 'rehype-sanitize';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { LucentSelect } from '../../../components/lucent/LucentSelect';
|
||||
import { DashboardPreviewModalShell } from '../components/DashboardPreviewModalShell';
|
||||
import {
|
||||
createWorkspaceMarkdownComponents,
|
||||
decorateWorkspacePathsForMarkdown,
|
||||
|
|
@ -356,24 +357,12 @@ export function TopicFeedPanel({
|
|||
</div>
|
||||
{detailState && portalTarget
|
||||
? createPortal(
|
||||
<div className="modal-mask" onClick={closeDetail}>
|
||||
<div className="modal-card modal-preview" onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row workspace-preview-header">
|
||||
<div className="workspace-preview-header-text">
|
||||
<h3>{isZh ? '主题详情' : 'Topic detail'}</h3>
|
||||
<span className="modal-sub">{detailTitle || (isZh ? '原文详情' : 'Raw detail')}</span>
|
||||
</div>
|
||||
<div className="workspace-preview-header-actions">
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={closeDetail}
|
||||
tooltip={isZh ? '关闭详情' : 'Close detail'}
|
||||
aria-label={isZh ? '关闭详情' : 'Close detail'}
|
||||
<DashboardPreviewModalShell
|
||||
closeLabel={isZh ? '关闭详情' : 'Close detail'}
|
||||
onClose={closeDetail}
|
||||
subtitle={detailTitle || (isZh ? '原文详情' : 'Raw detail')}
|
||||
title={isZh ? '主题详情' : 'Topic detail'}
|
||||
>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
<div className="workspace-preview-body markdown">
|
||||
<div className="workspace-markdown">
|
||||
<ReactMarkdown
|
||||
|
|
@ -385,8 +374,7 @@ export function TopicFeedPanel({
|
|||
</ReactMarkdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
</DashboardPreviewModalShell>,
|
||||
portalTarget,
|
||||
)
|
||||
: null}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@ export type RuntimeViewMode = 'visual' | 'topic';
|
|||
export type CompactPanelTab = 'chat' | 'runtime';
|
||||
export type WorkspacePreviewMode = 'preview' | 'edit';
|
||||
export type QuotedReply = { id?: number; text: string; ts: number };
|
||||
export type StagedSubmissionDraft = {
|
||||
id: string;
|
||||
command: string;
|
||||
attachments: string[];
|
||||
quotedReply: QuotedReply | null;
|
||||
updated_at_ms: number;
|
||||
};
|
||||
export type BotEnvParams = Record<string, string>;
|
||||
|
||||
export interface WorkspaceNode {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ export function PlatformBotManagementPage({ compactMode }: PlatformBotManagement
|
|||
loading={dashboard.loading}
|
||||
operatingBotId={dashboard.operatingBotId}
|
||||
pagedBots={dashboard.pagedBots}
|
||||
pageSizeReady={dashboard.pageSizeReady}
|
||||
search={dashboard.search}
|
||||
selectedBotId={dashboard.selectedBotId}
|
||||
onBotListPageChange={dashboard.setBotListPage}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
import axios from 'axios';
|
||||
|
||||
import { APP_ENDPOINTS } from '../../../config/env';
|
||||
import {
|
||||
normalizePlatformPageSize,
|
||||
readCachedPlatformPageSize,
|
||||
writeCachedPlatformPageSize,
|
||||
} from '../../../utils/platformPageSize';
|
||||
import type { PlatformSettings, SystemSettingItem } from '../types';
|
||||
|
||||
export interface SystemSettingsResponse {
|
||||
|
|
@ -22,6 +27,18 @@ export function fetchPlatformSettings() {
|
|||
return axios.get<PlatformSettings>(`${APP_ENDPOINTS.apiBase}/platform/settings`).then((res) => res.data);
|
||||
}
|
||||
|
||||
export async function fetchPreferredPlatformPageSize(fallback = 10) {
|
||||
const cachedFallback = readCachedPlatformPageSize(fallback);
|
||||
try {
|
||||
const data = await fetchPlatformSettings();
|
||||
const normalized = normalizePlatformPageSize(data?.page_size, cachedFallback);
|
||||
writeCachedPlatformPageSize(normalized);
|
||||
return normalized;
|
||||
} catch {
|
||||
return cachedFallback;
|
||||
}
|
||||
}
|
||||
|
||||
export function fetchPlatformSystemSettings() {
|
||||
return axios.get<SystemSettingsResponse>(`${APP_ENDPOINTS.apiBase}/platform/system-settings`).then((res) => res.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ interface PlatformBotListSectionProps {
|
|||
loading: boolean;
|
||||
operatingBotId: string;
|
||||
pagedBots: BotState[];
|
||||
pageSizeReady: boolean;
|
||||
search: string;
|
||||
selectedBotId: string;
|
||||
onBotListPageChange: (value: number | ((value: number) => number)) => void;
|
||||
|
|
@ -32,7 +31,6 @@ export function PlatformBotListSection({
|
|||
loading,
|
||||
operatingBotId,
|
||||
pagedBots,
|
||||
pageSizeReady,
|
||||
search,
|
||||
selectedBotId,
|
||||
onBotListPageChange,
|
||||
|
|
@ -72,7 +70,7 @@ export function PlatformBotListSection({
|
|||
/>
|
||||
|
||||
<div className="list-scroll platform-bot-list-scroll">
|
||||
{pageSizeReady ? pagedBots.map((bot) => {
|
||||
{pagedBots.map((bot) => {
|
||||
const enabled = bot.enabled !== false;
|
||||
const running = bot.docker_status === 'RUNNING';
|
||||
const selected = bot.id === selectedBotId;
|
||||
|
|
@ -131,13 +129,12 @@ export function PlatformBotListSection({
|
|||
</div>
|
||||
</div>
|
||||
);
|
||||
}) : null}
|
||||
{pageSizeReady && filteredBots.length === 0 ? (
|
||||
})}
|
||||
{filteredBots.length === 0 ? (
|
||||
<div className="ops-bot-list-empty">{isZh ? '暂无 Bot,或当前搜索没有结果。' : 'No bots found, or the current search returned no results.'}</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{pageSizeReady ? (
|
||||
<div className="platform-usage-pager">
|
||||
<span className="pager-status">{isZh ? `第 ${botListPage} / ${botListPageCount} 页,共 ${filteredBots.length} 个 Bot` : `Page ${botListPage} / ${botListPageCount}, ${filteredBots.length} bots`}</span>
|
||||
<div className="platform-usage-pager-actions">
|
||||
|
|
@ -163,7 +160,6 @@ export function PlatformBotListSection({
|
|||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import rehypeSanitize from 'rehype-sanitize';
|
|||
import remarkGfm from 'remark-gfm';
|
||||
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { ImageFactoryModule } from '../../images/ImageFactoryModule';
|
||||
import type { BotState } from '../../../types/bot';
|
||||
import { MARKDOWN_SANITIZE_SCHEMA } from '../../dashboard/constants';
|
||||
import { DashboardModalCardShell } from '../../dashboard/components/DashboardModalCardShell';
|
||||
import { repairCollapsedMarkdown } from '../../dashboard/messageParser';
|
||||
import {
|
||||
createWorkspaceMarkdownComponents,
|
||||
|
|
@ -55,40 +55,6 @@ export function PlatformCompactBotSheet({
|
|||
);
|
||||
}
|
||||
|
||||
interface PlatformImageFactoryModalProps {
|
||||
isZh: boolean;
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function PlatformImageFactoryModal({
|
||||
isZh,
|
||||
open,
|
||||
onClose,
|
||||
}: PlatformImageFactoryModalProps) {
|
||||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="modal-mask app-modal-mask" onClick={onClose}>
|
||||
<div className="modal-card app-modal-card" onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '镜像管理' : 'Image Management'}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
<div className="app-modal-body">
|
||||
<ImageFactoryModule />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface PlatformLastActionModalProps {
|
||||
botName?: string;
|
||||
isZh: boolean;
|
||||
|
|
@ -107,21 +73,16 @@ export function PlatformLastActionModal({
|
|||
if (!open) return null;
|
||||
|
||||
const content = repairCollapsedMarkdown(lastAction || (isZh ? '暂无最近执行内容。' : 'No recent execution yet.'));
|
||||
const closeLabel = isZh ? '关闭' : 'Close';
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className="modal-card platform-last-action-modal" onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '最后执行详情' : 'Last Action Details'}</h3>
|
||||
<span className="modal-sub">{botName}</span>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
<DashboardModalCardShell
|
||||
cardClassName="platform-last-action-modal"
|
||||
closeLabel={closeLabel}
|
||||
onClose={onClose}
|
||||
subtitle={botName}
|
||||
title={isZh ? '最后执行详情' : 'Last Action Details'}
|
||||
>
|
||||
<div className="platform-selected-bot-last-body">
|
||||
<div className="workspace-markdown platform-last-action-markdown">
|
||||
<ReactMarkdown
|
||||
|
|
@ -133,8 +94,7 @@ export function PlatformLastActionModal({
|
|||
</ReactMarkdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DashboardModalCardShell>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -163,15 +123,13 @@ export function PlatformResourceMonitorModal({
|
|||
}: PlatformResourceMonitorModalProps) {
|
||||
if (!open) return null;
|
||||
|
||||
const closeLabel = isZh ? '关闭' : 'Close';
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div className="modal-card modal-wide" onClick={(event) => event.stopPropagation()}>
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '资源监测' : 'Resource Monitor'}</h3>
|
||||
<span className="modal-sub mono">{resourceBot?.name || resourceBotId}</span>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<DashboardModalCardShell
|
||||
cardClassName="modal-wide"
|
||||
closeLabel={closeLabel}
|
||||
headerActions={(
|
||||
<LucentIconButton
|
||||
className="btn btn-secondary btn-sm icon-btn"
|
||||
onClick={() => void onRefresh(resourceBotId)}
|
||||
|
|
@ -180,12 +138,11 @@ export function PlatformResourceMonitorModal({
|
|||
>
|
||||
<RefreshCw size={14} className={resourceLoading ? 'animate-spin' : ''} />
|
||||
</LucentIconButton>
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
)}
|
||||
onClose={onClose}
|
||||
subtitle={<span className="mono">{resourceBot?.name || resourceBotId}</span>}
|
||||
title={isZh ? '资源监测' : 'Resource Monitor'}
|
||||
>
|
||||
{resourceError ? <div className="card">{resourceError}</div> : null}
|
||||
{resourceSnapshot ? (
|
||||
<div className="stack">
|
||||
|
|
@ -198,7 +155,7 @@ export function PlatformResourceMonitorModal({
|
|||
<div>{isZh ? '策略说明' : 'Policy'}: <strong>{isZh ? '资源值 0 = 不限制' : 'Value 0 = Unlimited'}</strong></div>
|
||||
</div>
|
||||
|
||||
<div className="grid-2" style={{ gridTemplateColumns: '1fr 1fr' }}>
|
||||
<div className="grid-2">
|
||||
<div className="card stack">
|
||||
<div className="section-mini-title">{isZh ? '配置配额' : 'Configured Limits'}</div>
|
||||
<div className="platform-runtime-row"><span>CPU</span><strong>{Number(resourceSnapshot.configured.cpu_cores) === 0 ? (isZh ? '不限' : 'Unlimited') : resourceSnapshot.configured.cpu_cores}</strong></div>
|
||||
|
|
@ -234,7 +191,6 @@ export function PlatformResourceMonitorModal({
|
|||
) : (
|
||||
<div className="ops-empty-inline">{resourceLoading ? (isZh ? '读取中...' : 'Loading...') : (isZh ? '暂无监控数据' : 'No metrics')}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</DashboardModalCardShell>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
import { Boxes, FileText, Hammer, Settings2 } from 'lucide-react';
|
||||
|
||||
interface PlatformManagementSectionProps {
|
||||
isZh: boolean;
|
||||
onOpenImageFactory: () => void;
|
||||
onOpenPlatformSettings: () => void;
|
||||
onOpenSkillMarketplace: () => void;
|
||||
onOpenTemplateManager: () => void;
|
||||
}
|
||||
|
||||
export function PlatformManagementSection({
|
||||
isZh,
|
||||
onOpenImageFactory,
|
||||
onOpenPlatformSettings,
|
||||
onOpenSkillMarketplace,
|
||||
onOpenTemplateManager,
|
||||
}: PlatformManagementSectionProps) {
|
||||
return (
|
||||
<section className="panel stack">
|
||||
<div>
|
||||
<h2>{isZh ? '平台管理' : 'Platform Management'}</h2>
|
||||
</div>
|
||||
<div className="platform-entry-grid">
|
||||
<button className="platform-entry-card" type="button" onClick={onOpenImageFactory}>
|
||||
<Boxes size={18} />
|
||||
<strong>{isZh ? '镜像管理' : 'Image Management'}</strong>
|
||||
<span>{isZh ? '维护平台基础镜像与镜像注册表。' : 'Manage base images and registry entries.'}</span>
|
||||
</button>
|
||||
<button className="platform-entry-card" type="button" onClick={onOpenTemplateManager}>
|
||||
<FileText size={18} />
|
||||
<strong>{isZh ? '模版管理' : 'Template Management'}</strong>
|
||||
<span>{isZh ? '统一维护默认提示词模版和 Topic 预设。' : 'Manage default prompts and topic presets.'}</span>
|
||||
</button>
|
||||
<button className="platform-entry-card" type="button" onClick={onOpenPlatformSettings}>
|
||||
<Settings2 size={18} />
|
||||
<strong>{isZh ? '平台参数' : 'Platform Settings'}</strong>
|
||||
<span>{isZh ? '统一管理平台级参数。' : 'Manage platform-level settings.'}</span>
|
||||
</button>
|
||||
<button className="platform-entry-card" type="button" onClick={onOpenSkillMarketplace}>
|
||||
<Hammer size={18} />
|
||||
<strong>{isZh ? '技能市场' : 'Skill Marketplace'}</strong>
|
||||
<span>{isZh ? '管理技能包元数据,并给 Bot 技能面板提供一键安装源。' : 'Manage marketplace metadata and provide one-click installs to bot skill panels.'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { ChevronLeft, ChevronRight, Pencil, Plus, RefreshCw, Settings2, Trash2, X } from 'lucide-react';
|
||||
import { ChevronLeft, ChevronRight, Pencil, Plus, RefreshCw, Settings2, Trash2 } from 'lucide-react';
|
||||
|
||||
import '../../../components/skill-market/SkillMarketShared.css';
|
||||
import { DrawerShell } from '../../../components/DrawerShell';
|
||||
|
|
@ -10,18 +10,12 @@ import type { PlatformSettings, SystemSettingItem } from '../types';
|
|||
import {
|
||||
createPlatformSystemSetting,
|
||||
deletePlatformSystemSetting,
|
||||
fetchPreferredPlatformPageSize,
|
||||
fetchPlatformSettings,
|
||||
fetchPlatformSystemSettings,
|
||||
updatePlatformSystemSetting,
|
||||
} from '../api/settings';
|
||||
|
||||
interface PlatformSettingsModalProps {
|
||||
isZh: boolean;
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSaved: (settings: PlatformSettings) => void;
|
||||
}
|
||||
|
||||
interface PlatformSettingsPageProps {
|
||||
isZh: boolean;
|
||||
}
|
||||
|
|
@ -76,21 +70,11 @@ function parseValue(draft: SettingDraft) {
|
|||
return draft.value;
|
||||
}
|
||||
|
||||
function normalizePageSize(value: unknown, fallback = 10) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
|
||||
return Math.max(1, Math.min(100, Math.floor(parsed)));
|
||||
}
|
||||
|
||||
function PlatformSettingsView({
|
||||
isZh,
|
||||
embedded,
|
||||
onClose,
|
||||
onSaved,
|
||||
}: {
|
||||
isZh: boolean;
|
||||
embedded: boolean;
|
||||
onClose?: () => void;
|
||||
onSaved: (settings: PlatformSettings) => void;
|
||||
}) {
|
||||
const { notify, confirm } = useLucentPrompt();
|
||||
|
|
@ -119,11 +103,11 @@ function PlatformSettingsView({
|
|||
const refreshSnapshot = async () => {
|
||||
try {
|
||||
const data = await fetchPlatformSettings();
|
||||
setPageSize(normalizePageSize(data?.page_size, 10));
|
||||
onSaved(data);
|
||||
} catch {
|
||||
// Ignore snapshot refresh failures here; the table is still the source of truth in the view.
|
||||
}
|
||||
setPageSize(await fetchPreferredPlatformPageSize(10));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -185,21 +169,8 @@ function PlatformSettingsView({
|
|||
}
|
||||
};
|
||||
|
||||
const content = (
|
||||
<div className={embedded ? 'panel stack skill-market-page-shell platform-settings-page-shell' : 'modal-card modal-wide platform-modal platform-settings-surface'}>
|
||||
{!embedded ? (
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '平台参数' : 'Platform Settings'}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
return (
|
||||
<div className="panel stack skill-market-page-shell platform-settings-page-shell">
|
||||
<div className="platform-settings-info-card skill-market-page-info-card">
|
||||
<div className="skill-market-page-info-main">
|
||||
<div className="platform-settings-info-icon">
|
||||
|
|
@ -230,7 +201,7 @@ function PlatformSettingsView({
|
|||
searchTitle={isZh ? '搜索' : 'Search'}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
className="btn btn-primary skill-market-button-with-icon"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setEditingKey('');
|
||||
|
|
@ -239,7 +210,7 @@ function PlatformSettingsView({
|
|||
}}
|
||||
>
|
||||
<Plus size={14} />
|
||||
<span style={{ marginLeft: 6 }}>{isZh ? '新增' : 'Add'}</span>
|
||||
<span>{isZh ? '新增' : 'Add'}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
|
@ -350,16 +321,17 @@ function PlatformSettingsView({
|
|||
title={editingKey ? (isZh ? '编辑参数' : 'Edit Setting') : (isZh ? '新增参数' : 'Create Setting')}
|
||||
subtitle={isZh ? '参数会在保存后立即同步到平台运行时。' : 'The setting is applied to the platform runtime immediately after saving.'}
|
||||
size="standard"
|
||||
bodyClassName="skill-market-form-drawer-body"
|
||||
closeLabel={isZh ? '关闭' : 'Close'}
|
||||
footer={(
|
||||
<div className="drawer-shell-footer-content">
|
||||
<div className="drawer-shell-footer-main field-label">
|
||||
{isZh ? '保存后平台会立即使用最新参数。' : 'The platform starts using the latest value immediately after save.'}
|
||||
</div>
|
||||
<div style={{ display: 'inline-flex', gap: 8, flexWrap: 'wrap' }}>
|
||||
<div className="skill-market-inline-actions skill-market-inline-actions-wrap">
|
||||
<button className="btn btn-secondary" type="button" onClick={() => setShowEditor(false)}>{isZh ? '取消' : 'Cancel'}</button>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
className="btn btn-primary skill-market-button-with-icon"
|
||||
type="button"
|
||||
disabled={saving}
|
||||
onClick={() => {
|
||||
|
|
@ -367,12 +339,14 @@ function PlatformSettingsView({
|
|||
}}
|
||||
>
|
||||
{saving ? <RefreshCw size={14} className="animate-spin" /> : null}
|
||||
<span style={{ marginLeft: saving ? 6 : 0 }}>{isZh ? '保存' : 'Save'}</span>
|
||||
<span>{isZh ? '保存' : 'Save'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<div className="skill-market-form-modal">
|
||||
<div className="skill-market-form-scroll">
|
||||
<div className="platform-setting-editor">
|
||||
<label className="field-label">{isZh ? '参数键' : 'Key'}</label>
|
||||
<input className="input" value={draft.key} onChange={(event) => setDraft((prev) => ({ ...prev, key: event.target.value }))} disabled={Boolean(editingKey)} />
|
||||
|
|
@ -410,32 +384,14 @@ function PlatformSettingsView({
|
|||
{isZh ? '前端可访问' : 'Public to frontend'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DrawerShell>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
if (embedded) return content;
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div onClick={(event) => event.stopPropagation()}>
|
||||
{content}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function PlatformSettingsModal({
|
||||
isZh,
|
||||
open,
|
||||
onClose,
|
||||
onSaved,
|
||||
}: PlatformSettingsModalProps) {
|
||||
if (!open) return null;
|
||||
return <PlatformSettingsView isZh={isZh} onClose={onClose} onSaved={onSaved} embedded={false} />;
|
||||
}
|
||||
|
||||
export function PlatformSettingsPage({ isZh }: PlatformSettingsPageProps) {
|
||||
return <PlatformSettingsView isZh={isZh} onSaved={() => {}} embedded />;
|
||||
return <PlatformSettingsView isZh={isZh} onSaved={() => {}} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,19 @@
|
|||
import { useEffect, useMemo, useState, type ChangeEvent } from 'react';
|
||||
import { ChevronLeft, ChevronRight, FileArchive, Hammer, Pencil, Plus, RefreshCw, Trash2, Upload, X } from 'lucide-react';
|
||||
import { ChevronLeft, ChevronRight, FileArchive, Hammer, Pencil, Plus, RefreshCw, Trash2, Upload } from 'lucide-react';
|
||||
import '../../../components/skill-market/SkillMarketShared.css';
|
||||
import { DrawerShell } from '../../../components/DrawerShell';
|
||||
import { ProtectedSearchInput } from '../../../components/ProtectedSearchInput';
|
||||
import type { SkillMarketItem } from '../types';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { useLucentPrompt } from '../../../components/lucent/LucentPromptProvider';
|
||||
import { fetchPlatformSettings } from '../api/settings';
|
||||
import { fetchPreferredPlatformPageSize } from '../api/settings';
|
||||
import {
|
||||
createPlatformSkillMarketItem,
|
||||
deletePlatformSkillMarketItem,
|
||||
fetchPlatformSkillMarket,
|
||||
updatePlatformSkillMarketItem,
|
||||
} from '../api/skills';
|
||||
import {
|
||||
normalizePlatformPageSize,
|
||||
readCachedPlatformPageSize,
|
||||
writeCachedPlatformPageSize,
|
||||
} from '../../../utils/platformPageSize';
|
||||
|
||||
interface SkillMarketManagerModalProps {
|
||||
isZh: boolean;
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
import { readCachedPlatformPageSize } from '../../../utils/platformPageSize';
|
||||
|
||||
interface SkillMarketManagerPageProps {
|
||||
isZh: boolean;
|
||||
|
|
@ -36,13 +26,6 @@ interface SkillDraft {
|
|||
file: File | null;
|
||||
}
|
||||
|
||||
const emptyDraft: SkillDraft = {
|
||||
skillKey: '',
|
||||
displayName: '',
|
||||
description: '',
|
||||
file: null,
|
||||
};
|
||||
|
||||
function buildEmptyDraft(): SkillDraft {
|
||||
return {
|
||||
skillKey: '',
|
||||
|
|
@ -62,7 +45,7 @@ function formatBytes(bytes: number) {
|
|||
}
|
||||
|
||||
function buildDraft(item?: SkillMarketItem | null): SkillDraft {
|
||||
if (!item) return emptyDraft;
|
||||
if (!item) return buildEmptyDraft();
|
||||
return {
|
||||
skillKey: item.skill_key || '',
|
||||
displayName: item.display_name || '',
|
||||
|
|
@ -73,12 +56,8 @@ function buildDraft(item?: SkillMarketItem | null): SkillDraft {
|
|||
|
||||
function SkillMarketManagerView({
|
||||
isZh,
|
||||
onClose,
|
||||
embedded,
|
||||
}: {
|
||||
isZh: boolean;
|
||||
onClose?: () => void;
|
||||
embedded: boolean;
|
||||
}) {
|
||||
const { notify, confirm } = useLucentPrompt();
|
||||
const [items, setItems] = useState<SkillMarketItem[]>([]);
|
||||
|
|
@ -115,14 +94,7 @@ function SkillMarketManagerView({
|
|||
void loadRows();
|
||||
setPage(1);
|
||||
void (async () => {
|
||||
try {
|
||||
const data = await fetchPlatformSettings();
|
||||
const normalized = normalizePlatformPageSize(data?.page_size, readCachedPlatformPageSize(10));
|
||||
writeCachedPlatformPageSize(normalized);
|
||||
setPageSize(normalized);
|
||||
} catch {
|
||||
setPageSize(readCachedPlatformPageSize(10));
|
||||
}
|
||||
setPageSize(await fetchPreferredPlatformPageSize(10));
|
||||
})();
|
||||
}, []);
|
||||
|
||||
|
|
@ -245,21 +217,8 @@ function SkillMarketManagerView({
|
|||
setEditorOpen(true);
|
||||
};
|
||||
|
||||
const content = (
|
||||
<div className={embedded ? 'panel stack skill-market-page-shell' : 'modal-card modal-wide platform-modal skill-market-modal-shell'}>
|
||||
{!embedded ? (
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '技能市场管理' : 'Skill Marketplace'}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
return (
|
||||
<div className="panel stack skill-market-page-shell">
|
||||
<div className="platform-settings-info-card skill-market-page-info-card">
|
||||
<div className="skill-market-page-info-main">
|
||||
<div className="platform-settings-info-icon">
|
||||
|
|
@ -286,13 +245,13 @@ function SkillMarketManagerView({
|
|||
searchTitle={isZh ? '搜索' : 'Search'}
|
||||
/>
|
||||
<div className="skill-market-admin-actions">
|
||||
<button className="btn btn-secondary btn-sm" type="button" disabled={loading} onClick={() => void loadRows()}>
|
||||
<button className="btn btn-secondary btn-sm skill-market-button-with-icon" type="button" disabled={loading} onClick={() => void loadRows()}>
|
||||
{loading ? <RefreshCw size={14} className="animate-spin" /> : <RefreshCw size={14} />}
|
||||
<span style={{ marginLeft: 6 }}>{isZh ? '刷新' : 'Refresh'}</span>
|
||||
<span>{isZh ? '刷新' : 'Refresh'}</span>
|
||||
</button>
|
||||
<button className="btn btn-secondary btn-sm skill-market-create-btn" type="button" onClick={openCreateDrawer}>
|
||||
<Plus size={14} />
|
||||
<span style={{ marginLeft: 6 }}>{isZh ? '新增技能' : 'Add Skill'}</span>
|
||||
<span>{isZh ? '新增技能' : 'Add Skill'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -389,22 +348,24 @@ function SkillMarketManagerView({
|
|||
: (isZh ? '上传技能 ZIP 后,会立即生成可管理的市场卡片。' : 'Upload a skill ZIP package to create a manageable marketplace card immediately.')
|
||||
}
|
||||
size="standard"
|
||||
bodyClassName="skill-market-drawer-body"
|
||||
bodyClassName="skill-market-form-drawer-body"
|
||||
closeLabel={isZh ? '关闭面板' : 'Close panel'}
|
||||
footer={(
|
||||
<div className="drawer-shell-footer-content">
|
||||
<div className="drawer-shell-footer-main field-label">
|
||||
{isZh ? '保存后将更新该技能的市场资料与归档文件。' : 'Saving updates the marketplace metadata and archived package for this skill.'}
|
||||
</div>
|
||||
<button className="btn btn-primary" type="button" disabled={saving} onClick={() => void submit()}>
|
||||
<button className="btn btn-primary skill-market-button-with-icon" type="button" disabled={saving} onClick={() => void submit()}>
|
||||
{saving ? <RefreshCw size={14} className="animate-spin" /> : <Hammer size={14} />}
|
||||
<span style={{ marginLeft: 6 }}>
|
||||
<span>
|
||||
{saving ? (isZh ? '保存中...' : 'Saving...') : editingItem ? (isZh ? '保存修改' : 'Save Changes') : (isZh ? '创建技能' : 'Create Skill')}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<div className="skill-market-form-modal">
|
||||
<div className="skill-market-form-scroll">
|
||||
<div className="skill-market-editor">
|
||||
<label className="field-label">{isZh ? '技能标识' : 'Skill Key'}</label>
|
||||
<input
|
||||
|
|
@ -461,28 +422,13 @@ function SkillMarketManagerView({
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DrawerShell>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (embedded) {
|
||||
return content;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div onClick={(event) => event.stopPropagation()}>
|
||||
{content}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SkillMarketManagerModal({ isZh, open, onClose }: SkillMarketManagerModalProps) {
|
||||
if (!open) return null;
|
||||
return <SkillMarketManagerView isZh={isZh} onClose={onClose} embedded={false} />;
|
||||
}
|
||||
|
||||
export function SkillMarketManagerPage({ isZh }: SkillMarketManagerPageProps) {
|
||||
return <SkillMarketManagerView isZh={isZh} embedded />;
|
||||
return <SkillMarketManagerView isZh={isZh} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { FileText, RefreshCw, X } from 'lucide-react';
|
||||
import { FileText, RefreshCw } from 'lucide-react';
|
||||
|
||||
import '../../../components/skill-market/SkillMarketShared.css';
|
||||
import { LucentIconButton } from '../../../components/lucent/LucentIconButton';
|
||||
import { useLucentPrompt } from '../../../components/lucent/LucentPromptProvider';
|
||||
import { MarkdownLiteEditor } from '../../../components/markdown/MarkdownLiteEditor';
|
||||
import { fetchPlatformSystemTemplates, updatePlatformSystemTemplates } from '../api/templates';
|
||||
|
||||
interface TemplateManagerModalProps {
|
||||
isZh: boolean;
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
interface TemplateManagerPageProps {
|
||||
isZh: boolean;
|
||||
}
|
||||
|
|
@ -62,12 +55,8 @@ const templateMeta: Record<TemplateTabKey, { zh: string; en: string; description
|
|||
|
||||
function TemplateManagerView({
|
||||
isZh,
|
||||
embedded,
|
||||
onClose,
|
||||
}: {
|
||||
isZh: boolean;
|
||||
embedded: boolean;
|
||||
onClose?: () => void;
|
||||
}) {
|
||||
const { notify } = useLucentPrompt();
|
||||
const [templates, setTemplates] = useState<Record<string, string>>({
|
||||
|
|
@ -112,21 +101,8 @@ function TemplateManagerView({
|
|||
|
||||
const activeMeta = useMemo(() => templateMeta[activeTab], [activeTab]);
|
||||
|
||||
const content = (
|
||||
<div className={embedded ? 'panel stack skill-market-page-shell platform-template-page-shell' : 'modal-card modal-wide platform-modal platform-template-surface'}>
|
||||
{!embedded ? (
|
||||
<div className="modal-title-row modal-title-with-close">
|
||||
<div className="modal-title-main">
|
||||
<h3>{isZh ? '模版管理' : 'Template Manager'}</h3>
|
||||
</div>
|
||||
<div className="modal-title-actions">
|
||||
<LucentIconButton className="btn btn-secondary btn-sm icon-btn" onClick={onClose} tooltip={isZh ? '关闭' : 'Close'} aria-label={isZh ? '关闭' : 'Close'}>
|
||||
<X size={14} />
|
||||
</LucentIconButton>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
return (
|
||||
<div className="panel stack skill-market-page-shell platform-template-page-shell">
|
||||
<div className="platform-settings-info-card skill-market-page-info-card">
|
||||
<div className="skill-market-page-info-main">
|
||||
<div className="platform-settings-info-icon">
|
||||
|
|
@ -165,7 +141,7 @@ function TemplateManagerView({
|
|||
<div className="platform-template-hint">{isZh ? activeMeta.descriptionZh : activeMeta.descriptionEn}</div>
|
||||
</div>
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
className="btn btn-secondary btn-sm skill-market-button-with-icon"
|
||||
type="button"
|
||||
disabled={loading}
|
||||
onClick={() => void (async () => {
|
||||
|
|
@ -188,7 +164,7 @@ function TemplateManagerView({
|
|||
})()}
|
||||
>
|
||||
{loading ? <RefreshCw size={14} className="animate-spin" /> : null}
|
||||
<span style={{ marginLeft: loading ? 6 : 0 }}>{isZh ? '重载' : 'Reload'}</span>
|
||||
<span>{isZh ? '重载' : 'Reload'}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
|
@ -214,7 +190,7 @@ function TemplateManagerView({
|
|||
<div className="row-between platform-template-page-footer">
|
||||
<div className="field-label">{isZh ? '保存后,新建 Bot 与 Topic 会使用最新平台模板。' : 'Saved templates will be used by newly created bots and topics.'}</div>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
className="btn btn-primary skill-market-button-with-icon"
|
||||
type="button"
|
||||
disabled={saving || loading}
|
||||
onClick={() => {
|
||||
|
|
@ -239,28 +215,13 @@ function TemplateManagerView({
|
|||
}}
|
||||
>
|
||||
{saving ? <RefreshCw size={14} className="animate-spin" /> : null}
|
||||
<span style={{ marginLeft: saving ? 6 : 0 }}>{isZh ? '保存全部模板' : 'Save All Templates'}</span>
|
||||
<span>{isZh ? '保存全部模板' : 'Save All Templates'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (embedded) return content;
|
||||
|
||||
return (
|
||||
<div className="modal-mask" onClick={onClose}>
|
||||
<div onClick={(event) => event.stopPropagation()}>
|
||||
{content}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function TemplateManagerModal({ isZh, open, onClose }: TemplateManagerModalProps) {
|
||||
if (!open) return null;
|
||||
return <TemplateManagerView isZh={isZh} onClose={onClose} embedded={false} />;
|
||||
}
|
||||
|
||||
export function TemplateManagerPage({ isZh }: TemplateManagerPageProps) {
|
||||
return <TemplateManagerView isZh={isZh} embedded />;
|
||||
return <TemplateManagerView isZh={isZh} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ export function usePlatformDashboard({ compactMode }: UsePlatformDashboardOption
|
|||
const [selectedBotId, setSelectedBotId] = useState('');
|
||||
const [search, setSearch] = useState('');
|
||||
const [operatingBotId, setOperatingBotId] = useState('');
|
||||
const [showImageFactory, setShowImageFactory] = useState(false);
|
||||
const [showTemplateManager, setShowTemplateManager] = useState(false);
|
||||
const [showPlatformSettings, setShowPlatformSettings] = useState(false);
|
||||
const [showBotLastActionModal, setShowBotLastActionModal] = useState(false);
|
||||
const [showResourceModal, setShowResourceModal] = useState(false);
|
||||
const [selectedBotDetail, setSelectedBotDetail] = useState<BotState | null>(null);
|
||||
|
|
@ -57,7 +54,6 @@ export function usePlatformDashboard({ compactMode }: UsePlatformDashboardOption
|
|||
const [activityLoading, setActivityLoading] = useState(false);
|
||||
const [usagePage, setUsagePage] = useState(1);
|
||||
const [usagePageSize, setUsagePageSize] = useState(() => readCachedPlatformPageSize(10));
|
||||
const [pageSizeReady, setPageSizeReady] = useState(true);
|
||||
const [botListPage, setBotListPage] = useState(1);
|
||||
const [botListPageSize, setBotListPageSize] = useState(() => readCachedPlatformPageSize(10));
|
||||
const [showCompactBotSheet, setShowCompactBotSheet] = useState(false);
|
||||
|
|
@ -111,7 +107,6 @@ export function usePlatformDashboard({ compactMode }: UsePlatformDashboardOption
|
|||
} catch (error: any) {
|
||||
notify(error?.response?.data?.detail || (isZh ? '读取平台总览失败。' : 'Failed to load platform overview.'), { tone: 'error' });
|
||||
} finally {
|
||||
setPageSizeReady(true);
|
||||
setLoading(false);
|
||||
}
|
||||
}, [isZh, notify]);
|
||||
|
|
@ -185,9 +180,8 @@ export function usePlatformDashboard({ compactMode }: UsePlatformDashboardOption
|
|||
}, [loadOverview]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!pageSizeReady) return;
|
||||
void loadUsage(1);
|
||||
}, [loadUsage, pageSizeReady, usagePageSize]);
|
||||
}, [loadUsage, usagePageSize]);
|
||||
|
||||
useEffect(() => {
|
||||
void loadActivityStats();
|
||||
|
|
@ -485,7 +479,6 @@ export function usePlatformDashboard({ compactMode }: UsePlatformDashboardOption
|
|||
overviewBots,
|
||||
overviewImages,
|
||||
overviewResources,
|
||||
pageSizeReady,
|
||||
pagedBots,
|
||||
refreshAll,
|
||||
removeBot,
|
||||
|
|
@ -502,15 +495,9 @@ export function usePlatformDashboard({ compactMode }: UsePlatformDashboardOption
|
|||
setBotListPage,
|
||||
setSearch,
|
||||
setShowBotLastActionModal,
|
||||
setShowImageFactory,
|
||||
setShowPlatformSettings,
|
||||
setShowTemplateManager,
|
||||
showBotLastActionModal,
|
||||
showCompactBotSheet,
|
||||
showImageFactory,
|
||||
showPlatformSettings,
|
||||
showResourceModal,
|
||||
showTemplateManager,
|
||||
storagePercent,
|
||||
toggleBot,
|
||||
usageAnalytics,
|
||||
|
|
|
|||
|
|
@ -6,11 +6,6 @@ export interface PlatformSettings {
|
|||
allowed_attachment_extensions: string[];
|
||||
workspace_download_extensions: string[];
|
||||
speech_enabled: boolean;
|
||||
loading_page?: {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
description: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SystemSettingItem {
|
||||
|
|
|
|||
Loading…
Reference in New Issue