🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🌐 chore: translate non-English comments to English in model-runtime and comfyui (#11220)
LobeHub Bot85e6866e1e90
diff --git a/packages/context-engine/src/engine/messages/types.ts b/packages/context-engine/src/engine/messages/types.tsindex 07d5b675871..e34dd9c45d3 100644--- a/packages/context-engine/src/engine/messages/types.ts+++ b/packages/context-engine/src/engine/messages/types.ts@@ -90,7 +90,7 @@ export interface UserMemoryIdentityItem {description?: string | null;id?: string;role?: string | null;- /** Identity type: personal (角色), professional (职业), demographic (属性) */+ /** Identity type: personal (role), professional (occupation), demographic (attribute) */type?: 'demographic' | 'personal' | 'professional' | string | null;[key: string]: unknown;}diff --git a/packages/model-runtime/src/core/BaseAI.ts b/packages/model-runtime/src/core/BaseAI.tsindex 89375dd29d1..fc0a0cf318f 100644--- a/packages/model-runtime/src/core/BaseAI.ts+++ b/packages/model-runtime/src/core/BaseAI.ts@@ -36,7 +36,7 @@ export interface LobeRuntimeAI {options?: TextToSpeechOptions,) => Promise<ArrayBuffer>;- // 模型管理相关接口+ // Model management related interfacepullModel?(params: PullModelParams, options?: ModelRequestOptions): Promise<Response>;}/* eslint-enabled */diff --git a/packages/model-runtime/src/types/chat.ts b/packages/model-runtime/src/types/chat.tsindex 6173124ce2e..00af95d80f2 100644--- a/packages/model-runtime/src/types/chat.ts+++ b/packages/model-runtime/src/types/chat.ts@@ -62,15 +62,15 @@ export interface OpenAIChatMessage {export interface ChatStreamPayload {apiMode?: 'chatCompletion' | 'responses';/**- * 开启上下文缓存+ * Enable context caching*/enabledContextCaching?: boolean;/**- * 是否开启搜索+ * Whether to enable search*/enabledSearch?: boolean;/**- * @title 控制生成文本中的惩罚系数,用于减少重复性+ * @title Penalty coefficient for reducing repetitiveness in generated text* @default 0*/frequency_penalty?: number;@@ -83,23 +83,23 @@ export interface ChatStreamPayload {*/imageResolution?: '1K' | '2K' | '4K';/**- * @title 生成文本的最大长度+ * @title Maximum length of generated text*/max_tokens?: number;/**- * @title 聊天信息列表+ * @title List of chat messages*/messages: OpenAIChatMessage[];/**- * @title 模型名称+ * @title Model name*/model: string;/**- * @title 返回的文本数量+ * @title Number of text responses to return*/n?: number;/**- * @title 控制生成文本中的惩罚系数,用于减少主题的变化+ * @title Penalty coefficient for reducing topic variation in generated text* @default 0*/presence_penalty?: number;@@ -112,12 +112,12 @@ export interface ChatStreamPayload {responseMode?: 'stream' | 'json';response_format?: ChatResponseFormat;/**- * @title 是否开启流式请求+ * @title Whether to enable streaming requests* @default true*/stream?: boolean;/**- * @title 生成文本的随机度量,用于控制文本的创造性和多样性+ * @title Randomness measure for generated text, controls creativity and diversity* @default 1*/temperature?: number;@@ -139,13 +139,13 @@ export interface ChatStreamPayload {tool_choice?: string;tools?: ChatCompletionTool[];/**- * @title 控制生成文本中最高概率的单个令牌+ * @title Controls the highest probability single token in generated text* @default 1*/top_p?: number;truncation?: 'auto' | 'disabled';/**- * @title Gemini URL 上下文获取工具开关+ * @title Gemini URL context fetching tool toggle*/urlContext?: boolean;verbosity?: 'low' | 'medium' | 'high';diff --git a/packages/model-runtime/src/types/error.ts b/packages/model-runtime/src/types/error.tsindex 01996e2938b..ac5015d4161 100644--- a/packages/model-runtime/src/types/error.ts+++ b/packages/model-runtime/src/types/error.ts@@ -23,7 +23,7 @@ export const StandardErrorType = {export type ErrorType = (typeof StandardErrorType)[keyof typeof StandardErrorType];/**- * 聊天消息错误对象+ * Chat message error object*/export interface ChatMessageError {body?: any;diff --git a/packages/model-runtime/src/types/image.ts b/packages/model-runtime/src/types/image.tsindex 9e7a4cb7ef4..c2f332070ba 100644--- a/packages/model-runtime/src/types/image.ts+++ b/packages/model-runtime/src/types/image.ts@@ -34,7 +34,7 @@ export type CreateImageResponse = {modelUsage?: ModelUsage;};-// 新增:支持认证图片下载的运行时接口+// New: Runtime interface for authenticated image download supportexport interface AuthenticatedImageRuntime {/*** Get authentication headers for image downloaddiff --git a/src/server/services/comfyui/config/constants.ts b/src/server/services/comfyui/config/constants.tsindex 81477a5477a..e623cc54e97 100644--- a/src/server/services/comfyui/config/constants.ts+++ b/src/server/services/comfyui/config/constants.ts@@ -1,11 +1,11 @@/*** ComfyUI framework constants configuration- * Unified management of hardcoded values with environment variable overrides / 统一管理硬编码值,支持环境变量覆盖+ * Unified management of hardcoded values with environment variable overrides*//**- * Default configuration / 默认配置- * 注意:BASE_URL不再处理环境变量,由构造函数统一处理优先级+ * Default configuration+ * Note: BASE_URL no longer handles environment variables, priority is uniformly handled by constructor*/export const COMFYUI_DEFAULTS = {BASE_URL: 'http://localhost:8000',@@ -14,8 +14,8 @@ export const COMFYUI_DEFAULTS = {} as const;/**- * FLUX model configuration / FLUX 模型配置- * Removed over-engineered dynamic T5 selection, maintain simple fixed configuration / 移除过度工程化的动态T5选择,保持简单固定配置+ * FLUX model configuration+ * Removed over-engineered dynamic T5 selection, maintain simple fixed configuration*/export const FLUX_MODEL_CONFIG = {FILENAME_PREFIXES: {@@ -40,8 +40,8 @@ export const SD_MODEL_CONFIG = {} as const;/**- * Default workflow node parameters / 工作流节点默认参数- * Based on 2024 community best practices configuration / 基于 2024 年社区最佳实践配置+ * Default workflow node parameters+ * Based on 2024 community best practices configuration*//**diff --git a/src/server/services/comfyui/config/promptToolConst.ts b/src/server/services/comfyui/config/promptToolConst.tsindex eed19369626..3d4af6a2922 100644--- a/src/server/services/comfyui/config/promptToolConst.ts+++ b/src/server/services/comfyui/config/promptToolConst.ts@@ -1,16 +1,16 @@/*** Prompt Optimizer Configuration- * 提示词优化器配置 - 用于智能分割和优化提示词+ * Prompt optimizer configuration - for intelligent splitting and optimization of prompts*//*** Style keywords configuration - organized by category- * 风格关键词配置 - 按类别组织便于维护和扩展+ * Style keyword configuration - organized by category for easy maintenance and extension*//* eslint-disable sort-keys-fix/sort-keys-fix */export const STYLE_KEYWORDS = {- // Artists and platforms / 艺术家和平台+ // Artists and platformsARTISTS: ['by greg rutkowski','by artgerm',@@ -34,7 +34,7 @@ export const STYLE_KEYWORDS = {'digital painting',],- // Art styles / 艺术风格+ // Art stylesART_STYLES: ['photorealistic','photo realistic',@@ -90,7 +90,7 @@ export const STYLE_KEYWORDS = {'retrowave',],- // Lighting effects / 光照效果+ // Lighting effectsLIGHTING: ['dramatic lighting','soft lighting',@@ -131,7 +131,7 @@ export const STYLE_KEYWORDS = {'incandescent',],- // Photography terms / 摄影术语+ // Photography termsPHOTOGRAPHY: ['depth of field','shallow depth of field',@@ -184,7 +184,7 @@ export const STYLE_KEYWORDS = {'instant photo',],- // Quality descriptions / 质量描述+ // Quality descriptionsQUALITY: ['high quality','best quality',@@ -227,7 +227,7 @@ export const STYLE_KEYWORDS = {'exquisite',],- // Rendering and effects / 渲染和效果+ // Rendering and effectsRENDERING: ['octane render','octane',@@ -270,7 +270,7 @@ export const STYLE_KEYWORDS = {'high dynamic range',],- // Color and mood / 颜色和氛围+ // Color and moodCOLOR_MOOD: ['vibrant','vibrant colors',@@ -330,7 +330,7 @@ export const STYLE_KEYWORDS = {'gothic atmosphere',],- // Texture and materials / 纹理和材质+ // Texture and materialsTEXTURE_MATERIAL: ['glossy','matte',@@ -397,7 +397,7 @@ export const STYLE_KEYWORDS = {/*** Style synonyms mapping for better recognition- * 同义词映射,提高识别准确率+ * Synonym mapping to improve recognition accuracy*/export const STYLE_SYNONYMS: Record<string, string[]> = {// Photography variations@@ -443,7 +443,7 @@ export const STYLE_SYNONYMS: Record<string, string[]> = {/*** Compound styles that should be recognized as a whole- * 组合风格,应该作为整体识别+ * Compound styles that should be recognized as a complete unit*/export const COMPOUND_STYLES = [// Studio and brand styles@@ -536,37 +536,37 @@ export const COMPOUND_STYLES = [/*** Precise adjective patterns for style extraction- * 精确的形容词模式,用于风格提取+ * Precise adjective patterns for style extraction*/export const STYLE_ADJECTIVE_PATTERNS = {- // Visual quality related / 视觉质量相关+ // Visual quality relatedquality:/^(sharp|blur(ry)?|clear|crisp|clean|smooth|rough|grainy|noisy|pristine|flawless|perfect|polished)$/i,- // Artistic style related / 艺术风格相关+ // Artistic style relatedartistic:/^(abstract|surreal|minimal(ist)?|ornate|baroque|gothic|modern|contemporary|traditional|classical|vintage|retro|antique|futuristic|avant-garde)$/i,- // Color and lighting / 颜色和光照+ // Color and lightingvisual:/^(bright|dark|dim|vibrant|vivid|muted|saturated|desaturated|warm|cool|cold|hot|soft|hard|harsh|gentle|subtle|bold|pale|rich|deep)$/i,- // Mood and atmosphere / 情绪和氛围+ // Mood and atmospheremood: /^(dramatic|peaceful|chaotic|serene|calm|mysterious|mystical|magical|epic|legendary|heroic|romantic|melancholic|nostalgic|whimsical|playful|serious|solemn|cheerful|gloomy|ominous|eerie|creepy|scary|dreamy|ethereal|fantastical|moody|atmospheric)$/i,- // Texture and material / 纹理和材质+ // Texture and materialtexture:/^(metallic|wooden|glass(y)?|crystalline|fabric|leather|plastic|rubber|organic|synthetic|liquid|solid|transparent|translucent|opaque|reflective|matte|glossy|satin|rough|smooth|wet|dry|dusty|rusty|weathered|aged|new|fresh|worn)$/i,- // Size and scale / 尺寸和规模+ // Size and scalescale:/^(tiny|small|medium|large|huge|massive|gigantic|colossal|enormous|microscopic|miniature|oversized|epic-scale|human-scale|intimate|vast|infinite)$/i,- // Complexity and detail / 复杂度和细节+ // Complexity and detaildetail:/^(simple|complex|intricate|elaborate|detailed|minimal|advanced|sophisticated|primitive|refined|crude|delicate|robust)$/i,- // Professional quality / 专业质量+ // Professional qualityprofessional:/^(professional|amateur|masterful|skilled|expert|novice|polished|raw|finished|unfinished|complete|incomplete|refined|rough)$/i,} as const;@@ -575,7 +575,7 @@ export const STYLE_ADJECTIVE_PATTERNS = {/*** Get all style keywords as a flattened array- * 获取所有风格关键词的扁平数组+ * Get all style keywords as a flattened array*/export function getAllStyleKeywords(): readonly string[] {return Object.values(STYLE_KEYWORDS).flat();@@ -583,7 +583,7 @@ export function getAllStyleKeywords(): readonly string[] {/*** Get all compound styles- * 获取所有组合风格+ * Get all compound styles*/export function getCompoundStyles(): readonly string[] {return COMPOUND_STYLES;@@ -591,7 +591,7 @@ export function getCompoundStyles(): readonly string[] {/*** Normalize a style term using synonyms- * 使用同义词标准化风格术语+ * Normalize a style term using synonyms*/export function normalizeStyleTerm(term: string): string {const lowerTerm = term.toLowerCase();@@ -608,7 +608,7 @@ export function normalizeStyleTerm(term: string): string {/*** Check if a word matches any style adjective pattern- * 检查词语是否匹配任何风格形容词模式+ * Check if a word matches any style adjective pattern*/export function isStyleAdjective(word: string): boolean {const lowerWord = word.toLowerCase();@@ -617,7 +617,7 @@ export function isStyleAdjective(word: string): boolean {/*** Extract style adjectives from words based on precise patterns- * 基于精确模式从词语中提取风格形容词+ * Extract style adjectives from words based on precise patterns*/export function extractStyleAdjectives(words: string[]): string[] {return words.filter((word) => isStyleAdjective(word));diff --git a/src/server/services/comfyui/utils/promptSplitter.ts b/src/server/services/comfyui/utils/promptSplitter.tsindex 91419b2181b..c64b4e55538 100644--- a/src/server/services/comfyui/utils/promptSplitter.ts+++ b/src/server/services/comfyui/utils/promptSplitter.ts@@ -6,37 +6,37 @@ import {} from '@/server/services/comfyui/config/promptToolConst';/**- * FLUX 双CLIP提示词智能分割工具- * 将单一prompt分离为T5-XXL和CLIP-L的不同输入+ * FLUX dual-CLIP prompt intelligent splitter+ * Separates a single prompt into different inputs for T5-XXL and CLIP-L*/export function splitPromptForDualCLIP(prompt: string): {- // 风格关键词,给CLIP-L理解视觉概念+ // Style keywords for CLIP-L to understand visual conceptsclipLPrompt: string;- // 完整描述,给T5-XXL理解语义+ // Full description for T5-XXL to understand semanticst5xxlPrompt: string;} {if (!prompt) {return { clipLPrompt: '', t5xxlPrompt: '' };}- // 获取所有风格配置+ // Get all style configurationsconst styleKeywords = getAllStyleKeywords();const compoundStyles = getCompoundStyles();- // 分离风格关键词+ // Separate style keywordsconst lowerPrompt = prompt.toLowerCase();const words = prompt.split(/[\s,]+/);const lowerWords = lowerPrompt.split(/[\s,]+/);- const stylePhrases: string[] = []; // 改为存储完整短语+ const stylePhrases: string[] = []; // Changed to store complete phrasesconst contentWords: string[] = [];const processedIndices = new Set<number>();- // 1. 首先检查组合风格(优先级最高)+ // 1. First check compound styles (highest priority)for (const compound of compoundStyles) {const compoundLower = compound.toLowerCase();const index = lowerPrompt.indexOf(compoundLower);if (index !== -1) {- // 找到组合风格,提取对应的原始短语+ // Found compound style, extract corresponding original phraseconst beforeWords = prompt.slice(0, Math.max(0, index)).split(/[\s,]+/)@@ -56,23 +56,23 @@ export function splitPromptForDualCLIP(prompt: string): {}}- // 2. 检查单个风格关键词和同义词+ // 2. Check individual style keywords and synonymsfor (let i = 0; i < words.length; i++) {- if (processedIndices.has(i)) continue; // 跳过已处理的词+ if (processedIndices.has(i)) continue; // Skip already processed wordsconst word = words[i];const lowerWord = lowerWords[i];let isStyleWord = false;- // 2.1 先检查同义词并标准化+ // 2.1 First check synonyms and normalizeconst normalizedWord = normalizeStyleTerm(lowerWord);- // 2.2 检查是否是风格关键词+ // 2.2 Check if it's a style keywordfor (const keyword of styleKeywords) {const keywordWords = keyword.toLowerCase().split(/\s+/);if (keywordWords.length === 1) {- // 单词匹配(包括标准化后的词)+ // Single word matching (including normalized words)if (lowerWord === keywordWords[0] || normalizedWord === keywordWords[0]) {stylePhrases.push(word);processedIndices.add(i);@@ -80,7 +80,7 @@ export function splitPromptForDualCLIP(prompt: string): {break;}} else if (keywordWords.length > 1 && i + keywordWords.length <= words.length) {- // 多词短语匹配+ // Multi-word phrase matchingconst sequence = lowerWords.slice(i, i + keywordWords.length).join(' ');if (sequence === keyword.toLowerCase()) {const phraseWords: string[] = [];@@ -89,14 +89,14 @@ export function splitPromptForDualCLIP(prompt: string): {processedIndices.add(i + j);}stylePhrases.push(phraseWords.join(' '));- i += keywordWords.length - 1; // 跳过已匹配的词+ i += keywordWords.length - 1; // Skip matched wordsisStyleWord = true;break;}}}- // 2.3 如果不是关键词,检查是否是风格形容词+ // 2.3 If not a keyword, check if it's a style adjectiveif (!isStyleWord && !processedIndices.has(i)) {const adjectives = extractStyleAdjectives([word]);if (adjectives.length > 0) {@@ -106,25 +106,25 @@ export function splitPromptForDualCLIP(prompt: string): {}}- // 2.4 记录非风格词+ // 2.4 Record non-style wordsif (!isStyleWord && !processedIndices.has(i)) {contentWords.push(word);}}- // 构建结果+ // Build resultif (stylePhrases.length > 0) {- // 短语级别去重,保持多词短语的完整性+ // Phrase-level deduplication, maintaining integrity of multi-word phrasesconst uniquePhrases = [...new Set(stylePhrases)];return {- // CLIP-L专注风格和视觉概念+ // CLIP-L focuses on style and visual conceptsclipLPrompt: uniquePhrases.join(' '),- // T5-XXL接收完整context以理解语义关系+ // T5-XXL receives complete context to understand semantic relationshipst5xxlPrompt: prompt,};}- // 无风格词时的fallback:相同prompt(保证兼容性)+ // Fallback when no style words: same prompt (ensures compatibility)return {clipLPrompt: prompt,t5xxlPrompt: prompt,diff --git a/src/server/services/comfyui/utils/weightDType.ts b/src/server/services/comfyui/utils/weightDType.tsindex 6ae4865b62b..9f708843837 100644--- a/src/server/services/comfyui/utils/weightDType.ts+++ b/src/server/services/comfyui/utils/weightDType.ts@@ -1,13 +1,12 @@import { resolveModel } from './staticModelLookup';/**- * FLUX 模型权重类型选择工具 / FLUX Model Weight Dtype Selection Tool+ * FLUX Model Weight Dtype Selection Tool*- * @description 自动选择模型权重类型:优先使用ModelNameStandardizer推荐值,未知模型返回'default'- * Automatic weight type selection: prioritize ModelNameStandardizer recommendations, return 'default' for unknown models+ * @description Automatic weight type selection: prioritize ModelNameStandardizer recommendations, return 'default' for unknown models*- * @param {string} modelName - 模型文件名或路径 / Model filename or path- * @returns {string} 权重类型字符串 / Weight type string+ * @param {string} modelName - Model filename or path+ * @returns {string} Weight type string*/export function selectOptimalWeightDtype(modelName: string): string {const config = resolveModel(modelName);