forked from linkong/planet
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d30f7d08c5 |
No files matched your search
@@ -8,6 +8,23 @@ This project follows the repository versioning rule:
|
||||
- `improvement` -> `+0.0.1`(bugfix + 小功能混合)
|
||||
- `bugfix` -> `+0.0.1`
|
||||
|
||||
## [0.74.1] — 2026-06-30
|
||||
|
||||
Released: 2026-06-30
|
||||
|
||||
### Highlights
|
||||
- 将 `/earth-content` 的品牌标识上传收敛到 `Logo 地址` 与 `标题图地址` 字段内,移除旧的全局“选择资产/上传”工具栏。
|
||||
- 新增字段级图片拖拽反馈,拖到对应字段时直接提示将图片复制为 Logo 或标题图。
|
||||
- 对齐品牌上传按钮到现有 Tactile UI primary 按钮样式,并同步中英文使用手册、快速开始和控制台上下文文档。
|
||||
|
||||
### Added / Fixed / Improved
|
||||
- `BrandAssetInput` 支持字段内选择文件、拖拽上传、单字段 loading 和上传后回写草稿 URL。
|
||||
- `FieldGrid` 支持按字段注入自定义输入控件,同时复用统一草稿提交路径。
|
||||
- 品牌上传拖拽态改为低饱和 tactile 配色,上传按钮保持蓝色轻立体样式,容器内上下/右侧留白对齐为 3px。
|
||||
- 补齐品牌上传相关 legacy UI 英文翻译、术语对照和用户文档。
|
||||
|
||||
---
|
||||
|
||||
## [0.74.0] — 2026-06-30
|
||||
|
||||
Released: 2026-06-30
|
||||
|
||||
@@ -387,6 +387,7 @@ Current boundary:
|
||||
`/earth-content` reuses the same single-screen tab container from [Settings.tsx](/home/ray/dev/linkong/planet/frontend/src/admin/pages/PlainResourcePages.tsx), but its ownership is separate from System Settings:
|
||||
|
||||
- `TV Livestream` owns the Earth media-panel source configuration.
|
||||
- `Branding` owns Earth HUD brand assets. `Logo URL` and `Title Image URL` use inline upload controls inside the fields; the upload buttons keep the primary `TactileButton` style, and dropping an image onto the matching field shows a low-saturation drag reaction instead of the old global asset-picker toolbar.
|
||||
- `Boundary Precision` owns the Earth static boundary asset state: provider, low-precision fallback, high-precision manifest/PMTiles, source JSON, and build action.
|
||||
- `Base Map`, `Layer Resources`, `3D Assets`, and `News Anchor Strategy` are placeholders only. They show module status and do not invent fake APIs or fake data.
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ TV livestreams and boundary precision moved to `/earth-content`; collectors and
|
||||
|
||||
`/earth-content` is under the console's Operations and Configuration group and owns resources used by the Earth frontend:
|
||||
|
||||
- **Brand Assets**: manages the logo, title image, title text, subtitle, and description used by the Earth HUD. Uploaded images are saved as Earth brand assets and read by the Earth page immediately.
|
||||
- **Brand Assets**: manages the logo, title image, title text, subtitle, and description used by the Earth HUD. The `Logo URL` and `Title Image URL` fields each include their own Upload button, and image files can be dropped directly onto the matching field. After upload, the field receives the new asset URL; save the brand configuration to make the Earth page use it.
|
||||
- **About**: manages the About card shown in Earth settings, including logo, kicker, title, version, description, and metadata.
|
||||
- **TV Livestream**: manages sources shown in the Earth media panel.
|
||||
- **News Content**: browses news grouped by RSS source and manual group. RSS items remain read-only; manual groups support create, JSON import, edit, delete, and reprocess.
|
||||
|
||||
@@ -28,6 +28,9 @@ This document standardizes terms used across Intelligent Planet, the console, ba
|
||||
| AI Provider | AI Provider | Service name |
|
||||
| tool | 工具 | Web Search, OCR, and similar integrations |
|
||||
| Playground | Playground | Interactive debugging entry |
|
||||
| branding | 品牌标识 | Earth HUD brand configuration section under `/earth-content` |
|
||||
| brand assets | 品牌资源 | Logo, title image, and related HUD copy assets |
|
||||
| title image | 标题图 | Earth HUD title image |
|
||||
|
||||
## Data Types
|
||||
|
||||
|
||||
@@ -34,9 +34,10 @@ After landing on the `/admin` dashboard, here's a recommended walk-through:
|
||||
|
||||
1. `/collection-management?section=collector_credentials`: pick a collector and click the plug icon to test connectivity. Free collectors (e.g. open BGP) usually work right away; credential-bearing ones like `AISStream` or `BarentsWatch` need an API key / client secret first
|
||||
2. `/ai?section=integrations`: fill an LLM provider (e.g. `minimax` / `openai`), model, base URL, API key, and click the plug at the end of the base URL to test. WebSearch / OCR tools are optional
|
||||
3. `/datasources` or `/data`: check whether collectors have produced data. Use `/datasources -> Built-in Sources` for finite collectors: with no rows selected, click `Trigger All`; after selecting rows, the primary button becomes `Trigger Selected N`. The top-right queue button shows progress. Use `/datasources -> Realtime Sources` for AISStream / WebSocket health and counters
|
||||
4. `/alerts/system`: verify system alerts look right
|
||||
5. `/users` (super_admin only): open accounts for teammates or adjust their groups
|
||||
3. `/earth-content?section=brand`: maintain the Earth HUD logo and title image in Branding. The Upload button inside each URL field opens a file picker, and image files can also be dropped directly onto the matching field. Save the brand configuration after upload
|
||||
4. `/datasources` or `/data`: check whether collectors have produced data. Use `/datasources -> Built-in Sources` for finite collectors: with no rows selected, click `Trigger All`; after selecting rows, the primary button becomes `Trigger Selected N`. The top-right queue button shows progress. Use `/datasources -> Realtime Sources` for AISStream / WebSocket health and counters
|
||||
5. `/alerts/system`: verify system alerts look right
|
||||
6. `/users` (super_admin only): open accounts for teammates or adjust their groups
|
||||
|
||||
## 4. Open Earth
|
||||
|
||||
|
||||
@@ -418,6 +418,7 @@ AI 配置不再挂在 `/settings` 下;`/playground` 应跳转到 `/ai?section=
|
||||
`/earth-content` 复用 [Settings.tsx](/home/ray/dev/linkong/planet/frontend/src/admin/pages/PlainResourcePages.tsx) 的单屏 tab 容器,但页面责任与系统设置分离:
|
||||
|
||||
- `电视直播` 迁移原直播源配置,继续管理 Earth 媒体面板内容源。
|
||||
- `品牌标识` 管理 Earth HUD 的品牌资源。`Logo 地址` 与 `标题图地址` 使用字段内上传控件,上传按钮保持 `TactileButton` 的 primary 样式;图片拖到对应字段时显示低饱和拖拽反应,避免回到旧的全局“选择资产/上传”工具栏。
|
||||
- `国界精度` 管理 Earth 静态国界资产:provider 状态、低精 fallback、高精 manifest/PMTiles、源配置 JSON 和构建动作。
|
||||
- `地球底图`、`图层资源`、`三维素材`、`新闻锚点策略` 是占位页,只显示模块待接入,不造假接口或假数据。
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ Base URL 输入框尾端的插头图标会触发连接测试。测试通过会
|
||||
|
||||
`/earth-content` 位于控制台“运维与配置”下,面向智能星球前端体验资源:
|
||||
|
||||
- **品牌资源**:维护智能星球 HUD 使用的 logo、标题图、标题文本、副标题和描述;上传的图片会保存为智能星球品牌资产并立即供智能星球页面读取。
|
||||
- **品牌资源**:维护智能星球 HUD 使用的 logo、标题图、标题文本、副标题和描述。`Logo 地址` 和 `标题图地址` 字段内各有独立的“上传”按钮,也可以把图片直接拖到对应字段;上传成功后字段会写入新的资产地址,保存品牌配置后供智能星球页面读取。
|
||||
- **关于**:维护智能星球设置面板里的关于卡片,包括 logo、眉标、标题、版本、描述和元信息。
|
||||
- **电视直播**:维护智能星球媒体面板里的直播源。
|
||||
- **新闻内容**:按 RSS 来源和手动新闻组查看新闻。RSS 新闻保持只读;手动新闻组可以新增、批量导入 JSON、编辑、删除和重新处理。
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
| AI Provider | AI Provider | 服务名,保留英文 |
|
||||
| tool | 工具 | Web Search、OCR 等工具配置 |
|
||||
| Playground | Playground | 交互调试入口,保留英文 |
|
||||
| branding | 品牌标识 | `/earth-content` 中的 Earth HUD 品牌配置分区 |
|
||||
| brand assets | 品牌资源 | Logo、标题图和相关 HUD 文案资源 |
|
||||
| title image | 标题图 | Earth HUD 标题图片,不写作“标题图片地址”以外的混合名 |
|
||||
|
||||
## 数据类型
|
||||
|
||||
|
||||
@@ -34,9 +34,10 @@
|
||||
|
||||
1. `/collection-management?section=collector_credentials`:选一个采集器,点插头图标做连接测试。免费 collector(开源 BGP 等)通常直接可用;像 `AISStream`、`BarentsWatch` 这类需要凭证的,需要先填 API Key/Client Secret
|
||||
2. `/ai?section=integrations`:填一个 LLM provider(例如 `minimax` / `openai`)、模型名、Base URL、API Key,点 Base URL 末端的插头测试连接。WebSearch / OCR 工具可选
|
||||
3. `/datasources` 或 `/data`:看采集器是否已经产出数据。有限采集器看 `/datasources -> 内置源`,不勾选时点“触发全部”,勾选后主按钮会变成“触发已选 N”;右上角队列按钮可查看进度。AISStream / WebSocket 长连接看 `/datasources -> 实时源` 的健康状态和计数
|
||||
4. `/alerts/system`:看系统告警是否正常
|
||||
5. `/users`(仅 `super_admin`):根据需要给同事开账号或调权限组
|
||||
3. `/earth-content?section=brand`:在“品牌标识”里维护智能星球的 Logo 和标题图;对应地址字段内的“上传”按钮支持选择文件,也支持把图片直接拖到字段上,保存后会应用到智能星球 HUD
|
||||
4. `/datasources` 或 `/data`:看采集器是否已经产出数据。有限采集器看 `/datasources -> 内置源`,不勾选时点“触发全部”,勾选后主按钮会变成“触发已选 N”;右上角队列按钮可查看进度。AISStream / WebSocket 长连接看 `/datasources -> 实时源` 的健康状态和计数
|
||||
5. `/alerts/system`:看系统告警是否正常
|
||||
6. `/users`(仅 `super_admin`):根据需要给同事开账号或调权限组
|
||||
|
||||
## 4. 打开智能星球
|
||||
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
## Current Version
|
||||
|
||||
- `main` 当前主线历史推导到:`0.16.5`
|
||||
- `dev` 当前开发分支历史推导到:`0.74.0`
|
||||
- `dev` 当前开发分支历史推导到:`0.74.1`
|
||||
|
||||
## Timeline
|
||||
|
||||
| Version | Type | Branch | Commit | Summary |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `0.74.1` | improvement | `dev` | `pending` | 将品牌标识上传收敛到 Logo/标题图字段内,新增字段级拖拽反馈和 Tactile UI primary 上传按钮,并同步中英文使用文档 |
|
||||
| `0.74.0` | feature | `dev` | `pending` | 扩展统一 i18n 到 Web Earth 动态入口、控制台/API 错误和公开页面,修复 Earth 通知胶囊、语言 switch、品牌栏、legend、tooltip、新闻/TV 英文态裁切与中文残留,并加入 harness 回归覆盖 |
|
||||
| `0.73.0` | feature | `dev` | `pending` | 新增前端统一 i18n、控制台语言/主题偏好入口、英文态 legacy 过渡翻译和 admin 一屏/状态指示器布局验证 |
|
||||
| `0.72.0` | feature | `dev` | `pending` | 新增完整 agent harness、单一 AGENTS 入口、Earth News smoke 覆盖和 collector 结构化日志清理,并同步控制台/Earth/Docs 响应式维护文档 |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "planet-frontend",
|
||||
"version": "0.74.0",
|
||||
"version": "0.74.1",
|
||||
"private": true,
|
||||
"packageManager": "bun@1",
|
||||
"dependencies": {
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
Trash2,
|
||||
X,
|
||||
} from 'lucide-react'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type ChangeEvent, type CSSProperties, type DragEvent as ReactDragEvent, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react'
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||
import MarkdownRenderer from '../../components/MarkdownRenderer/MarkdownRenderer'
|
||||
import Scrollbar from '../../components/Scrollbar/Scrollbar'
|
||||
@@ -132,6 +132,8 @@ type DatasourceMetricBaseline = {
|
||||
count: number
|
||||
}
|
||||
|
||||
type BrandAssetTargetKey = 'logo_src' | 'title_src'
|
||||
|
||||
const DEFAULT_DATASOURCE_FILTERS: DatasourceFilters = {
|
||||
product: '',
|
||||
module: '',
|
||||
@@ -871,6 +873,14 @@ type FieldConfig = {
|
||||
placeholder?: string
|
||||
disabled?: boolean
|
||||
help?: string
|
||||
renderInput?: (props: {
|
||||
disabled?: boolean
|
||||
displayValue: unknown
|
||||
fieldKey: string
|
||||
onChange: (value: unknown) => void
|
||||
placeholder?: string
|
||||
value: unknown
|
||||
}) => ReactNode
|
||||
inputAction?: {
|
||||
ariaLabel?: string
|
||||
disabled?: boolean
|
||||
@@ -2301,6 +2311,9 @@ function FieldGrid({
|
||||
const className = field.wide ? 'an-field an-field--wide' : 'an-field'
|
||||
const searchTarget = searchGroupKey ? `${searchGroupKey}:field:${field.key}` : `field:${field.key}`
|
||||
const searchText = [label, field.key, text(displayValue, '')].filter(Boolean).join(' ')
|
||||
const commitFieldValue = (nextValue: unknown) => {
|
||||
onDraftChange(setNestedDraftField(draft, record, field.key, nextValue))
|
||||
}
|
||||
if (field.type === 'boolean') {
|
||||
return (
|
||||
<label key={field.key} className="an-checkbox-row an-field--wide" data-admin-search-target={searchTarget} data-admin-search-field={field.key} data-admin-search-text={searchText}>
|
||||
@@ -2308,7 +2321,7 @@ function FieldGrid({
|
||||
type="checkbox"
|
||||
checked={Boolean(value)}
|
||||
disabled={field.disabled}
|
||||
onChange={(event) => onDraftChange(setNestedDraftField(draft, record, field.key, event.target.checked))}
|
||||
onChange={(event) => commitFieldValue(event.target.checked)}
|
||||
/>
|
||||
{label}
|
||||
{help ? <small>{help}</small> : null}
|
||||
@@ -2323,7 +2336,7 @@ function FieldGrid({
|
||||
className="an-input"
|
||||
value={text(value, '')}
|
||||
disabled={field.disabled}
|
||||
onChange={(event) => onDraftChange(setNestedDraftField(draft, record, field.key, event.target.value))}
|
||||
onChange={(event) => commitFieldValue(event.target.value)}
|
||||
>
|
||||
{(field.options || []).map((option) => (
|
||||
<option key={option.value} value={option.value}>
|
||||
@@ -2346,9 +2359,9 @@ function FieldGrid({
|
||||
onChange={(event) => {
|
||||
const nextValue = event.target.value
|
||||
try {
|
||||
onDraftChange(setNestedDraftField(draft, record, field.key, JSON.parse(nextValue)))
|
||||
commitFieldValue(JSON.parse(nextValue))
|
||||
} catch {
|
||||
onDraftChange(setNestedDraftField(draft, record, field.key, nextValue))
|
||||
commitFieldValue(nextValue)
|
||||
}
|
||||
}}
|
||||
spellCheck={false}
|
||||
@@ -2401,6 +2414,22 @@ function FieldGrid({
|
||||
</label>
|
||||
)
|
||||
}
|
||||
if (field.renderInput) {
|
||||
return (
|
||||
<div key={field.key} className={className} data-admin-search-target={searchTarget} data-admin-search-field={field.key} data-admin-search-text={searchText}>
|
||||
<span>{label}</span>
|
||||
{field.renderInput({
|
||||
disabled: field.disabled,
|
||||
displayValue,
|
||||
fieldKey: field.key,
|
||||
onChange: commitFieldValue,
|
||||
placeholder,
|
||||
value,
|
||||
})}
|
||||
{help ? <small>{help}</small> : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const inputAction = field.inputAction
|
||||
? {
|
||||
...field.inputAction,
|
||||
@@ -2421,12 +2450,7 @@ function FieldGrid({
|
||||
value={text(displayValue, '')}
|
||||
placeholder={placeholder}
|
||||
disabled={field.disabled}
|
||||
onChange={(event) => onDraftChange(setNestedDraftField(
|
||||
draft,
|
||||
record,
|
||||
field.key,
|
||||
field.type === 'number' ? Number(event.target.value) : event.target.value,
|
||||
))}
|
||||
onChange={(event) => commitFieldValue(field.type === 'number' ? Number(event.target.value) : event.target.value)}
|
||||
/>
|
||||
</ConnectionTestInput>
|
||||
) : (
|
||||
@@ -2436,12 +2460,7 @@ function FieldGrid({
|
||||
value={text(displayValue, '')}
|
||||
placeholder={placeholder}
|
||||
disabled={field.disabled}
|
||||
onChange={(event) => onDraftChange(setNestedDraftField(
|
||||
draft,
|
||||
record,
|
||||
field.key,
|
||||
field.type === 'number' ? Number(event.target.value) : event.target.value,
|
||||
))}
|
||||
onChange={(event) => commitFieldValue(field.type === 'number' ? Number(event.target.value) : event.target.value)}
|
||||
/>
|
||||
)}
|
||||
{help ? <small>{help}</small> : null}
|
||||
@@ -2545,6 +2564,25 @@ function GroupList({
|
||||
const PLAYGROUND_SESSION_KEY = 'default'
|
||||
const BRAND_ASSET_ACCEPT = '.png,.jpg,.jpeg,.webp,.svg'
|
||||
const BRAND_ASSET_SUFFIXES = ['png', 'jpg', 'jpeg', 'webp', 'svg']
|
||||
const BRAND_ASSET_TARGET_META: Record<BrandAssetTargetKey, {
|
||||
copyLabel: string
|
||||
dropLabel: string
|
||||
uploadLabel: string
|
||||
uploadTitle: string
|
||||
}> = {
|
||||
logo_src: {
|
||||
copyLabel: '复制为 Logo',
|
||||
dropLabel: '将图片拖到这里',
|
||||
uploadLabel: '上传',
|
||||
uploadTitle: '上传 Logo',
|
||||
},
|
||||
title_src: {
|
||||
copyLabel: '复制为标题图',
|
||||
dropLabel: '将图片拖到这里',
|
||||
uploadLabel: '上传',
|
||||
uploadTitle: '上传标题图片',
|
||||
},
|
||||
}
|
||||
const PLAYGROUND_PRESETS = [
|
||||
{
|
||||
key: 'bgp-brief',
|
||||
@@ -2572,6 +2610,121 @@ const PLAYGROUND_PRESETS = [
|
||||
},
|
||||
]
|
||||
|
||||
function isBrandAssetTargetKey(value: string): value is BrandAssetTargetKey {
|
||||
return value === 'logo_src' || value === 'title_src'
|
||||
}
|
||||
|
||||
function isFileDrag(event: ReactDragEvent<HTMLElement>) {
|
||||
return Array.from(event.dataTransfer.types).includes('Files')
|
||||
}
|
||||
|
||||
function BrandAssetInput({
|
||||
disabled,
|
||||
onChange,
|
||||
onFile,
|
||||
placeholder,
|
||||
target,
|
||||
uploading,
|
||||
value,
|
||||
}: {
|
||||
disabled?: boolean
|
||||
onChange: (value: string) => void
|
||||
onFile: (file: File) => void
|
||||
placeholder?: string
|
||||
target: BrandAssetTargetKey
|
||||
uploading: boolean
|
||||
value: string
|
||||
}) {
|
||||
const { locale } = useLocale()
|
||||
const [dragging, setDragging] = useState(false)
|
||||
const dragCounter = useRef(0)
|
||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||
const meta = BRAND_ASSET_TARGET_META[target]
|
||||
const suffixHelp = BRAND_ASSET_SUFFIXES.join(' / ')
|
||||
|
||||
const resetDrag = () => {
|
||||
dragCounter.current = 0
|
||||
setDragging(false)
|
||||
}
|
||||
|
||||
const handleDragEnter = (event: ReactDragEvent<HTMLDivElement>) => {
|
||||
if (!isFileDrag(event)) return
|
||||
event.preventDefault()
|
||||
dragCounter.current += 1
|
||||
setDragging(true)
|
||||
}
|
||||
|
||||
const handleDragOver = (event: ReactDragEvent<HTMLDivElement>) => {
|
||||
if (!isFileDrag(event)) return
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
const handleDragLeave = (event: ReactDragEvent<HTMLDivElement>) => {
|
||||
if (!isFileDrag(event)) return
|
||||
event.preventDefault()
|
||||
dragCounter.current = Math.max(0, dragCounter.current - 1)
|
||||
if (dragCounter.current === 0) setDragging(false)
|
||||
}
|
||||
|
||||
const handleDrop = (event: ReactDragEvent<HTMLDivElement>) => {
|
||||
event.preventDefault()
|
||||
resetDrag()
|
||||
const file = event.dataTransfer.files?.[0]
|
||||
if (file) onFile(file)
|
||||
}
|
||||
|
||||
const handleFileChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
const file = event.target.files?.[0]
|
||||
event.target.value = ''
|
||||
if (file) onFile(file)
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={dragging ? 'an-brand-asset-input is-dragging' : 'an-brand-asset-input'}
|
||||
onDragEnter={handleDragEnter}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
<input
|
||||
className="an-brand-asset-input__control"
|
||||
disabled={disabled || uploading}
|
||||
onChange={(event) => onChange(event.target.value)}
|
||||
placeholder={placeholder}
|
||||
type="text"
|
||||
value={value}
|
||||
/>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
accept={BRAND_ASSET_ACCEPT}
|
||||
className="an-brand-asset-input__file"
|
||||
disabled={disabled || uploading}
|
||||
onChange={handleFileChange}
|
||||
type="file"
|
||||
/>
|
||||
<Button
|
||||
className="an-brand-asset-input__upload"
|
||||
disabled={disabled || uploading}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
size="sm"
|
||||
tactile={{ height: 28, radius: 5, shadowSize: 0.55 }}
|
||||
title={`${localizeAdminText(meta.uploadTitle, locale)} · ${suffixHelp}`}
|
||||
type="button"
|
||||
variant="primary"
|
||||
>
|
||||
{uploading ? localizeAdminText('上传中', locale) : localizeAdminText(meta.uploadLabel, locale)}
|
||||
</Button>
|
||||
{dragging ? (
|
||||
<div className="an-brand-asset-input__drop-overlay" aria-hidden="true">
|
||||
<span>{localizeAdminText(meta.dropLabel, locale)}</span>
|
||||
<strong>{localizeAdminText(meta.copyLabel, locale)}</strong>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function PlaygroundLite() {
|
||||
const { toast } = useToast()
|
||||
const { locale } = useLocale()
|
||||
@@ -2848,7 +3001,7 @@ function ModuleConsole({ config }: { config: ModuleConfig }) {
|
||||
const [revealedSecrets, setRevealedSecrets] = useState<Record<string, AnyRecord>>({})
|
||||
const [visibleSecretFields, setVisibleSecretFields] = useState<Record<string, boolean>>({})
|
||||
const [smtpTestEmail, setSmtpTestEmail] = useState('')
|
||||
const [brandUploadFile, setBrandUploadFile] = useState<File | null>(null)
|
||||
const [brandAssetUploadingTarget, setBrandAssetUploadingTarget] = useState<BrandAssetTargetKey | null>(null)
|
||||
const [newsImportFile, setNewsImportFile] = useState<File | null>(null)
|
||||
const newsImportInputRef = useRef<HTMLInputElement>(null)
|
||||
const [resolveTarget, setResolveTarget] = useState<TableRecord | null>(null)
|
||||
@@ -4002,51 +4155,46 @@ function ModuleConsole({ config }: { config: ModuleConfig }) {
|
||||
setResolveTarget(null)
|
||||
}
|
||||
|
||||
const uploadBrandAsset = async () => {
|
||||
if (!brandUploadFile) {
|
||||
toast({ title: '请选择上传文件', tone: 'error' })
|
||||
return
|
||||
}
|
||||
const suffix = brandUploadFile.name.split('.').pop()?.toLowerCase() || ''
|
||||
if (!BRAND_ASSET_SUFFIXES.includes(suffix)) {
|
||||
toast({ title: '文件类型不支持', description: `仅支持 ${BRAND_ASSET_SUFFIXES.join(', ')}。`, tone: 'error' })
|
||||
return
|
||||
}
|
||||
const formData = new FormData()
|
||||
formData.append('file', brandUploadFile)
|
||||
setActionLoading(true)
|
||||
try {
|
||||
const response = await axios.post(apiPath('/earth/brand/assets'), formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
})
|
||||
replaceSelectedWithPayload('brand-upload', '品牌资产上传', [{
|
||||
...response.data,
|
||||
__title: '品牌资产上传结果',
|
||||
__module: '品牌资产',
|
||||
__status: '已上传',
|
||||
__metric: brandUploadFile.name,
|
||||
}])
|
||||
setBrandUploadFile(null)
|
||||
toast({ title: '品牌资产已上传', tone: 'success' })
|
||||
await load()
|
||||
} catch (error) {
|
||||
toast({ title: '品牌资产上传失败', description: error instanceof Error ? error.message : '接口请求失败', tone: 'error' })
|
||||
} finally {
|
||||
setActionLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const selectBrandUploadFile = (file: File | null | undefined) => {
|
||||
const uploadBrandAssetFile = async (file: File | null | undefined, target: BrandAssetTargetKey) => {
|
||||
if (!file) {
|
||||
setBrandUploadFile(null)
|
||||
return
|
||||
toast({ title: '请拖入图片文件', tone: 'error' })
|
||||
return null
|
||||
}
|
||||
const suffix = file.name.split('.').pop()?.toLowerCase() || ''
|
||||
if (!BRAND_ASSET_SUFFIXES.includes(suffix)) {
|
||||
toast({ title: '文件类型不支持', description: `仅支持 ${BRAND_ASSET_SUFFIXES.join(', ')}。`, tone: 'error' })
|
||||
return
|
||||
return null
|
||||
}
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
setActionLoading(true)
|
||||
setBrandAssetUploadingTarget(target)
|
||||
try {
|
||||
const response = await axios.post(apiPath('/earth/brand/assets'), formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
})
|
||||
const assetUrl = text(response.data?.url, '')
|
||||
if (!assetUrl) throw new Error('上传接口未返回资产 URL')
|
||||
replaceSelectedWithPayload('brand-upload', '品牌资产上传', [{
|
||||
...response.data,
|
||||
__title: '品牌资产上传结果',
|
||||
__module: target === 'logo_src' ? 'Logo' : '标题图片',
|
||||
__status: '已上传',
|
||||
__metric: file.name,
|
||||
}])
|
||||
toast({
|
||||
title: target === 'logo_src' ? 'Logo 图片已上传' : '标题图片已上传',
|
||||
description: assetUrl,
|
||||
tone: 'success',
|
||||
})
|
||||
return assetUrl
|
||||
} catch (error) {
|
||||
toast({ title: '品牌资产上传失败', description: actionErrorMessage(error), tone: 'error' })
|
||||
return null
|
||||
} finally {
|
||||
setActionLoading(false)
|
||||
setBrandAssetUploadingTarget(null)
|
||||
}
|
||||
setBrandUploadFile(file)
|
||||
}
|
||||
|
||||
const createManualNewsGroup = async () => {
|
||||
@@ -5413,6 +5561,32 @@ function ModuleConsole({ config }: { config: ModuleConfig }) {
|
||||
{ key: 'location_label', label: '位置标签' },
|
||||
]
|
||||
const fields = newsSourceFields.length ? newsSourceFields : newsItemFields.length ? newsItemFields : [...scalarFields, ...objectFields]
|
||||
const uploadBrandAssetToDraft = async (file: File, target: BrandAssetTargetKey) => {
|
||||
if (!activeGroup) return
|
||||
const assetUrl = await uploadBrandAssetFile(file, target)
|
||||
if (!assetUrl) return
|
||||
setHierarchyDraft((current) => setNestedDraftField(current, activeGroup.record, target, assetUrl))
|
||||
}
|
||||
const editableFields = config === configs.earthContent && activeSection.key === 'brand'
|
||||
? fields.map((field): FieldConfig => {
|
||||
if (!isBrandAssetTargetKey(field.key)) return field
|
||||
const target = field.key
|
||||
return {
|
||||
...field,
|
||||
renderInput: ({ disabled, displayValue, onChange, placeholder }) => (
|
||||
<BrandAssetInput
|
||||
disabled={disabled}
|
||||
onChange={(nextValue) => onChange(nextValue)}
|
||||
onFile={(file) => void uploadBrandAssetToDraft(file, target)}
|
||||
placeholder={placeholder}
|
||||
target={target}
|
||||
uploading={brandAssetUploadingTarget === target}
|
||||
value={text(displayValue, '')}
|
||||
/>
|
||||
),
|
||||
}
|
||||
})
|
||||
: fields
|
||||
const renderNewsFeedEditor = () => {
|
||||
if (!activeGroup) return null
|
||||
const currentSource = draftRecord(hierarchyDraft, activeGroup.record)
|
||||
@@ -5951,20 +6125,6 @@ function ModuleConsole({ config }: { config: ModuleConfig }) {
|
||||
<div className="an-toolbar">
|
||||
{config === configs.earthContent && activeSection.key === 'brand' ? (
|
||||
<>
|
||||
<label
|
||||
className="an-file-action an-file-action--drop"
|
||||
onDragOver={(event) => event.preventDefault()}
|
||||
onDrop={(event) => {
|
||||
event.preventDefault()
|
||||
selectBrandUploadFile(event.dataTransfer.files?.[0])
|
||||
}}
|
||||
title={`支持 ${BRAND_ASSET_SUFFIXES.join(', ')}`}
|
||||
>
|
||||
<input type="file" accept={BRAND_ASSET_ACCEPT} onChange={(event) => selectBrandUploadFile(event.target.files?.[0])} />
|
||||
<span><ImageUp size={15} />{brandUploadFile ? brandUploadFile.name : '选择/拖入资产'}</span>
|
||||
<small>{BRAND_ASSET_SUFFIXES.join(' / ')}</small>
|
||||
</label>
|
||||
<Button variant="primary" onClick={() => void uploadBrandAsset()} loading={actionLoading} disabled={!brandUploadFile}><ImageUp size={15} />上传</Button>
|
||||
<Button size="icon" variant="subtle" title="重置品牌配置" aria-label="重置品牌配置" onClick={() => setConfirmAction({
|
||||
title: '重置品牌配置',
|
||||
description: '确认恢复默认智能星球品牌配置?当前自定义配置会被清空。',
|
||||
@@ -6309,7 +6469,7 @@ function ModuleConsole({ config }: { config: ModuleConfig }) {
|
||||
</section>
|
||||
</>
|
||||
) : (
|
||||
<FieldGrid record={activeGroup.record} draft={hierarchyDraft} onDraftChange={setHierarchyDraft} fields={fields} searchGroupKey={activeGroup.key} />
|
||||
<FieldGrid record={activeGroup.record} draft={hierarchyDraft} onDraftChange={setHierarchyDraft} fields={editableFields} searchGroupKey={activeGroup.key} />
|
||||
)}
|
||||
{config === configs.collection && activeSection.key === 'collection_history' ? null : (
|
||||
<details className="an-advanced-editor">
|
||||
@@ -6463,11 +6623,6 @@ function ModuleConsole({ config }: { config: ModuleConfig }) {
|
||||
|
||||
if (config === configs.earthContent && endpointKey === 'brand') {
|
||||
actions.push(
|
||||
<label key="brand-upload" className="an-file-action">
|
||||
<input type="file" onChange={(event) => setBrandUploadFile(event.target.files?.[0] ?? null)} />
|
||||
<span><ImageUp size={15} />{brandUploadFile ? brandUploadFile.name : '选择资产'}</span>
|
||||
</label>,
|
||||
<Button key="brand-upload-run" variant="primary" onClick={() => void uploadBrandAsset()} loading={actionLoading} disabled={!brandUploadFile}><ImageUp size={15} />上传</Button>,
|
||||
<Button key="delete-brand" variant="danger" onClick={() => setConfirmAction({
|
||||
title: '删除品牌配置',
|
||||
description: '确认删除智能星球品牌配置?',
|
||||
|
||||
@@ -1697,6 +1697,111 @@ body:has(.admin-theme-root[data-theme='dark']) .an-toast {
|
||||
border-style: dashed;
|
||||
}
|
||||
|
||||
.an-brand-asset-input {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
height: 34px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--an-border);
|
||||
border-radius: 6px;
|
||||
background: var(--an-surface);
|
||||
color: var(--an-text);
|
||||
transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
|
||||
}
|
||||
|
||||
.an-brand-asset-input:focus-within {
|
||||
border-color: color-mix(in srgb, var(--an-accent) 24%, var(--an-border-strong));
|
||||
}
|
||||
|
||||
.an-brand-asset-input.is-dragging {
|
||||
border-color: var(--an-border-strong);
|
||||
background: color-mix(in srgb, var(--an-soft) 46%, var(--an-surface));
|
||||
box-shadow: 0 2px 5px rgba(15, 23, 42, 0.1), 0 8px 18px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
.an-brand-asset-input__control {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
padding: 0 10px;
|
||||
font: inherit;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.an-brand-asset-input__control:disabled {
|
||||
color: var(--an-muted);
|
||||
}
|
||||
|
||||
.an-brand-asset-input__file {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.an-brand-asset-input__upload {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
min-width: 72px;
|
||||
height: var(--tui-control-height, 28px);
|
||||
margin-right: 3px;
|
||||
padding-inline: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.an-brand-asset-input__drop-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 0 12px;
|
||||
border: 1px dashed var(--an-border-strong);
|
||||
border-radius: 5px;
|
||||
background: color-mix(in srgb, var(--an-soft) 82%, var(--an-surface));
|
||||
color: var(--an-text);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.an-brand-asset-input__drop-overlay > span {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.an-brand-asset-input__drop-overlay > strong {
|
||||
min-width: max-content;
|
||||
height: 28px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid var(--an-border);
|
||||
border-radius: 6px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--an-surface);
|
||||
color: var(--an-text);
|
||||
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.admin-theme-root[data-theme='dark'] .an-brand-asset-input__drop-overlay > strong {
|
||||
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
|
||||
}
|
||||
|
||||
.an-mapping-form {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
|
||||
@@ -556,6 +556,15 @@ export const legacyUiTextEnUS: Record<string, string> = {
|
||||
'描述': 'Description',
|
||||
'每日摘要': 'Daily digest',
|
||||
'Logo 地址': 'Logo URL',
|
||||
'上传 Logo': 'Upload logo',
|
||||
'上传标题图片': 'Upload title image',
|
||||
'上传中': 'Uploading',
|
||||
'将图片拖到这里': 'Drop file here',
|
||||
'复制为 Logo': 'Copy as logo',
|
||||
'复制为标题图': 'Copy as title image',
|
||||
'Logo 图片已上传': 'Logo image uploaded',
|
||||
'标题图片已上传': 'Title image uploaded',
|
||||
'请拖入图片文件': 'Drop an image file',
|
||||
'API 基础地址': 'API base URL',
|
||||
'Firecrawl 抓取路径': 'Firecrawl scrape path',
|
||||
'Firecrawl 搜索路径': 'Firecrawl search path',
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "planet"
|
||||
version = "0.74.0"
|
||||
version = "0.74.1"
|
||||
description = "智能星球计划 - 态势感知系统"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
|
||||
Reference in new issue
Block a user