feat: 1.统一右侧抽屉关闭按钮布局 2.统一 UI 组件为 Ant Design 移除 radix-ui、floating-ui 组件 3. 修复 ESLint 文件格式错误的问题
This commit is contained in:
@@ -102,7 +102,10 @@ const AgreementModal = ({ visible, type, onClose }) => {
|
||||
{/* 头部 */}
|
||||
<div className='relative flex items-center justify-between px-5 sm:px-6 h-14 border-b border-gray-200/80 dark:border-gray-800/80 flex-shrink-0 bg-white/95 dark:bg-gray-900/95 backdrop-blur-md'>
|
||||
{/* 头部环境光 */}
|
||||
<div className='pointer-events-none absolute inset-0 overflow-hidden' aria-hidden>
|
||||
<div
|
||||
className='pointer-events-none absolute inset-0 overflow-hidden'
|
||||
aria-hidden
|
||||
>
|
||||
<div className='absolute -top-12 left-8 w-48 h-24 bg-gradient-to-br from-brand-from/15 to-brand-to/10 dark:from-brand-from/15 dark:to-brand-to/10 blur-3xl rounded-full' />
|
||||
</div>
|
||||
|
||||
@@ -126,7 +129,10 @@ const AgreementModal = ({ visible, type, onClose }) => {
|
||||
className='group inline-flex items-center gap-1 px-2 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-brand-deep dark:hover:text-brand-from hover:bg-gray-100/80 dark:hover:bg-gray-800/80 rounded-md transition-colors'
|
||||
title={t('在新标签页打开')}
|
||||
>
|
||||
<ExternalLink size={12} className='transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5' />
|
||||
<ExternalLink
|
||||
size={12}
|
||||
className='transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5'
|
||||
/>
|
||||
<span className='hidden sm:inline'>{t('完整页面')}</span>
|
||||
</a>
|
||||
<button
|
||||
|
||||
@@ -17,39 +17,41 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import {
|
||||
OpenAI,
|
||||
Claude,
|
||||
Gemini,
|
||||
Moonshot,
|
||||
Zhipu,
|
||||
Qwen,
|
||||
DeepSeek,
|
||||
Minimax,
|
||||
Wenxin,
|
||||
Spark,
|
||||
Midjourney,
|
||||
Hunyuan,
|
||||
Cohere,
|
||||
Cloudflare,
|
||||
Ai360,
|
||||
Yi,
|
||||
Jina,
|
||||
Mistral,
|
||||
XAI,
|
||||
Ollama,
|
||||
Doubao,
|
||||
Suno,
|
||||
Xinference,
|
||||
OpenRouter,
|
||||
Dify,
|
||||
Coze,
|
||||
SiliconCloud,
|
||||
Kling,
|
||||
Perplexity,
|
||||
Replicate,
|
||||
} from '@/assets/brand-icons/lobehub';
|
||||
import React from 'react';
|
||||
import { Avatar } from '@/components/ui';
|
||||
import { Bot as FastGPT, Image as Jimeng } from 'lucide-react';
|
||||
import OpenAI from '@lobehub/icons/es/OpenAI';
|
||||
import Claude from '@lobehub/icons/es/Claude';
|
||||
import Gemini from '@lobehub/icons/es/Gemini';
|
||||
import Moonshot from '@lobehub/icons/es/Moonshot';
|
||||
import Zhipu from '@lobehub/icons/es/Zhipu';
|
||||
import Qwen from '@lobehub/icons/es/Qwen';
|
||||
import DeepSeek from '@lobehub/icons/es/DeepSeek';
|
||||
import Minimax from '@lobehub/icons/es/Minimax';
|
||||
import Wenxin from '@lobehub/icons/es/Wenxin';
|
||||
import Spark from '@lobehub/icons/es/Spark';
|
||||
import Midjourney from '@lobehub/icons/es/Midjourney';
|
||||
import Hunyuan from '@lobehub/icons/es/Hunyuan';
|
||||
import Cohere from '@lobehub/icons/es/Cohere';
|
||||
import Cloudflare from '@lobehub/icons/es/Cloudflare';
|
||||
import Ai360 from '@lobehub/icons/es/Ai360';
|
||||
import Yi from '@lobehub/icons/es/Yi';
|
||||
import Jina from '@lobehub/icons/es/Jina';
|
||||
import Mistral from '@lobehub/icons/es/Mistral';
|
||||
import XAI from '@lobehub/icons/es/XAI';
|
||||
import Ollama from '@lobehub/icons/es/Ollama';
|
||||
import Doubao from '@lobehub/icons/es/Doubao';
|
||||
import Suno from '@lobehub/icons/es/Suno';
|
||||
import Xinference from '@lobehub/icons/es/Xinference';
|
||||
import OpenRouter from '@lobehub/icons/es/OpenRouter';
|
||||
import Dify from '@lobehub/icons/es/Dify';
|
||||
import Coze from '@lobehub/icons/es/Coze';
|
||||
import SiliconCloud from '@lobehub/icons/es/SiliconCloud';
|
||||
import Kling from '@lobehub/icons/es/Kling';
|
||||
import Perplexity from '@lobehub/icons/es/Perplexity';
|
||||
import Replicate from '@lobehub/icons/es/Replicate';
|
||||
|
||||
const LobeIconsMap = {
|
||||
OpenAI,
|
||||
|
||||
@@ -41,8 +41,8 @@ runInNewContext(code, {
|
||||
if (name === 'react') return React;
|
||||
if (name === '@/components/ui') return { Avatar: 'avatar' };
|
||||
if (name === 'lucide-react') return { Bot: Mono, Image: Mono };
|
||||
assert.ok(name.startsWith('@lobehub/icons/es/'), name);
|
||||
return Object.assign(Mono, { Color, Avatar });
|
||||
assert.equal(name, '@/assets/brand-icons/lobehub');
|
||||
return new Proxy({}, { get: () => Object.assign(Mono, { Color, Avatar }) });
|
||||
},
|
||||
});
|
||||
const render = module.exports.default;
|
||||
|
||||
@@ -18,14 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import {
|
||||
Select,
|
||||
Spin,
|
||||
Typography,
|
||||
Empty,
|
||||
Tag,
|
||||
Tooltip,
|
||||
} from '@/components/ui';
|
||||
import { Select, Spin, Typography, Empty, Tag, Tooltip } from '@/components/ui';
|
||||
import { Lock } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useModelSelector } from '../../hooks/models/useModelSelector';
|
||||
|
||||
@@ -50,7 +50,11 @@ import React, { useEffect, useRef } from 'react';
|
||||
const hexToRgb = (hex) => {
|
||||
if (!hex) return { r: 99, g: 102, b: 241 }; // brand-primary 兜底
|
||||
let h = hex.replace('#', '').trim();
|
||||
if (h.length === 3) h = h.split('').map((c) => c + c).join('');
|
||||
if (h.length === 3)
|
||||
h = h
|
||||
.split('')
|
||||
.map((c) => c + c)
|
||||
.join('');
|
||||
if (h.length === 8) h = h.slice(0, 6); // 忽略 alpha
|
||||
if (!/^[0-9a-fA-F]{6}$/.test(h)) return { r: 99, g: 102, b: 241 };
|
||||
const num = parseInt(h, 16);
|
||||
@@ -62,7 +66,12 @@ const easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
|
||||
// 三阶 Bezier 求 t 处坐标(给触手沿曲线放置吸盘用)
|
||||
const bezierPoint = (p0, p1, p2, p3, t) => {
|
||||
const mt = 1 - t;
|
||||
return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3;
|
||||
return (
|
||||
mt * mt * mt * p0 +
|
||||
3 * mt * mt * t * p1 +
|
||||
3 * mt * t * t * p2 +
|
||||
t * t * t * p3
|
||||
);
|
||||
};
|
||||
|
||||
// ─── 粒子类 ──────────────────────────────────────────────────
|
||||
@@ -74,7 +83,11 @@ class Plankton {
|
||||
}
|
||||
reset(randomY = false) {
|
||||
this.x = Math.random() * this.w;
|
||||
this.y = randomY ? Math.random() * this.h : Math.random() < 0.5 ? -10 : this.h + 10;
|
||||
this.y = randomY
|
||||
? Math.random() * this.h
|
||||
: Math.random() < 0.5
|
||||
? -10
|
||||
: this.h + 10;
|
||||
this.size = Math.random() * 1.5 + 0.5;
|
||||
this.vx = (Math.random() - 0.5) * 0.2;
|
||||
this.vy = (Math.random() - 0.5) * 0.15;
|
||||
@@ -85,7 +98,13 @@ class Plankton {
|
||||
this.x += this.vx;
|
||||
this.y += this.vy + Math.sin(this.phase) * 0.15;
|
||||
this.phase += 0.015;
|
||||
if (this.x < -20 || this.x > this.w + 20 || this.y < -20 || this.y > this.h + 20) this.reset();
|
||||
if (
|
||||
this.x < -20 ||
|
||||
this.x > this.w + 20 ||
|
||||
this.y < -20 ||
|
||||
this.y > this.h + 20
|
||||
)
|
||||
this.reset();
|
||||
}
|
||||
resize(w, h) {
|
||||
this.w = w;
|
||||
@@ -153,7 +172,13 @@ class Bubble {
|
||||
ctx.stroke();
|
||||
ctx.fillStyle = `rgba(255, 255, 255, ${this.alpha * 0.5})`;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x - this.size * 0.3, y - this.size * 0.3, this.size * 0.28, 0, Math.PI * 2);
|
||||
ctx.arc(
|
||||
x - this.size * 0.3,
|
||||
y - this.size * 0.3,
|
||||
this.size * 0.28,
|
||||
0,
|
||||
Math.PI * 2,
|
||||
);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
@@ -287,10 +312,19 @@ class LifePulse {
|
||||
// 从屏幕外随机一侧触发
|
||||
const side = Math.floor(Math.random() * 4);
|
||||
const m = 100;
|
||||
if (side === 0) { this.ox = Math.random() * this.w; this.oy = -m; }
|
||||
else if (side === 1) { this.ox = this.w + m; this.oy = Math.random() * this.h; }
|
||||
else if (side === 2) { this.ox = Math.random() * this.w; this.oy = this.h + m; }
|
||||
else { this.ox = -m; this.oy = Math.random() * this.h; }
|
||||
if (side === 0) {
|
||||
this.ox = Math.random() * this.w;
|
||||
this.oy = -m;
|
||||
} else if (side === 1) {
|
||||
this.ox = this.w + m;
|
||||
this.oy = Math.random() * this.h;
|
||||
} else if (side === 2) {
|
||||
this.ox = Math.random() * this.w;
|
||||
this.oy = this.h + m;
|
||||
} else {
|
||||
this.ox = -m;
|
||||
this.oy = Math.random() * this.h;
|
||||
}
|
||||
this.active = true;
|
||||
this.startT = now;
|
||||
this.maxR = Math.hypot(this.w, this.h) * 0.7;
|
||||
@@ -307,7 +341,14 @@ class LifePulse {
|
||||
const alpha = p < 0.5 ? p * 2 * 0.35 : (1 - p) * 2 * 0.35;
|
||||
const inner = Math.max(0, radius - 50);
|
||||
const outer = radius + 50;
|
||||
const grad = ctx.createRadialGradient(this.ox, this.oy, inner, this.ox, this.oy, outer);
|
||||
const grad = ctx.createRadialGradient(
|
||||
this.ox,
|
||||
this.oy,
|
||||
inner,
|
||||
this.ox,
|
||||
this.oy,
|
||||
outer,
|
||||
);
|
||||
grad.addColorStop(0, rgba(color, 0));
|
||||
grad.addColorStop(0.5, rgba(color, alpha));
|
||||
grad.addColorStop(1, rgba(color, 0));
|
||||
@@ -330,7 +371,8 @@ const readTheme = () => {
|
||||
};
|
||||
const detectDark = () => {
|
||||
if (document.documentElement.classList.contains('dark')) return true;
|
||||
if (document.body && document.body.getAttribute('theme-mode') === 'dark') return true;
|
||||
if (document.body && document.body.getAttribute('theme-mode') === 'dark')
|
||||
return true;
|
||||
// ThemeContext 在浅色模式会移除上面两个标记,此时必须先看用户显式选择,
|
||||
// 否则"强制浅色 + 系统深色"会被 prefers-color-scheme 兜底误判成暗色
|
||||
try {
|
||||
@@ -340,7 +382,10 @@ const detectDark = () => {
|
||||
} catch {
|
||||
// localStorage 不可用(隐私模式等)时继续走系统偏好
|
||||
}
|
||||
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
return (
|
||||
window.matchMedia &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
);
|
||||
};
|
||||
|
||||
// ─── 组件 ─────────────────────────────────────────────────
|
||||
@@ -359,9 +404,10 @@ const OceanBackground = () => {
|
||||
const dpr = Math.min(window.devicePixelRatio || 1, 1.5); // 上限避免移动端开销
|
||||
|
||||
// 设备 / 偏好检测
|
||||
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent,
|
||||
);
|
||||
const isMobile =
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent,
|
||||
);
|
||||
const reducedMotion =
|
||||
window.matchMedia &&
|
||||
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
@@ -393,9 +439,18 @@ const OceanBackground = () => {
|
||||
};
|
||||
|
||||
// 实例化
|
||||
const plankton = Array.from({ length: COUNT.plankton }, () => new Plankton(width, height));
|
||||
const sparkles = Array.from({ length: COUNT.sparkle }, () => new Sparkle(width, height));
|
||||
const bubbles = Array.from({ length: COUNT.bubble }, () => new Bubble(width, height));
|
||||
const plankton = Array.from(
|
||||
{ length: COUNT.plankton },
|
||||
() => new Plankton(width, height),
|
||||
);
|
||||
const sparkles = Array.from(
|
||||
{ length: COUNT.sparkle },
|
||||
() => new Sparkle(width, height),
|
||||
);
|
||||
const bubbles = Array.from(
|
||||
{ length: COUNT.bubble },
|
||||
() => new Bubble(width, height),
|
||||
);
|
||||
const pillars = Array.from(
|
||||
{ length: COUNT.pillar },
|
||||
(_, i) => new LightPillar(width, i, COUNT.pillar || 1),
|
||||
@@ -445,7 +500,10 @@ const OceanBackground = () => {
|
||||
const r1 = Math.max(width, height) * 0.75;
|
||||
const vig = ctx.createRadialGradient(cx, cy, r0, cx, cy, r1);
|
||||
vig.addColorStop(0, 'rgba(0, 0, 0, 0)');
|
||||
vig.addColorStop(1, isDark ? 'rgba(0, 0, 0, 0.55)' : 'rgba(0, 10, 25, 0.35)');
|
||||
vig.addColorStop(
|
||||
1,
|
||||
isDark ? 'rgba(0, 0, 0, 0.55)' : 'rgba(0, 10, 25, 0.35)',
|
||||
);
|
||||
ctx.fillStyle = vig;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
};
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
var(--ui-color-primary) 14%,
|
||||
transparent
|
||||
);
|
||||
--pg-tint-line: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 28%,
|
||||
transparent
|
||||
);
|
||||
--pg-tint-line: color-mix(in srgb, var(--ui-color-primary) 28%, transparent);
|
||||
--pg-ok: var(--ui-color-success);
|
||||
--pg-ok-tint: color-mix(in srgb, var(--ui-color-success) 14%, transparent);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { forwardRef } from 'react';
|
||||
import { Avatar, theme } from 'antd';
|
||||
|
||||
// Keep the upstream brand sizing contract; the container uses the app's Ant theme.
|
||||
export default forwardRef(function IconAvatar(
|
||||
{
|
||||
shape = 'circle',
|
||||
color,
|
||||
background,
|
||||
size,
|
||||
style,
|
||||
iconMultiple = 0.75,
|
||||
Icon,
|
||||
iconStyle,
|
||||
iconClassName,
|
||||
...props
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const { token } = theme.useToken();
|
||||
const scaled = size * iconMultiple;
|
||||
const iconSize = scaled % 2 === 0 ? scaled : scaled - 1;
|
||||
const foreground = color ?? token.colorWhite;
|
||||
return (
|
||||
<Avatar
|
||||
{...props}
|
||||
ref={ref}
|
||||
size={size}
|
||||
shape={shape}
|
||||
style={{
|
||||
flex: 'none',
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
background,
|
||||
color: foreground,
|
||||
border: 0,
|
||||
borderRadius: shape === 'circle' ? '50%' : Math.floor(size * 0.1),
|
||||
...style,
|
||||
}}
|
||||
icon={
|
||||
Icon && (
|
||||
<Icon
|
||||
className={iconClassName}
|
||||
color={foreground}
|
||||
size={iconSize}
|
||||
style={iconStyle}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { forwardRef } from 'react';
|
||||
|
||||
export default forwardRef(function IconCombine(
|
||||
{
|
||||
Icon,
|
||||
Text,
|
||||
color,
|
||||
size = 24,
|
||||
spaceMultiple = 1,
|
||||
textMultiple = 1,
|
||||
extra,
|
||||
extraStyle,
|
||||
showText = true,
|
||||
showLogo = true,
|
||||
extraClassName,
|
||||
iconProps,
|
||||
inverse,
|
||||
style,
|
||||
...props
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const logo = Icon && showLogo && (
|
||||
<Icon
|
||||
size={size}
|
||||
{...iconProps}
|
||||
style={{
|
||||
[inverse ? 'marginLeft' : 'marginRight']: size * spaceMultiple,
|
||||
...iconProps?.style,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
const text = showText && Text && <Text size={size * textMultiple} />;
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
ref={ref}
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
flex: 'none',
|
||||
color,
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
{inverse ? (
|
||||
<>
|
||||
{text}
|
||||
{logo}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{logo}
|
||||
{text}
|
||||
</>
|
||||
)}
|
||||
{extra && (
|
||||
<span
|
||||
className={extraClassName}
|
||||
style={{
|
||||
fontSize: size * textMultiple * 0.95,
|
||||
lineHeight: 1,
|
||||
...extraStyle,
|
||||
}}
|
||||
>
|
||||
{extra}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
|
||||
// Dify and Moonshot variants read the existing app theme without a second provider.
|
||||
export function useThemeMode() {
|
||||
return { isDarkMode: useActualTheme() === 'dark' };
|
||||
}
|
||||
@@ -33,8 +33,14 @@ export const IllustrationNoResult = ({ style = {} }) => (
|
||||
<stop offset='100%' stopColor='var(--brand-gradient-via)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='noResultGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--brand-primary) 12%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-primary) 20%, #fff)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--brand-primary) 12%, #fff)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--brand-primary) 20%, #fff)'
|
||||
/>
|
||||
</linearGradient>
|
||||
<filter id='noResultShadow' x='-20%' y='-20%' width='140%' height='140%'>
|
||||
<feDropShadow
|
||||
@@ -99,7 +105,13 @@ export const IllustrationNoResult = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='160' cy='50' r='3' fill='var(--brand-gradient-via)' opacity='0.5'>
|
||||
<circle
|
||||
cx='160'
|
||||
cy='50'
|
||||
r='3'
|
||||
fill='var(--brand-gradient-via)'
|
||||
opacity='0.5'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.5;1;0.5'
|
||||
@@ -107,7 +119,13 @@ export const IllustrationNoResult = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='155' cy='140' r='5' fill='var(--brand-gradient-to)' opacity='0.3'>
|
||||
<circle
|
||||
cx='155'
|
||||
cy='140'
|
||||
r='5'
|
||||
fill='var(--brand-gradient-to)'
|
||||
opacity='0.3'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.3;0.7;0.3'
|
||||
@@ -143,8 +161,14 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--brand-primary) 25%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--brand-primary) 25%, #000)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
@@ -200,7 +224,13 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
|
||||
strokeLinecap='round'
|
||||
/>
|
||||
</g>
|
||||
<circle cx='45' cy='60' r='4' fill='var(--brand-gradient-from)' opacity='0.5'>
|
||||
<circle
|
||||
cx='45'
|
||||
cy='60'
|
||||
r='4'
|
||||
fill='var(--brand-gradient-from)'
|
||||
opacity='0.5'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.5;1;0.5'
|
||||
@@ -208,7 +238,13 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='160' cy='50' r='3' fill='var(--brand-gradient-to)' opacity='0.6'>
|
||||
<circle
|
||||
cx='160'
|
||||
cy='50'
|
||||
r='3'
|
||||
fill='var(--brand-gradient-to)'
|
||||
opacity='0.6'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.6;1;0.6'
|
||||
@@ -216,7 +252,13 @@ export const IllustrationNoResultDark = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='155' cy='140' r='5' fill='var(--brand-primary-hover)' opacity='0.4'>
|
||||
<circle
|
||||
cx='155'
|
||||
cy='140'
|
||||
r='5'
|
||||
fill='var(--brand-primary-hover)'
|
||||
opacity='0.4'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.4;0.8;0.4'
|
||||
@@ -241,8 +283,14 @@ export const IllustrationNotFound = ({ style = {} }) => (
|
||||
<stop offset='100%' stopColor='var(--ui-color-danger)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='notFoundGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-warning) 15%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--ui-color-danger) 25%, #fff)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-warning) 15%, #fff)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-danger) 25%, #fff)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
{/* 背景 */}
|
||||
@@ -330,8 +378,14 @@ export const IllustrationNotFoundDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-warning) 30%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-warning) 30%, #000)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
@@ -410,7 +464,10 @@ export const IllustrationNoAccess = ({ style = {} }) => (
|
||||
</linearGradient>
|
||||
<linearGradient id='noAccessGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='#fce7f3' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 10%, #fff)' />
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--brand-gradient-via) 10%, #fff)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
{/* 背景 */}
|
||||
@@ -444,7 +501,13 @@ export const IllustrationNoAccess = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='160' cy='130' r='5' fill='var(--brand-gradient-via)' opacity='0.4'>
|
||||
<circle
|
||||
cx='160'
|
||||
cy='130'
|
||||
r='5'
|
||||
fill='var(--brand-gradient-via)'
|
||||
opacity='0.4'
|
||||
>
|
||||
<animate
|
||||
attributeName='r'
|
||||
values='5;7;5'
|
||||
@@ -480,8 +543,14 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-danger) 30%, #000)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
@@ -499,8 +568,20 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
|
||||
rx='8'
|
||||
fill='url(#noAccessGradDark1)'
|
||||
/>
|
||||
<circle cx='100' cy='112' r='8' fill='color-mix(in srgb, var(--brand-primary) 15%, #000)' />
|
||||
<rect x='96' y='112' width='8' height='18' rx='2' fill='color-mix(in srgb, var(--brand-primary) 15%, #000)' />
|
||||
<circle
|
||||
cx='100'
|
||||
cy='112'
|
||||
r='8'
|
||||
fill='color-mix(in srgb, var(--brand-primary) 15%, #000)'
|
||||
/>
|
||||
<rect
|
||||
x='96'
|
||||
y='112'
|
||||
width='8'
|
||||
height='18'
|
||||
rx='2'
|
||||
fill='color-mix(in srgb, var(--brand-primary) 15%, #000)'
|
||||
/>
|
||||
<path
|
||||
d='M75 90 V70 C75 55 85 45 100 45 C115 45 125 55 125 70 V90'
|
||||
stroke='url(#noAccessGradDark1)'
|
||||
@@ -516,7 +597,13 @@ export const IllustrationNoAccessDark = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='160' cy='130' r='5' fill='var(--brand-gradient-to)' opacity='0.5'>
|
||||
<circle
|
||||
cx='160'
|
||||
cy='130'
|
||||
r='5'
|
||||
fill='var(--brand-gradient-to)'
|
||||
opacity='0.5'
|
||||
>
|
||||
<animate
|
||||
attributeName='r'
|
||||
values='5;7;5'
|
||||
@@ -541,8 +628,14 @@ export const IllustrationConstruction = ({ style = {} }) => (
|
||||
<stop offset='100%' stopColor='var(--accent-teal)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='constructGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-success) 15%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 15%, #fff)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-success) 15%, #fff)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--accent-teal) 15%, #fff)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
{/* 背景 */}
|
||||
@@ -670,8 +763,14 @@ export const IllustrationConstructionDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--ui-color-success) 25%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--accent-teal) 25%, #000)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--ui-color-success) 25%, #000)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--accent-teal) 25%, #000)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
@@ -783,8 +882,14 @@ export const IllustrationNoContent = ({ style = {} }) => (
|
||||
<stop offset='100%' stopColor='var(--brand-gradient-via)' />
|
||||
</linearGradient>
|
||||
<linearGradient id='noContentGrad2' x1='0%' y1='0%' x2='100%' y2='100%'>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--accent-blue) 12%, #fff)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 10%, #fff)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--accent-blue) 12%, #fff)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--brand-gradient-via) 10%, #fff)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
{/* 背景 */}
|
||||
@@ -846,7 +951,13 @@ export const IllustrationNoContent = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='40' cy='145' r='3' fill='var(--brand-gradient-via)' opacity='0.4'>
|
||||
<circle
|
||||
cx='40'
|
||||
cy='145'
|
||||
r='3'
|
||||
fill='var(--brand-gradient-via)'
|
||||
opacity='0.4'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.4;0.8;0.4'
|
||||
@@ -882,8 +993,14 @@ export const IllustrationNoContentDark = ({ style = {} }) => (
|
||||
x2='100%'
|
||||
y2='100%'
|
||||
>
|
||||
<stop offset='0%' stopColor='color-mix(in srgb, var(--accent-blue) 25%, #000)' />
|
||||
<stop offset='100%' stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)' />
|
||||
<stop
|
||||
offset='0%'
|
||||
stopColor='color-mix(in srgb, var(--accent-blue) 25%, #000)'
|
||||
/>
|
||||
<stop
|
||||
offset='100%'
|
||||
stopColor='color-mix(in srgb, var(--brand-gradient-via) 25%, #000)'
|
||||
/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
@@ -941,7 +1058,13 @@ export const IllustrationNoContentDark = ({ style = {} }) => (
|
||||
repeatCount='indefinite'
|
||||
/>
|
||||
</circle>
|
||||
<circle cx='40' cy='145' r='3' fill='var(--brand-gradient-to)' opacity='0.5'>
|
||||
<circle
|
||||
cx='40'
|
||||
cy='145'
|
||||
r='3'
|
||||
fill='var(--brand-gradient-to)'
|
||||
opacity='0.5'
|
||||
>
|
||||
<animate
|
||||
attributeName='opacity'
|
||||
values='0.5;0.9;0.5'
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import 'katex/dist/katex.min.css';
|
||||
import 'highlight.js/styles/github.css';
|
||||
@@ -26,13 +27,7 @@ import RemarkBreaks from 'remark-breaks';
|
||||
import RehypeKatex from 'rehype-katex';
|
||||
import RemarkGfm from 'remark-gfm';
|
||||
import RehypeHighlight from 'rehype-highlight';
|
||||
import {
|
||||
useRef,
|
||||
useState,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useId,
|
||||
} from 'react';
|
||||
import { useRef, useState, useEffect, useMemo, useId } from 'react';
|
||||
import React from 'react';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import clsx from 'clsx';
|
||||
@@ -199,7 +194,7 @@ export function PreCode(props) {
|
||||
}, 600);
|
||||
|
||||
// 处理代码块的换行
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
if (ref.current) {
|
||||
const codeElements = ref.current.querySelectorAll('code');
|
||||
const wrapLanguages = [
|
||||
@@ -221,7 +216,8 @@ export function PreCode(props) {
|
||||
});
|
||||
setTimeout(renderArtifacts, 1);
|
||||
}
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -509,9 +505,7 @@ function MarkdownContentImpl(props) {
|
||||
{...aProps}
|
||||
target={target}
|
||||
style={{
|
||||
color: isUserMessage
|
||||
? '#87CEEB'
|
||||
: 'var(--ui-color-primary)',
|
||||
color: isUserMessage ? '#87CEEB' : 'var(--ui-color-primary)',
|
||||
textDecoration: 'none',
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
|
||||
@@ -18,13 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import {
|
||||
Modal,
|
||||
RadioGroup,
|
||||
Radio,
|
||||
Button,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Modal, RadioGroup, Radio, Button, Typography } from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
|
||||
@@ -161,16 +161,18 @@ const JSONEditor = ({
|
||||
}
|
||||
|
||||
// 只在外部值真正改变时更新,避免循环更新
|
||||
const currentObj = keyValueArrayToObject(keyValuePairs);
|
||||
if (JSON.stringify(parsed) !== JSON.stringify(currentObj)) {
|
||||
setKeyValuePairs(objectToKeyValueArray(parsed, keyValuePairs));
|
||||
}
|
||||
setKeyValuePairs((previous) => {
|
||||
const currentObj = keyValueArrayToObject(previous);
|
||||
return JSON.stringify(parsed) === JSON.stringify(currentObj)
|
||||
? previous
|
||||
: objectToKeyValueArray(parsed, previous);
|
||||
});
|
||||
setJsonError('');
|
||||
} catch (error) {
|
||||
console.log('JSON解析失败:', error.message);
|
||||
setJsonError(error.message);
|
||||
}
|
||||
}, [value]);
|
||||
}, [value, keyValueArrayToObject, objectToKeyValueArray]);
|
||||
|
||||
// 外部 value 变化时,若不在手动模式,则同步手动文本
|
||||
useEffect(() => {
|
||||
|
||||
@@ -38,7 +38,10 @@ const readBrand = (key, windowKey) => {
|
||||
|
||||
// 加载文案根据浏览器语言决定,避免 i18n 还没初始化时硬编码中文。
|
||||
const getLoadingText = () => {
|
||||
const lang = ((typeof navigator !== 'undefined' && navigator.language) || 'zh').toLowerCase();
|
||||
const lang = (
|
||||
(typeof navigator !== 'undefined' && navigator.language) ||
|
||||
'zh'
|
||||
).toLowerCase();
|
||||
return lang.startsWith('zh') ? '加载中...' : 'Loading...';
|
||||
};
|
||||
|
||||
|
||||
@@ -47,6 +47,29 @@ import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
|
||||
* @param {boolean} withCheckbox 是否启用前缀 Checkbox 来控制激活状态
|
||||
* @param {boolean} loading 是否处于加载状态
|
||||
*/
|
||||
const ConditionalTooltipText = ({ text, containerWidth }) => {
|
||||
const textRef = useRef(null);
|
||||
const [isOverflowing, setIsOverflowing] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const el = textRef.current;
|
||||
if (!el) return;
|
||||
setIsOverflowing(el.scrollWidth > el.clientWidth);
|
||||
}, [text, containerWidth]);
|
||||
|
||||
const textElement = (
|
||||
<span ref={textRef} className='sbg-ellipsis'>
|
||||
{text}
|
||||
</span>
|
||||
);
|
||||
|
||||
return isOverflowing ? (
|
||||
<Tooltip content={text}>{textElement}</Tooltip>
|
||||
) : (
|
||||
textElement
|
||||
);
|
||||
};
|
||||
|
||||
const SelectableButtonGroup = ({
|
||||
title,
|
||||
items = [],
|
||||
@@ -63,29 +86,6 @@ const SelectableButtonGroup = ({
|
||||
const [skeletonCount] = useState(12);
|
||||
const [containerRef, containerWidth] = useContainerWidth();
|
||||
|
||||
const ConditionalTooltipText = ({ text }) => {
|
||||
const textRef = useRef(null);
|
||||
const [isOverflowing, setIsOverflowing] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const el = textRef.current;
|
||||
if (!el) return;
|
||||
setIsOverflowing(el.scrollWidth > el.clientWidth);
|
||||
}, [text, containerWidth]);
|
||||
|
||||
const textElement = (
|
||||
<span ref={textRef} className='sbg-ellipsis'>
|
||||
{text}
|
||||
</span>
|
||||
);
|
||||
|
||||
return isOverflowing ? (
|
||||
<Tooltip content={text}>{textElement}</Tooltip>
|
||||
) : (
|
||||
textElement
|
||||
);
|
||||
};
|
||||
|
||||
// 基于容器宽度计算响应式列数和标签显示策略
|
||||
const getResponsiveConfig = () => {
|
||||
if (containerWidth <= 280) return { columns: 1, showTags: true }; // 极窄:1列+标签
|
||||
@@ -207,7 +207,10 @@ const SelectableButtonGroup = ({
|
||||
>
|
||||
<div className='sbg-content'>
|
||||
{item.icon && <span className='sbg-icon'>{item.icon}</span>}
|
||||
<ConditionalTooltipText text={item.label} />
|
||||
<ConditionalTooltipText
|
||||
text={item.label}
|
||||
containerWidth={containerWidth}
|
||||
/>
|
||||
{item.tagCount !== undefined && shouldShowTags && (
|
||||
<Tag
|
||||
className='sbg-tag'
|
||||
@@ -236,7 +239,10 @@ const SelectableButtonGroup = ({
|
||||
>
|
||||
<div className='sbg-content'>
|
||||
{item.icon && <span className='sbg-icon'>{item.icon}</span>}
|
||||
<ConditionalTooltipText text={item.label} />
|
||||
<ConditionalTooltipText
|
||||
text={item.label}
|
||||
containerWidth={containerWidth}
|
||||
/>
|
||||
{item.tagCount !== undefined && shouldShowTags && (
|
||||
<Tag
|
||||
className='sbg-tag'
|
||||
|
||||
Reference in New Issue
Block a user