merge: 合入总仓库 weiyuan(bfdfb339) web/ 新功能,保留 ui-optimization 的 UI 重构
来源:luoguang/monkey-ai weiyuan@bfdfb339 的 web/(经 sync/main-weiyuan-web-bfdfb339 同步)
同步基准:总仓库 a2ca13cb = 本仓库初始导入 d8f3aee2
冲突处理原则:保留 ui-optimization 的 UI(样式/结构/组件),嫁接 weiyuan 的功能逻辑。
- i18n:按键三方合并;ours 的「令牌→密钥」改名键上移植 theirs 的术语修订
- task-logs / OrgLogs:ours 已手工移植同一功能(6ad95e2),保留 ours
- 删除:OrgCreate(theirs 下线 /org/create)、旧 image 组件与 VideoRegenerateModal(theirs 体验中心重写)、
OrgAvatarSection / PricingBentoPage / CommissionConsole(ours 重构中已移除)
- 测试:users-pagination 的 i18next mock 补 t();theirs 新增文件补 license header
This commit is contained in:
@@ -17,7 +17,20 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
export const CHANNEL_OPTIONS = [
|
||||
import i18next from 'i18next';
|
||||
|
||||
// label 以简体中文(或厂商英文名)为 i18n 键;读取 label 时按当前界面语言翻译,
|
||||
// 因此各渲染处直接使用 option.label 即可随语言切换。
|
||||
const withLocalizedLabels = (options) =>
|
||||
options.map((opt) => {
|
||||
const labelKey = opt.label;
|
||||
return Object.defineProperty({ ...opt }, 'label', {
|
||||
get: () => i18next.t(labelKey),
|
||||
enumerable: true,
|
||||
});
|
||||
});
|
||||
|
||||
export const CHANNEL_OPTIONS = withLocalizedLabels([
|
||||
{ value: 1, color: 'green', label: 'OpenAI' },
|
||||
{
|
||||
value: 2,
|
||||
@@ -224,6 +237,6 @@ export const CHANNEL_OPTIONS = [
|
||||
color: 'green',
|
||||
label: '百度 Seedance 视频',
|
||||
},
|
||||
];
|
||||
]);
|
||||
|
||||
export const MODEL_TABLE_PAGE_SIZE = 10;
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// 创作台静态灵感模板(方案 §4.4,B 阶段用静态 JSON,后台配置后置)。
|
||||
// title / group 为 i18n key;prompt 是直接提交给模型的内容,不翻译。
|
||||
// model(可选)为推荐模型名:可用时点击模板会切过去,否则保持当前模型(见 creationDock.templateModelFor)。
|
||||
// params 为推荐参数:只套用当前模型支持且合法的值(见 hooks/creation/creationDock.templateParamsFor),
|
||||
// 图像的 aspect_ratio 会映射到宽高比最接近的尺寸预设。
|
||||
|
||||
export const CREATION_TEMPLATES = [
|
||||
// ---------------- 图像 ----------------
|
||||
{
|
||||
id: 'img-portrait',
|
||||
kind: 'image',
|
||||
group: '人像',
|
||||
title: '电影感人像',
|
||||
prompt:
|
||||
'电影感人像特写,黄昏逆光,柔和的轮廓光勾勒发丝,浅景深背景虚化,35mm 胶片质感,细腻皮肤纹理,温暖色调',
|
||||
params: { aspect_ratio: '2:3' },
|
||||
},
|
||||
{
|
||||
id: 'img-product',
|
||||
kind: 'image',
|
||||
group: '商业设计',
|
||||
title: '产品主图',
|
||||
prompt:
|
||||
'高端护肤品瓶身置于大理石台面,柔和棚拍光,水珠点缀,干净浅色背景,商业产品摄影,高清细节,留白构图',
|
||||
params: { aspect_ratio: '1:1' },
|
||||
},
|
||||
{
|
||||
id: 'img-landscape',
|
||||
kind: 'image',
|
||||
group: '风景空间',
|
||||
title: '壮丽风光',
|
||||
prompt:
|
||||
'雪山日出,金色阳光洒在山峰上,山脚湖面倒影清晰,薄雾缭绕,超广角镜头,国家地理风格,细节丰富',
|
||||
params: { aspect_ratio: '16:9' },
|
||||
},
|
||||
{
|
||||
id: 'img-anime',
|
||||
kind: 'image',
|
||||
group: '风格化',
|
||||
title: '日系动漫',
|
||||
prompt:
|
||||
'日系动漫风格,少女站在开满樱花的校园小路上,微风吹起发梢,明亮通透的色彩,细腻线条,新海诚式天空',
|
||||
params: { aspect_ratio: '9:16' },
|
||||
},
|
||||
{
|
||||
id: 'img-poster',
|
||||
kind: 'image',
|
||||
group: '商业设计',
|
||||
title: '海报设计',
|
||||
prompt:
|
||||
'极简风格活动海报,大面积留白,几何色块构成视觉中心,现代无衬线排版区域,高级感配色,平面设计',
|
||||
params: { aspect_ratio: '3:4' },
|
||||
},
|
||||
{
|
||||
id: 'img-interior',
|
||||
kind: 'image',
|
||||
group: '风景空间',
|
||||
title: '室内设计',
|
||||
prompt:
|
||||
'北欧风格客厅,大落地窗引入自然光,原木家具与米白色布艺沙发,绿植点缀,温馨通透,建筑摄影视角',
|
||||
params: { aspect_ratio: '4:3' },
|
||||
},
|
||||
{
|
||||
id: 'img-food',
|
||||
kind: 'image',
|
||||
group: '商业设计',
|
||||
title: '美食摄影',
|
||||
prompt:
|
||||
'热气腾腾的拉面俯拍,溏心蛋与叉烧摆放精致,木质桌面,侧逆光突出蒸汽,美食杂志风格,色彩饱满',
|
||||
params: { aspect_ratio: '1:1' },
|
||||
},
|
||||
{
|
||||
id: 'img-3d',
|
||||
kind: 'image',
|
||||
group: '风格化',
|
||||
title: '3D 卡通角色',
|
||||
prompt:
|
||||
'可爱的 3D 卡通小狐狸角色,圆润造型,柔和材质,皮克斯动画风格,纯色背景,柔光渲染,细节精致',
|
||||
params: { aspect_ratio: '1:1' },
|
||||
},
|
||||
|
||||
// ---------------- 视频 ----------------
|
||||
{
|
||||
id: 'vid-city',
|
||||
kind: 'video',
|
||||
group: '风光',
|
||||
title: '城市延时',
|
||||
prompt:
|
||||
'城市夜景延时摄影,车流形成光轨,高楼灯光逐渐亮起,镜头缓慢向前推进,电影级画质',
|
||||
params: { aspect_ratio: '16:9', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-ocean',
|
||||
kind: 'video',
|
||||
group: '风光',
|
||||
title: '海浪航拍',
|
||||
prompt:
|
||||
'无人机航拍蔚蓝海面,海浪拍打礁石溅起白色浪花,镜头缓慢上升并向前平移,阳光在水面闪烁',
|
||||
params: { aspect_ratio: '16:9', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-product',
|
||||
kind: 'video',
|
||||
group: '商业广告',
|
||||
title: '产品旋转展示',
|
||||
prompt:
|
||||
'一款精致腕表在黑色背景中缓慢旋转 360 度,聚光灯打亮金属表壳,反光细腻流动,商业广告质感',
|
||||
params: { aspect_ratio: '1:1', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-portrait',
|
||||
kind: 'video',
|
||||
group: '人物与动物',
|
||||
title: '人物情绪特写',
|
||||
prompt:
|
||||
'女孩站在窗边,微风吹动窗帘与发丝,她缓缓转头看向镜头并露出微笑,柔和自然光,浅景深',
|
||||
params: { aspect_ratio: '9:16', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-nature',
|
||||
kind: 'video',
|
||||
group: '风光',
|
||||
title: '森林晨雾',
|
||||
prompt:
|
||||
'清晨的森林,阳光穿过树叶形成丁达尔光束,薄雾缓缓流动,镜头低角度缓慢推进,鸟儿飞过',
|
||||
params: { aspect_ratio: '16:9', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-food',
|
||||
kind: 'video',
|
||||
group: '商业广告',
|
||||
title: '美食慢动作',
|
||||
prompt:
|
||||
'慢动作镜头:巧克力酱浇在层层叠叠的松饼上缓缓流下,草莓落下溅起糖粉,暖色调特写',
|
||||
params: { aspect_ratio: '9:16', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-scifi',
|
||||
kind: 'video',
|
||||
group: '创意',
|
||||
title: '科幻场景',
|
||||
prompt:
|
||||
'赛博朋克风格的未来都市,霓虹灯招牌闪烁,飞行汽车穿梭于高楼之间,雨夜反光路面,镜头穿越街道',
|
||||
params: { aspect_ratio: '16:9', duration: 5 },
|
||||
},
|
||||
{
|
||||
id: 'vid-animal',
|
||||
kind: 'video',
|
||||
group: '人物与动物',
|
||||
title: '萌宠瞬间',
|
||||
prompt:
|
||||
'一只橘猫在阳光洒落的木地板上伸懒腰,然后好奇地拍打飘落的羽毛,温馨自然的家庭氛围',
|
||||
params: { aspect_ratio: '9:16', duration: 5 },
|
||||
},
|
||||
];
|
||||
|
||||
/** 某 kind 的模板列表。 */
|
||||
export const templatesOf = (kind) =>
|
||||
CREATION_TEMPLATES.filter((tpl) => tpl.kind === kind);
|
||||
|
||||
/** 某 kind 的模板按 group 分组(保持出现顺序):[{ group, items }]。模板墙使用。 */
|
||||
export const templateGroupsOf = (kind) => {
|
||||
const groups = [];
|
||||
templatesOf(kind).forEach((tpl) => {
|
||||
const name = tpl.group || '';
|
||||
let entry = groups.find((g) => g.group === name);
|
||||
if (!entry) {
|
||||
entry = { group: name, items: [] };
|
||||
groups.push(entry);
|
||||
}
|
||||
entry.items.push(tpl);
|
||||
});
|
||||
return groups;
|
||||
};
|
||||
|
||||
export default CREATION_TEMPLATES;
|
||||
@@ -17,6 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import i18next from 'i18next';
|
||||
|
||||
// 图像生成模型族能力注册表
|
||||
// 新增模型族(如阿里云万相)只需在 FAMILIES 中追加一条
|
||||
// 表单和 hook 都从这里读,确保单一事实源
|
||||
@@ -91,7 +93,10 @@ const FAMILIES = [
|
||||
},
|
||||
{
|
||||
key: 'wanx',
|
||||
label: '阿里云万相',
|
||||
// 展示名随界面语言翻译(读取时求值)
|
||||
get label() {
|
||||
return i18next.t('阿里云万相');
|
||||
},
|
||||
// wanx-* / qwen-image / qwen-image-*
|
||||
match: (m) => /^(wanx|qwen-image)/i.test(m),
|
||||
sizes: [
|
||||
|
||||
@@ -17,6 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import i18next from 'i18next';
|
||||
|
||||
/**
|
||||
* 模型分类常量
|
||||
* 用于在体验中心按照用途对模型进行分类
|
||||
@@ -59,8 +61,22 @@ export const MODEL_CATEGORY = {
|
||||
OTHER: 'other',
|
||||
};
|
||||
|
||||
// 模型分类显示名称(多语言支持)
|
||||
export const MODEL_CATEGORY_NAMES = {
|
||||
// 模型分类显示名称(多语言支持):值以简体中文为 i18n 键,读取时按当前界面语言翻译,
|
||||
// 因此 MODEL_CATEGORY_NAMES[key] / Object.entries() 拿到的都是当前语言的展示名。
|
||||
const withLocalizedValues = (map) =>
|
||||
Object.defineProperties(
|
||||
{},
|
||||
Object.fromEntries(
|
||||
Object.entries(map).map(([key, zhName]) => [
|
||||
key,
|
||||
{ get: () => i18next.t(zhName), enumerable: true },
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
||||
// 简体中文原文(即 i18n 键)。需要拷贝/合并映射时用这份,展开 MODEL_CATEGORY_NAMES
|
||||
// 会把 getter 求值成当时语言的译文,切换语言后不再刷新。
|
||||
export const MODEL_CATEGORY_NAME_KEYS = {
|
||||
[MODEL_CATEGORY.TEXT_GENERATION]: '文本生成',
|
||||
[MODEL_CATEGORY.IMAGE_GENERATION]: '图像生成',
|
||||
[MODEL_CATEGORY.TEXT_TO_IMAGE]: '文生图',
|
||||
@@ -77,6 +93,10 @@ export const MODEL_CATEGORY_NAMES = {
|
||||
[MODEL_CATEGORY.OTHER]: '其他',
|
||||
};
|
||||
|
||||
export const MODEL_CATEGORY_NAMES = withLocalizedValues(
|
||||
MODEL_CATEGORY_NAME_KEYS,
|
||||
);
|
||||
|
||||
// 根据模型名称或端点类型推断模型分类
|
||||
export const inferModelCategory = (modelName = '', endpointType = '') => {
|
||||
const lowerModelName = modelName.toLowerCase();
|
||||
|
||||
@@ -24,6 +24,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
export const SETTING_TABS = [
|
||||
{ key: 'operation', labelKey: '运营设置' },
|
||||
// WeyAi 的所有配置项都放在这个页签下(M21,WeyAi 23 号文档第 3.3 节)
|
||||
{ key: 'weyai', labelKey: 'WeyAi' },
|
||||
{ key: 'data-security', labelKey: '数据安全' },
|
||||
{ key: 'content-guard', labelKey: '大模型内容防护' },
|
||||
{ key: 'dashboard', labelKey: '仪表盘设置' },
|
||||
|
||||
@@ -17,11 +17,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import i18next from 'i18next';
|
||||
|
||||
// 技能分类标签的展示名映射(技能超市 + 平台管理台共用)。
|
||||
//
|
||||
// 标签在数据层是版本 frontmatter 里的英文 slug(skill_versions.tags_json),
|
||||
// 是过滤与统计的稳定键,绝不能翻译后写回数据库——这里只做**展示层**映射:
|
||||
// 中文界面显示中文名,未收录的 slug(含本就是中文的标签)原样展示,
|
||||
// 展示名以中文为 i18n 键按界面语言翻译,未收录的 slug(含本就是中文的标签)原样展示,
|
||||
// 过滤请求仍然携带原始 slug。
|
||||
//
|
||||
// 新导入技能包引入新 slug 时在此补充即可;漏补不会出错,只是该分类
|
||||
@@ -127,12 +129,12 @@ const SKILL_CATEGORY_ZH = {
|
||||
'personal-development': '个人成长',
|
||||
};
|
||||
|
||||
// 返回标签在指定语言下的展示名。
|
||||
// language 取值 {zh, en}(与 NormalizeBrainLocale 同语义);en 界面直接
|
||||
// 展示原始 slug——slug 本身就是英文,强行再造一套英文标题反而增加维护面。
|
||||
export const skillTagLabel = (tag, language = 'zh') => {
|
||||
if (language !== 'zh') return tag;
|
||||
return SKILL_CATEGORY_ZH[tag] || tag;
|
||||
// 返回标签在当前界面语言下的展示名:已收录的 slug 以中文名为 i18n 键经
|
||||
// i18next.t() 翻译(随界面语言切换);未收录的 slug 原样展示。
|
||||
// 旧调用方传入的第二个 language 参数已不再参与判断,可忽略。
|
||||
export const skillTagLabel = (tag) => {
|
||||
const zhName = SKILL_CATEGORY_ZH[tag];
|
||||
return zhName ? i18next.t(zhName) : tag;
|
||||
};
|
||||
|
||||
export default SKILL_CATEGORY_ZH;
|
||||
|
||||
Reference in New Issue
Block a user