diff --git a/src/buddy/types.ts b/src/buddy/types.ts index 8f17b96f9..0a59147af 100644 --- a/src/buddy/types.ts +++ b/src/buddy/types.ts @@ -149,3 +149,40 @@ export const RARITY_COLORS = { epic: 'autoAccept', legendary: 'warning', } as const satisfies Record + +export const RARITY_CN = { + common: '普通', + uncommon: '优秀', + rare: '稀有', + epic: '史诗', + legendary: '传说', +} as const satisfies Record + +export const SPECIES_CN: Record = { + duck: '鸭子', + goose: '鹅', + blob: '史莱姆', + cat: '猫咪', + dragon: '龙', + octopus: '章鱼', + owl: '猫头鹰', + penguin: '企鹅', + turtle: '乌龟', + snail: '蜗牛', + ghost: '幽灵', + axolotl: '美西螈', + capybara: '水豚', + cactus: '仙人掌', + robot: '机器人', + rabbit: '兔子', + mushroom: '蘑菇', + chonk: '胖墩', +} + +export const STAT_NAMES_CN: Record = { + DEBUGGING: '调试', + PATIENCE: '耐心', + CHAOS: '混沌', + WISDOM: '智慧', + SNARK: '毒舌', +} diff --git a/src/commands/buddy/buddy.tsx b/src/commands/buddy/buddy.tsx index 235ce6c8a..d4872cb56 100644 --- a/src/commands/buddy/buddy.tsx +++ b/src/commands/buddy/buddy.tsx @@ -12,6 +12,9 @@ import { RARITY_COLORS, RARITY_STARS, STAT_NAMES, + RARITY_CN, + SPECIES_CN, + STAT_NAMES_CN, type StoredCompanion, } from '../../buddy/types.js' import { saveGlobalConfig } from '../../utils/config.js' @@ -118,6 +121,8 @@ function CompanionCard({ } }, []) + const isCN = trimmed === 'info_cn' + // Render companion info if (!companion) { const { bones } = roll(companionUserId()) @@ -125,8 +130,8 @@ function CompanionCard({ const color = RARITY_COLORS[bones.rarity] return ( - You haven't hatched a companion yet! - Here's a preview of yours: + {isCN ? '你还没有孵化伙伴!' : "You haven't hatched a companion yet!"} + {isCN ? '这是你的预览:' : "Here's a preview of yours:"} {preview.map((line, i) => ( @@ -134,11 +139,13 @@ function CompanionCard({ ))} - A {bones.rarity} {bones.species} {RARITY_STARS[bones.rarity]} + {isCN + ? `${RARITY_CN[bones.rarity]} ${SPECIES_CN[bones.species]} ${RARITY_STARS[bones.rarity]}` + : `A ${bones.rarity} ${bones.species} ${RARITY_STARS[bones.rarity]}`} - Run /buddy hatch to bring them to life! - Or type q to dismiss. + {isCN ? '运行 ' : 'Run '}/buddy hatch{isCN ? ' 来孵化它!' : ' to bring them to life!'} + {isCN ? '或按 ' : 'Or type '}q{isCN ? ' 关闭。' : ' to dismiss.'} ) } @@ -161,21 +168,21 @@ function CompanionCard({ - Species:{' '} - {companion.species} + {isCN ? '物种:' : 'Species:'}{' '} + {isCN ? SPECIES_CN[companion.species] : companion.species} - Rarity:{' '} + {isCN ? '稀有度:' : 'Rarity:'}{' '} - {companion.rarity} {RARITY_STARS[companion.rarity]} + {isCN ? RARITY_CN[companion.rarity] : companion.rarity} {RARITY_STARS[companion.rarity]} - {companion.shiny && ✦ Shiny!} + {companion.shiny && ✦ {isCN ? '闪光!' : 'Shiny!'}} {'─'.repeat(20)} - Stats: + {isCN ? '属性:' : 'Stats:'} {STAT_NAMES.map(stat => ( - {stat}:{' '} + {isCN ? STAT_NAMES_CN[stat] : stat}:{' '} {companion.stats[stat]} ))} @@ -185,7 +192,7 @@ function CompanionCard({ /buddy pet · /buddy mute · /buddy unmute · /buddy release - Press q or Enter to dismiss + {isCN ? '按 q 或 Enter 关闭' : 'Press q or Enter to dismiss'} ) } diff --git a/src/commands/buddy/index.ts b/src/commands/buddy/index.ts index 0975fef6f..d30953145 100644 --- a/src/commands/buddy/index.ts +++ b/src/commands/buddy/index.ts @@ -4,7 +4,7 @@ const buddyCommand = { type: 'local-jsx', name: 'buddy', description: 'Meet your companion', - argumentHint: '[hatch|pet|mute|unmute|info]', + argumentHint: '[hatch|pet|mute|unmute|info|info_cn]', load: () => import('./buddy.js'), } satisfies Command diff --git a/src/server/services/providerService.ts b/src/server/services/providerService.ts index c06d58158..6aa569e2d 100644 --- a/src/server/services/providerService.ts +++ b/src/server/services/providerService.ts @@ -235,7 +235,9 @@ export class ProviderService { return { ANTHROPIC_BASE_URL: baseUrl, - ANTHROPIC_API_KEY: needsProxy ? 'proxy-managed' : provider.apiKey, + ...(needsProxy + ? { ANTHROPIC_AUTH_TOKEN: 'proxy-managed' } + : { ANTHROPIC_API_KEY: provider.apiKey }), ANTHROPIC_MODEL: provider.models.main, ANTHROPIC_DEFAULT_HAIKU_MODEL: provider.models.haiku, ANTHROPIC_DEFAULT_SONNET_MODEL: provider.models.sonnet,