汉化start new task及模型说明

This commit is contained in:
HybridTalentComputing committed 2025-12-23 22:36:25 +08:00
1 parent e33feb513f
commit bd4b9112b5
8 files changed
+128 -18

No files matched your search

@@ -3,6 +3,7 @@ import type { Mode } from "@shared/storage/types"
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
import type React from "react"
import { useCallback, useEffect, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
import { VirtuosoHandle } from "react-virtuoso"
import { ButtonActionType, getButtonConfig } from "../../shared/buttonConfig"
import type { ChatState, MessageHandlers } from "../../types/chatTypes"
@@ -32,6 +33,7 @@ export const ActionButtons: React.FC<ActionButtonsProps> = ({
messageHandlers,
scrollBehavior,
}) => {
const { t } = useTranslation()
const { inputValue, selectedImages, selectedFiles, setSendingDisabled } = chatState
const [isProcessing, setIsProcessing] = useState(false)
@@ -107,6 +109,30 @@ export const ActionButtons: React.FC<ActionButtonsProps> = ({
const isStreaming = task.partial === true
const canInteract = enableButtons && !isProcessing
// 翻译按钮文本
const translateButtonText = (text: string | undefined): string | undefined => {
if (!text) return undefined
const translationMap: Record<string, string> = {
"Start New Task": t("chat.newTask.startNewTask"),
"Start New Task with Context": t("chat.newTask.startNewTaskWithContext"),
"Resume Task": t("chatRow.resumeTask"),
Retry: t("chatRow.retry"),
"Proceed Anyways": t("chatRow.proceedAnyways"),
Approve: t("chatRow.approve"),
Reject: t("chatRow.reject"),
Save: t("chatRow.save"),
"Run Command": t("chatRow.runCommand"),
"Proceed While Running": t("chatRow.proceedWhileRunning"),
"Condense Conversation": t("chatRow.condense"),
"Report GitHub issue": t("chatRow.reportBug"),
Cancel: t("chatRow.cancel"),
}
return translationMap[text] || text
}
const translatedPrimaryText = translateButtonText(primaryText)
const translatedSecondaryText = translateButtonText(secondaryText)
// Early return for scroll button to avoid unnecessary computation
if (showScrollToBottom || !hasButtons) {
const handleScrollToBottom = () => {
@@ -161,22 +187,22 @@ export const ActionButtons: React.FC<ActionButtonsProps> = ({
return (
<div className="flex px-3.5" style={{ opacity }}>
{primaryText && primaryAction && (
{translatedPrimaryText && primaryAction && (
<VSCodeButton
appearance="primary"
className={secondaryText ? "flex-1 mr-[6px]" : "flex-2"}
className={translatedSecondaryText ? "flex-1 mr-[6px]" : "flex-2"}
disabled={!canInteract}
onClick={() => handleActionClick(primaryAction, inputValue, selectedImages, selectedFiles)}>
{primaryText}
{translatedPrimaryText}
</VSCodeButton>
)}
{secondaryText && secondaryAction && (
{translatedSecondaryText && secondaryAction && (
<VSCodeButton
appearance="secondary"
className={primaryText ? "flex-1" : "flex-2"}
className={translatedPrimaryText ? "flex-1" : "flex-2"}
disabled={!canInteract}
onClick={() => handleActionClick(secondaryAction, inputValue, selectedImages, selectedFiles)}>
{secondaryText}
{translatedSecondaryText}
</VSCodeButton>
)}
</div>
@@ -1,4 +1,5 @@
import { XIcon } from "lucide-react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { cn } from "@/lib/utils"
@@ -7,12 +8,13 @@ const NewTaskButton: React.FC<{
onClick: () => void
className?: string
}> = ({ className, onClick }) => {
const { t } = useTranslation()
return (
<Tooltip>
<TooltipContent side="left">Start a New Task</TooltipContent>
<TooltipContent side="left">{t("chat.newTask.startANewTask")}</TooltipContent>
<TooltipTrigger className={cn("flex items-center", className)}>
<Button
aria-label="New Task"
aria-label={t("chat.newTask.newTask")}
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
@@ -1,6 +1,7 @@
import { EmptyRequest, Int64Request } from "@shared/proto/index.cline"
import { Megaphone, XIcon } from "lucide-react"
import { useCallback } from "react"
import { useTranslation } from "react-i18next"
import { useMount } from "react-use"
import { Button } from "@/components/ui/button"
import { useClineAuth } from "@/context/ClineAuthContext"
@@ -12,6 +13,7 @@ import { useApiConfigurationHandlers } from "../settings/utils/useApiConfigurati
export const CURRENT_MODEL_BANNER_VERSION = 3
export const NewModelBanner: React.FC = () => {
const { t } = useTranslation()
const { clineUser } = useClineAuth()
const { openRouterModels, setShowChatModelSelector, refreshOpenRouterModels } = useExtensionState()
const user = clineUser || undefined
@@ -74,11 +76,13 @@ export const NewModelBanner: React.FC = () => {
}}>
<h4 className="m-0 flex items-center gap-2">
<Megaphone className="w-4 h-4" />
Claude Opus 4.5
{t("banner.newModelBanner.title")}
</h4>
<p className="m-0">
Anthropic's latest model with SOTA performance at 3x lower cost than Opus 4.1.{" "}
<span className="text-link cursor-pointer">{user ? "Try new model" : "Try with Cline account"} →</span>
{t("banner.newModelBanner.description")}{" "}
<span className="text-link cursor-pointer">
{user ? t("banner.newModelBanner.tryNewModel") : t("banner.newModelBanner.tryWithClineAccount")} →
</span>
</p>
{/* Close button */}
+1 -1
View File
@@ -23,7 +23,7 @@ export const Navbar = () => {
{
id: "chat",
name: "Chat",
tooltip: "New Task",
tooltip: t("chat.newTask.newTask"),
icon: PlusIcon,
navigate: () => {
// Close the current task, then navigate to the chat view
@@ -1,4 +1,5 @@
import { memo, useEffect, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useRemark } from "react-remark"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
@@ -10,6 +11,7 @@ interface ModelDescriptionMarkdownProps {
}
export const ModelDescriptionMarkdown = memo(({ markdown, key, isPopup }: ModelDescriptionMarkdownProps) => {
const { t } = useTranslation()
// Update the markdown content when the prop changes
const [reactContent, setMarkdown] = useRemark()
const contentRef = useRef<HTMLDivElement>(null)
@@ -51,7 +53,9 @@ export const ModelDescriptionMarkdown = memo(({ markdown, key, isPopup }: ModelD
})}
onClick={() => setIsExpanded(!isExpanded)}
variant="link">
{isExpanded ? "See less" : "See more"}
{isExpanded
? t("chatRow.seeLess", { defaultValue: "See less" })
: t("chatRow.seeMore", { defaultValue: "See more" })}
</Button>
</div>
)}
@@ -1,6 +1,7 @@
import { geminiModels, ModelInfo } from "@shared/api"
import { geminiModels, ModelInfo, openRouterDefaultModelId } from "@shared/api"
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
import { useState } from "react"
import { useTranslation } from "react-i18next"
import styled from "styled-components"
import { ModelDescriptionMarkdown } from "../ModelDescriptionMarkdown"
import { formatPrice, hasThinkingBudget, supportsBrowserUse, supportsImages, supportsPromptCache } from "../utils/pricingUtils"
@@ -186,6 +187,7 @@ export const ModelInfoView = ({
onProviderSortingChange,
showProviderRouting,
}: ModelInfoViewProps) => {
const { t } = useTranslation()
const [advancedExpanded, setAdvancedExpanded] = useState(false)
const isGemini = Object.keys(geminiModels).includes(selectedModelId)
@@ -200,11 +202,25 @@ export const ModelInfoView = ({
// Check if we have cache pricing to show in Advanced section
const hasCachePricing = modelInfo.supportsPromptCache && (modelInfo.cacheWritesPrice || modelInfo.cacheReadsPrice)
// 根据模型 ID 获取翻译后的描述
const getTranslatedDescription = (): string | undefined => {
if (!modelInfo.description) return undefined
// 如果是 Claude Sonnet 4.5,使用翻译
if (selectedModelId === openRouterDefaultModelId || selectedModelId === "anthropic/claude-sonnet-4.5") {
return t("models.claudeSonnet45.description", { defaultValue: modelInfo.description })
}
return modelInfo.description
}
const translatedDescription = getTranslatedDescription()
return (
<div style={{ marginTop: 4 }}>
{/* Description */}
{modelInfo.description && (
<ModelDescriptionMarkdown isPopup={isPopup} key="description" markdown={modelInfo.description} />
{translatedDescription && (
<ModelDescriptionMarkdown isPopup={isPopup} key="description" markdown={translatedDescription} />
)}
{/* Compact Info Row: Context, Input, Output */}
+30 -1
View File
@@ -23,6 +23,12 @@
"takeATour": "Take a Tour",
"infoTooltip": "I can develop software step-by-step by editing files, exploring projects, running commands, and using browsers. I can even extend my capabilities with MCP tools to assist beyond basic code completion.",
"inputHint": "Type @ for context, / for slash commands & workflows, hold shift to drag in files/images",
"newTask": {
"newTask": "New Task",
"startNewTask": "Start New Task",
"startNewTaskWithContext": "Start New Task with Context",
"startANewTask": "Start a New Task"
},
"errorImageSize": "Image dimensions exceed 7500px",
"errorUnsupportedFile": "Files other than images are currently disabled",
"addContext": "Add Context",
@@ -59,6 +65,8 @@
"condensing": "Cline is condensing the conversation:",
"collapseSummary": "Collapse summary",
"expandSummary": "Expand summary",
"seeMore": "See more",
"seeLess": "See less",
"summary": "Summary:",
"urlExternal": "This URL is external",
"wantsToFetch": "Cline wants to fetch content from this URL:",
@@ -111,7 +119,17 @@
"restoreAll": "Restore All",
"restoreChat": "Restore Chat",
"restoreAllTooltip": "Restore both the chat and workspace files to this checkpoint and send your edited message",
"restoreChatTooltip": "Restore just the chat to this checkpoint and send your edited message"
"restoreChatTooltip": "Restore just the chat to this checkpoint and send your edited message",
"approve": "Approve",
"reject": "Reject",
"save": "Save",
"runCommand": "Run Command",
"resumeTask": "Resume Task",
"proceedAnyways": "Proceed Anyways",
"proceedWhileRunning": "Proceed While Running",
"condense": "Condense Conversation",
"reportBug": "Report GitHub issue",
"retry": "Retry"
},
"settings": {
"title": "Settings",
@@ -584,6 +602,17 @@
"subagentsWindowsTooltip": "Cline CLI & subagents are only available on macOS & Linux",
"copyCommand": "Copy command",
"copied": "Copied!"
},
"newModelBanner": {
"title": "Claude Opus 4.5",
"description": "Anthropic's latest model with SOTA performance at 3x lower cost than Opus 4.1.",
"tryNewModel": "Try new model",
"tryWithClineAccount": "Try with Cline account"
}
},
"models": {
"claudeSonnet45": {
"description": "Claude Sonnet 4.5 delivers superior intelligence across coding, agentic search, and AI agent capabilities. It's a powerful choice for agentic coding, and can complete tasks across the entire software development lifecycle—from initial planning to bug fixes, maintenance to large refactors. It offers strong performance in both planning and solving for complex coding tasks, making it an ideal choice to power end-to-end software development processes.\n\nRead more in the [blog post here](https://www.anthropic.com/claude/sonnet)"
}
},
"autoApprove": {
+30 -1
View File
@@ -23,6 +23,12 @@
"takeATour": "开始游览",
"infoTooltip": "我可以步进式地开发软件,包括编辑文件、探索项目、运行命令以及使用浏览器。我甚至可以使用 MCP 工具扩展我的能力,提供超越基础代码补全的协助。",
"inputHint": "输入 @ 获取上下文,/ 获取快捷命令和工作流,按住 shift 拖入文件/图片",
"newTask": {
"newTask": "新任务",
"startNewTask": "开始新任务",
"startNewTaskWithContext": "使用上下文开始新任务",
"startANewTask": "开始新任务"
},
"errorImageSize": "图片尺寸超过 7500px",
"errorUnsupportedFile": "目前仅支持图片文件",
"addContext": "添加上下文",
@@ -59,6 +65,8 @@
"condensing": "Cline 正在压缩对话:",
"collapseSummary": "折叠摘要",
"expandSummary": "展开摘要",
"seeMore": "查看更多",
"seeLess": "收起",
"summary": "摘要:",
"urlExternal": "此 URL 是外部的",
"wantsToFetch": "Cline 想要从此 URL 获取内容:",
@@ -111,7 +119,17 @@
"restoreAll": "恢复全部",
"restoreChat": "恢复聊天",
"restoreAllTooltip": "将聊天和工作区文件恢复到此检查点,并发送您编辑后的消息",
"restoreChatTooltip": "仅将聊天恢复到此检查点,并发送您编辑后的消息"
"restoreChatTooltip": "仅将聊天恢复到此检查点,并发送您编辑后的消息",
"approve": "批准",
"reject": "拒绝",
"save": "保存",
"runCommand": "运行命令",
"resumeTask": "恢复任务",
"proceedAnyways": "继续执行",
"proceedWhileRunning": "运行时继续",
"condense": "压缩对话",
"reportBug": "报告 GitHub issue",
"retry": "重试"
},
"settings": {
"title": "设置",
@@ -584,6 +602,17 @@
"subagentsWindowsTooltip": "Cline CLI 和子代理仅在 macOS 和 Linux 上可用",
"copyCommand": "复制命令",
"copied": "已复制!"
},
"newModelBanner": {
"title": "Claude Opus 4.5",
"description": "Anthropic 的最新模型,具有最先进的性能,成本比 Opus 4.1 低 3 倍。",
"tryNewModel": "试用新模型",
"tryWithClineAccount": "使用 Cline 账户试用"
}
},
"models": {
"claudeSonnet45": {
"description": "Claude Sonnet 4.5 在编码、代理搜索和 AI 代理能力方面提供卓越的智能。它是代理编码的强大选择,可以完成整个软件开发生命周期中的任务——从初始规划到错误修复,从维护到大型重构。它在规划和解决复杂编码任务方面都表现出色,是支持端到端软件开发流程的理想选择。\n\n在[此处的博客文章](https://www.anthropic.com/claude/sonnet)中了解更多信息"
}
},
"autoApprove": {