diff --git a/packages/ai-anthropic/src/browser/anthropic-preferences.ts b/packages/ai-anthropic/src/browser/anthropic-preferences.ts index b47622c156f83..288108f63a255 100644 --- a/packages/ai-anthropic/src/browser/anthropic-preferences.ts +++ b/packages/ai-anthropic/src/browser/anthropic-preferences.ts @@ -16,6 +16,7 @@ import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences'; +import { nls } from '@theia/core'; export const API_KEY_PREF = 'ai-features.anthropic.AnthropicApiKey'; export const MODELS_PREF = 'ai-features.anthropic.AnthropicModels'; @@ -25,13 +26,14 @@ export const AnthropicPreferencesSchema: PreferenceSchema = { properties: { [API_KEY_PREF]: { type: 'string', - markdownDescription: 'Enter an API Key of your official Anthropic Account. **Please note:** By using this preference the Anthropic API key will be stored in clear text\ - on the machine running Theia. Use the environment variable `ANTHROPIC_API_KEY` to set the key securely.', + markdownDescription: nls.localize('theia/ai/anthropic/apiKey/description', + 'Enter an API Key of your official Anthropic Account. **Please note:** By using this preference the Anthropic API key will be stored in clear text\ + on the machine running Theia. Use the environment variable `ANTHROPIC_API_KEY` to set the key securely.'), title: AI_CORE_PREFERENCES_TITLE, }, [MODELS_PREF]: { type: 'array', - description: 'Official Anthropic models to use', + description: nls.localize('theia/ai/anthropic/models/description', 'Official Anthropic models to use'), title: AI_CORE_PREFERENCES_TITLE, default: ['claude-3-5-sonnet-latest', 'claude-3-5-haiku-latest', 'claude-3-opus-latest'], items: { diff --git a/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts b/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts index ffdcef7651984..78b2c2826926f 100644 --- a/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts +++ b/packages/ai-chat-ui/src/browser/ai-chat-ui-contribution.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { inject, injectable } from '@theia/core/shared/inversify'; -import { CommandRegistry, isOSX, QuickInputButton, QuickInputService, QuickPickItem } from '@theia/core'; +import { CommandRegistry, isOSX, nls, QuickInputButton, QuickInputService, QuickPickItem } from '@theia/core'; import { Widget } from '@theia/core/lib/browser'; import { AI_CHAT_NEW_CHAT_WINDOW_COMMAND, AI_CHAT_SHOW_CHATS_COMMAND, ChatCommands } from './chat-view-commands'; import { ChatAgentLocation, ChatService } from '@theia/ai-chat'; @@ -37,7 +37,7 @@ export class AIChatContribution extends AbstractViewContribution protected static readonly REMOVE_CHAT_BUTTON: QuickInputButton = { iconClass: 'codicon-remove-close', - tooltip: 'Remove Chat', + tooltip: nls.localize('theia/ai/chatUi/removeChat', 'Remove Chat'), }; @inject(SecondaryWindowHandler) @@ -90,13 +90,13 @@ export class AIChatContribution extends AbstractViewContribution registry.registerItem({ id: AI_CHAT_NEW_CHAT_WINDOW_COMMAND.id, command: AI_CHAT_NEW_CHAT_WINDOW_COMMAND.id, - tooltip: 'New Chat', + tooltip: nls.localizeByDefault('New Chat'), isVisible: widget => this.isChatViewWidget(widget) }); registry.registerItem({ id: AI_CHAT_SHOW_CHATS_COMMAND.id, command: AI_CHAT_SHOW_CHATS_COMMAND.id, - tooltip: 'Show Chats...', + tooltip: nls.localizeByDefault('Show Chats...'), isVisible: widget => this.isChatViewWidget(widget), }); } diff --git a/packages/ai-chat-ui/src/browser/chat-input-widget.tsx b/packages/ai-chat-ui/src/browser/chat-input-widget.tsx index 3741528dfb14a..5f98a3f10facc 100644 --- a/packages/ai-chat-ui/src/browser/chat-input-widget.tsx +++ b/packages/ai-chat-ui/src/browser/chat-input-widget.tsx @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** import { ChangeSet, ChangeSetElement, ChatChangeEvent, ChatModel, ChatRequestModel } from '@theia/ai-chat'; -import { Disposable, UntitledResourceResolver } from '@theia/core'; +import { Disposable, nls, UntitledResourceResolver } from '@theia/core'; import { ContextMenuRenderer, LabelProvider, Message, ReactWidget } from '@theia/core/lib/browser'; import { Deferred } from '@theia/core/lib/common/promise-util'; import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify'; @@ -320,14 +320,14 @@ const ChatInput: React.FunctionComponent = (props: ChatInpu }; const leftOptions = props.showContext ? [{ - title: 'Attach elements to context', + title: nls.localize('theia/ai/chatUi/attachToContext', 'Attach elements to context'), handler: () => { /* TODO */ }, className: 'codicon-add' }] : []; const rightOptions = inProgress ? [{ - title: 'Cancel (Esc)', + title: nls.localize('theia/ai/chatUi/cancel', 'Cancel (Esc)'), handler: () => { const latestRequest = getLatestRequest(props.chatModel); if (latestRequest) { @@ -338,7 +338,7 @@ const ChatInput: React.FunctionComponent = (props: ChatInpu className: 'codicon-stop-circle' }] : [{ - title: 'Send (Enter)', + title: nls.localize('theia/ai/chatUi/send', 'Send (Enter)'), handler: () => { if (props.isEnabled) { submit(editorRef.current?.document.textEditorModel.getValue() || ''); diff --git a/packages/ai-chat/src/browser/ai-chat-preferences.ts b/packages/ai-chat/src/browser/ai-chat-preferences.ts index 11dee619e4ff0..7068924029dcf 100644 --- a/packages/ai-chat/src/browser/ai-chat-preferences.ts +++ b/packages/ai-chat/src/browser/ai-chat-preferences.ts @@ -15,6 +15,7 @@ // ***************************************************************************** import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences'; +import { nls } from '@theia/core'; import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; export const DEFAULT_CHAT_AGENT_PREF = 'ai-features.chat.defaultChatAgent'; @@ -24,8 +25,9 @@ export const aiChatPreferences: PreferenceSchema = { properties: { [DEFAULT_CHAT_AGENT_PREF]: { type: 'string', - description: 'Optional: of the Chat Agent that shall be invoked, if no agent is explicitly mentioned with @ in the user query.\ - If no Default Agent is configured, Theia´s defaults will be applied.', + description: nls.localize('theia/ai/chat/defaultAgent/description', + 'Optional: of the Chat Agent that shall be invoked, if no agent is explicitly mentioned with @ in the user query. \ +If no Default Agent is configured, Theia´s defaults will be applied.'), title: AI_CORE_PREFERENCES_TITLE, } } diff --git a/packages/ai-code-completion/src/browser/ai-code-completion-preference.ts b/packages/ai-code-completion/src/browser/ai-code-completion-preference.ts index 9778d18f18d9d..0666cf9529ca9 100644 --- a/packages/ai-code-completion/src/browser/ai-code-completion-preference.ts +++ b/packages/ai-code-completion/src/browser/ai-code-completion-preference.ts @@ -16,6 +16,7 @@ import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences'; +import { nls } from '@theia/core'; export const PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = 'ai-features.codeCompletion.automaticCodeCompletion'; export const PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = 'ai-features.codeCompletion.excludedFileExtensions'; @@ -28,33 +29,36 @@ export const AICodeCompletionPreferencesSchema: PreferenceSchema = { [PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE]: { title: AI_CORE_PREFERENCES_TITLE, type: 'boolean', - description: 'Automatically trigger AI completions inline within any (Monaco) editor while editing.\ + description: nls.localize('theia/ai/completion/automaticEnable/description', + 'Automatically trigger AI completions inline within any (Monaco) editor while editing.\ \n\ - Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "Ctrl+Alt+Space".', + Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "Ctrl+Alt+Space".'), default: true }, [PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS]: { - title: 'Excluded File Extensions', + title: nls.localize('theia/ai/completion/excludedFileExts/title', 'Excluded File Extensions'), type: 'array', - description: 'Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.', + description: nls.localize('theia/ai/completion/excludedFileExts/description', 'Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.'), items: { type: 'string' }, default: [] }, [PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES]: { - title: 'Maximum Context Lines', + title: nls.localize('theia/ai/completion/maxContextLines/title', 'Maximum Context Lines'), type: 'number', - description: 'The maximum number of lines used as context, distributed among the lines before and after the cursor position (prefix and suffix).\ - Set this to -1 to use the full file as context without any line limit and 0 to only use the current line.', + description: nls.localize('theia/ai/completion/maxContextLines/description', + 'The maximum number of lines used as context, distributed among the lines before and after the cursor position (prefix and suffix).\ + Set this to -1 to use the full file as context without any line limit and 0 to only use the current line.'), default: -1, minimum: -1 }, [PREF_AI_INLINE_COMPLETION_STRIP_BACKTICKS]: { - title: 'Strip Backticks from Inline Completions', + title: nls.localize('theia/ai/completion/stripBackticks/title', 'Strip Backticks from Inline Completions'), type: 'boolean', - description: 'Remove surrounding backticks from the code returned by some LLMs. If a backtick is detected, all content after the closing\ - backtick is stripped as well. This setting helps ensure plain code is returned when language models use markdown-like formatting.', + description: nls.localize('theia/ai/completion/stripBackticks/description', + 'Remove surrounding backticks from the code returned by some LLMs. If a backtick is detected, all content after the closing\ + backtick is stripped as well. This setting helps ensure plain code is returned when language models use markdown-like formatting.'), default: true } } diff --git a/packages/ai-code-completion/src/browser/code-completion-agent.ts b/packages/ai-code-completion/src/browser/code-completion-agent.ts index 1ecdafd94f669..3bc5468177501 100644 --- a/packages/ai-code-completion/src/browser/code-completion-agent.ts +++ b/packages/ai-code-completion/src/browser/code-completion-agent.ts @@ -18,7 +18,7 @@ import { Agent, AgentSpecificVariables, CommunicationRecordingService, getTextOfResponse, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequirement, PromptService, PromptTemplate } from '@theia/ai-core/lib/common'; -import { generateUuid, ILogger, ProgressService } from '@theia/core'; +import { generateUuid, ILogger, nls, ProgressService } from '@theia/core'; import { inject, injectable, named } from '@theia/core/shared/inversify'; import * as monaco from '@theia/monaco-editor-core'; import { PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES } from './ai-code-completion-preference'; @@ -184,7 +184,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent { id = 'Code Completion'; name = 'Code Completion'; description = - 'This agent provides inline code completion in the code editor in the Theia IDE.'; + nls.localize('theia/ai/completion/agent/description', 'This agent provides inline code completion in the code editor in the Theia IDE.'); promptTemplates: PromptTemplate[] = [ { id: 'code-completion-prompt-previous', diff --git a/packages/ai-core/src/browser/ai-configuration/agent-configuration-widget.tsx b/packages/ai-core/src/browser/ai-configuration/agent-configuration-widget.tsx index 8329e25ab5e1f..15b28add8f72a 100644 --- a/packages/ai-core/src/browser/ai-configuration/agent-configuration-widget.tsx +++ b/packages/ai-core/src/browser/ai-configuration/agent-configuration-widget.tsx @@ -33,6 +33,7 @@ import { TemplateRenderer } from './template-settings-renderer'; import { AIConfigurationSelectionService } from './ai-configuration-service'; import { AIVariableConfigurationWidget } from './variable-configuration-widget'; import { AgentService } from '../../common/agent-service'; +import { nls } from '@theia/core'; interface ParsedPrompt { functions: string[]; @@ -44,7 +45,7 @@ interface ParsedPrompt { export class AIAgentConfigurationWidget extends ReactWidget { static readonly ID = 'ai-agent-configuration-container-widget'; - static readonly LABEL = 'Agents'; + static readonly LABEL = nls.localize('theia/ai/core/agentConfiguration/label', 'Agents'); @inject(AgentService) protected readonly agentService: AgentService; diff --git a/packages/ai-core/src/browser/ai-configuration/ai-configuration-widget.tsx b/packages/ai-core/src/browser/ai-configuration/ai-configuration-widget.tsx index 909c822d8df47..4b68200ecc4b4 100644 --- a/packages/ai-core/src/browser/ai-configuration/ai-configuration-widget.tsx +++ b/packages/ai-core/src/browser/ai-configuration/ai-configuration-widget.tsx @@ -21,12 +21,13 @@ import '../../../src/browser/style/index.css'; import { AIAgentConfigurationWidget } from './agent-configuration-widget'; import { AIVariableConfigurationWidget } from './variable-configuration-widget'; import { AIConfigurationSelectionService } from './ai-configuration-service'; +import { nls } from '@theia/core'; @injectable() export class AIConfigurationContainerWidget extends BaseWidget { static readonly ID = 'ai-configuration'; - static readonly LABEL = '✨ AI Configuration [Experimental]'; + static readonly LABEL = nls.localize('theia/ai/core/aiConfiguration/label', '✨ AI Configuration [Experimental]'); protected dockpanel: DockPanel; @inject(TheiaDockPanel.Factory) diff --git a/packages/ai-core/src/browser/ai-core-preferences.ts b/packages/ai-core/src/browser/ai-core-preferences.ts index 2250931338951..3f06fddb18026 100644 --- a/packages/ai-core/src/browser/ai-core-preferences.ts +++ b/packages/ai-core/src/browser/ai-core-preferences.ts @@ -14,11 +14,12 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** +import { nls } from '@theia/core'; import { PreferenceContribution, PreferenceProxy, PreferenceSchema } from '@theia/core/lib/browser'; import { PreferenceProxyFactory } from '@theia/core/lib/browser/preferences/injectable-preference-proxy'; import { interfaces } from '@theia/core/shared/inversify'; -export const AI_CORE_PREFERENCES_TITLE = '✨ AI Features [Experimental]'; +export const AI_CORE_PREFERENCES_TITLE = nls.localize('theia/ai/core/prefs/title', '✨ AI Features [Experimental]'); export const PREFERENCE_NAME_ENABLE_EXPERIMENTAL = 'ai-features.AiEnable.enableAI'; export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder'; export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings'; @@ -28,7 +29,8 @@ export const aiCorePreferenceSchema: PreferenceSchema = { properties: { [PREFERENCE_NAME_ENABLE_EXPERIMENTAL]: { title: AI_CORE_PREFERENCES_TITLE, - markdownDescription: '❗ This setting allows you to access and experiment with the latest AI capabilities.\ + markdownDescription: nls.localize('theia/ai/core/enableExperimental/mdDescription', + '❗ This setting allows you to access and experiment with the latest AI capabilities.\ \n\ Please note that these features are in an experimental phase, which means they may be unstable and\ undergo significant changes. It is important to be aware that these experimental features may generate\ @@ -37,14 +39,15 @@ export const aiCorePreferenceSchema: PreferenceSchema = { \n\ **Please note! The settings below in this section will only take effect\n\ once the main feature setting is enabled. After enabling the feature, you need to configure at least one\ - LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.', + LLM provider below. Also see [the documentation](https://theia-ide.org/docs/user_ai/)**.'), type: 'boolean', default: false, }, [PREFERENCE_NAME_PROMPT_TEMPLATES]: { title: AI_CORE_PREFERENCES_TITLE, - description: 'Folder for storing customized prompt templates. If not customized the user config directory is used. Please consider to use a folder, which is\ - under version control to manage your variants of prompt templates.', + description: nls.localize('theia/ai/core/promptTemplates/description', + 'Folder for storing customized prompt templates. If not customized the user config directory is used. Please consider to use a folder, which is\ + under version control to manage your variants of prompt templates.'), type: 'string', default: '', typeDetails: { @@ -58,12 +61,12 @@ export const aiCorePreferenceSchema: PreferenceSchema = { }, }, [PREFERENCE_NAME_REQUEST_SETTINGS]: { - title: 'Custom Request Settings', - markdownDescription: 'Allows specifying custom request settings for multiple models.\n\ + title: nls.localize('theia/ai/core/requestSettings/title', 'Custom Request Settings'), + markdownDescription: nls.localize('theia/ai/core/requestSettings/mdDescription', 'Allows specifying custom request settings for multiple models.\n\ Each object represents the configuration for a specific model. The `modelId` field specifies the model ID, `requestSettings` defines model-specific settings.\n\ The `providerId` field is optional and allows you to apply the settings to a specific provider. If not set, the settings will be applied to all providers.\n\ Example providerIds: huggingface, openai, ollama, llamafile.\n\ - Refer to [our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings) for more information.', + Refer to [our documentation](https://theia-ide.org/docs/user_ai/#custom-request-settings) for more information.'), type: 'array', items: { type: 'object', diff --git a/packages/ai-core/src/browser/prompttemplate-contribution.ts b/packages/ai-core/src/browser/prompttemplate-contribution.ts index 9465ced70b5ef..19eef9b7ac28a 100644 --- a/packages/ai-core/src/browser/prompttemplate-contribution.ts +++ b/packages/ai-core/src/browser/prompttemplate-contribution.ts @@ -17,7 +17,7 @@ import { inject, injectable } from '@theia/core/shared/inversify'; import { GrammarDefinition, GrammarDefinitionProvider, LanguageGrammarDefinitionContribution, TextmateRegistry } from '@theia/monaco/lib/browser/textmate'; import * as monaco from '@theia/monaco-editor-core'; -import { Command, CommandContribution, CommandRegistry, MessageService } from '@theia/core'; +import { Command, CommandContribution, CommandRegistry, MessageService, nls } from '@theia/core'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; import { codicon, Widget } from '@theia/core/lib/browser'; @@ -245,7 +245,7 @@ export class PromptTemplateContribution implements LanguageGrammarDefinitionCont registry.registerItem({ id: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id, command: DISCARD_PROMPT_TEMPLATE_CUSTOMIZATIONS.id, - tooltip: 'Discard Customizations' + tooltip: nls.localize('theia/ai/core/discardCustomPrompt/tooltip', 'Discard Customizations') }); } } diff --git a/packages/ai-core/src/common/agents-variable-contribution.ts b/packages/ai-core/src/common/agents-variable-contribution.ts index 67803cabb9fe0..f8efa3714719f 100644 --- a/packages/ai-core/src/common/agents-variable-contribution.ts +++ b/packages/ai-core/src/common/agents-variable-contribution.ts @@ -15,13 +15,13 @@ // ***************************************************************************** import { inject, injectable } from '@theia/core/shared/inversify'; import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, AIVariableService, ResolvedAIVariable } from './variable-service'; -import { MaybePromise } from '@theia/core'; +import { MaybePromise, nls } from '@theia/core'; import { AgentService } from './agent-service'; export const AGENTS_VARIABLE: AIVariable = { id: 'agents', name: 'agents', - description: 'Returns the list of agents available in the system' + description: nls.localize('theia/ai/core/agentsVariable/description', 'Returns the list of agents available in the system') }; export interface ResolvedAgentsVariable extends ResolvedAIVariable { diff --git a/packages/ai-core/src/common/today-variable-contribution.ts b/packages/ai-core/src/common/today-variable-contribution.ts index a155618ffe85c..875fd03448407 100644 --- a/packages/ai-core/src/common/today-variable-contribution.ts +++ b/packages/ai-core/src/common/today-variable-contribution.ts @@ -13,7 +13,7 @@ // // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { MaybePromise } from '@theia/core'; +import { MaybePromise, nls } from '@theia/core'; import { injectable } from '@theia/core/shared/inversify'; import { AIVariable, ResolvedAIVariable, AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext } from './variable-service'; @@ -24,11 +24,11 @@ export namespace TodayVariableArgs { export const TODAY_VARIABLE: AIVariable = { id: 'today-provider', - description: 'Does something for today', + description: nls.localize('theia/ai/core/todayVariable/description', 'Does something for today'), name: 'today', args: [ - { name: TodayVariableArgs.IN_ISO_8601, description: 'Returns the current date in ISO 8601 format' }, - { name: TodayVariableArgs.IN_UNIX_SECONDS, description: 'Returns the current date in unix seconds format' } + { name: TodayVariableArgs.IN_ISO_8601, description: nls.localize('theia/ai/core/todayVariable/iso/description', 'Returns the current date in ISO 8601 format') }, + { name: TodayVariableArgs.IN_UNIX_SECONDS, description: nls.localize('theia/ai/core/todayVariable/unix/description', 'Returns the current date in unix seconds format') } ] }; diff --git a/packages/ai-core/src/common/tomorrow-variable-contribution.ts b/packages/ai-core/src/common/tomorrow-variable-contribution.ts index 8575505cfef82..6f7654d32c3f4 100644 --- a/packages/ai-core/src/common/tomorrow-variable-contribution.ts +++ b/packages/ai-core/src/common/tomorrow-variable-contribution.ts @@ -13,7 +13,7 @@ // // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { MaybePromise } from '@theia/core'; +import { MaybePromise, nls } from '@theia/core'; import { injectable } from '@theia/core/shared/inversify'; import { AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest, AIVariableResolver, AIVariableService, ResolvedAIVariable } from './variable-service'; @@ -24,11 +24,14 @@ export namespace TomorrowVariableArgs { export const TOMORROW_VARIABLE: AIVariable = { id: 'tomorrow-provider', - description: 'Does something for tomorrow', + description: nls.localize('theia/ai/core/tomorrowVariable/description', 'Does something for tomorrow'), name: 'tomorrow', args: [ - { name: TomorrowVariableArgs.IN_ISO_8601, description: 'Returns the current date in ISO 8601 format' }, - { name: TomorrowVariableArgs.IN_UNIX_SECONDS, description: 'Returns the current date in unix seconds format' } + { name: TomorrowVariableArgs.IN_ISO_8601, description: nls.localize('theia/ai/core/tomorrowVariable/iso/description', 'Returns the current date in ISO 8601 format') }, + { + name: TomorrowVariableArgs.IN_UNIX_SECONDS, + description: nls.localize('theia/ai/core/tomorrowVariable/unix/description', 'Returns the current date in unix seconds format') + } ] }; diff --git a/packages/ai-history/src/browser/ai-history-contribution.ts b/packages/ai-history/src/browser/ai-history-contribution.ts index 2b5bba583b61e..e057aa813541f 100644 --- a/packages/ai-history/src/browser/ai-history-contribution.ts +++ b/packages/ai-history/src/browser/ai-history-contribution.ts @@ -17,7 +17,7 @@ import { FrontendApplication, codicon } from '@theia/core/lib/browser'; import { AIViewContribution } from '@theia/ai-core/lib/browser'; import { inject, injectable } from '@theia/core/shared/inversify'; import { AIHistoryView } from './ai-history-widget'; -import { Command, CommandRegistry, Emitter } from '@theia/core'; +import { Command, CommandRegistry, Emitter, nls } from '@theia/core'; import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar'; import { CommunicationRecordingService } from '@theia/ai-core'; @@ -115,21 +115,21 @@ export class AIHistoryViewContribution extends AIViewContribution registry.registerItem({ id: AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id, command: AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id, - tooltip: 'Sort chronologically', + tooltip: nls.localize('theia/ai/history/sortChronologically/tooltip', 'Sort chronologically'), isVisible: widget => this.withHistoryWidget(widget), onDidChange: this.chronologicalStateChanged }); registry.registerItem({ id: AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id, command: AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id, - tooltip: 'Sort reverse chronologically', + tooltip: nls.localize('theia/ai/history/sortReverseChronologically/tooltip', 'Sort reverse chronologically'), isVisible: widget => this.withHistoryWidget(widget), onDidChange: this.chronologicalStateChanged }); registry.registerItem({ id: AI_HISTORY_VIEW_CLEAR.id, command: AI_HISTORY_VIEW_CLEAR.id, - tooltip: 'Clear History of all agents', + tooltip: nls.localize('theia/ai/history/clear/tooltip', 'Clear History of all agents'), isVisible: widget => this.withHistoryWidget(widget) }); } diff --git a/packages/ai-history/src/browser/ai-history-widget.tsx b/packages/ai-history/src/browser/ai-history-widget.tsx index fab5d6c1f5061..642eb79445d20 100644 --- a/packages/ai-history/src/browser/ai-history-widget.tsx +++ b/packages/ai-history/src/browser/ai-history-widget.tsx @@ -19,7 +19,7 @@ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify' import * as React from '@theia/core/shared/react'; import { CommunicationCard } from './ai-history-communication-card'; import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component'; -import { deepClone } from '@theia/core'; +import { deepClone, nls } from '@theia/core'; namespace AIHistoryView { export interface State { @@ -35,7 +35,7 @@ export class AIHistoryView extends ReactWidget implements StatefulWidget { protected readonly agentService: AgentService; public static ID = 'ai-history-widget'; - static LABEL = '✨ AI Agent History [Experimental]'; + static LABEL = nls.localize('theia/ai/history/view/label', '✨ AI Agent History [Experimental]'); protected selectedAgent?: Agent; diff --git a/packages/ai-hugging-face/src/browser/huggingface-preferences.ts b/packages/ai-hugging-face/src/browser/huggingface-preferences.ts index 91930ee759558..50708821580f9 100644 --- a/packages/ai-hugging-face/src/browser/huggingface-preferences.ts +++ b/packages/ai-hugging-face/src/browser/huggingface-preferences.ts @@ -16,6 +16,7 @@ import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences'; +import { nls } from '@theia/core'; export const API_KEY_PREF = 'ai-features.huggingFace.apiKey'; export const MODELS_PREF = 'ai-features.huggingFace.models'; @@ -25,13 +26,14 @@ export const HuggingFacePreferencesSchema: PreferenceSchema = { properties: { [API_KEY_PREF]: { type: 'string', - markdownDescription: 'Enter an API Key for your Hugging Face Account. **Please note:** By using this preference the Hugging Face API key will be stored in clear text\ - on the machine running Theia. Use the environment variable `HUGGINGFACE_API_KEY` to set the key securely.', + markdownDescription: nls.localize('theia/ai/huggingFace/apiKey/mdDescription', + 'Enter an API Key for your Hugging Face Account. **Please note:** By using this preference the Hugging Face API key will be stored in clear text\ + on the machine running Theia. Use the environment variable `HUGGINGFACE_API_KEY` to set the key securely.'), title: AI_CORE_PREFERENCES_TITLE, }, [MODELS_PREF]: { type: 'array', - description: 'Hugging Face models to use', + description: nls.localize('theia/ai/huggingFace/models/description', 'Hugging Face models to use'), title: AI_CORE_PREFERENCES_TITLE, default: ['bigcode/starcoder'], items: { diff --git a/packages/ai-ide-agents/src/browser/coder-agent.ts b/packages/ai-ide-agents/src/browser/coder-agent.ts index 31f3690fbf2dc..8ca14482982a9 100644 --- a/packages/ai-ide-agents/src/browser/coder-agent.ts +++ b/packages/ai-ide-agents/src/browser/coder-agent.ts @@ -19,6 +19,7 @@ import { FILE_CONTENT_FUNCTION_ID, GET_WORKSPACE_FILE_LIST_FUNCTION_ID, GET_WORK import { CODER_REPLACE_PROMPT_TEMPLATE_ID, getCoderReplacePromptTemplate } from '../common/coder-replace-prompt-template'; import { WriteChangeToFileProvider } from './file-changeset-functions'; import { LanguageModelRequirement } from '@theia/ai-core'; +import { nls } from '@theia/core'; @injectable() export class CoderAgent extends AbstractStreamParsingChatAgent { @@ -30,7 +31,8 @@ export class CoderAgent extends AbstractStreamParsingChatAgent { }]; protected defaultLanguageModelPurpose: string = 'chat'; - override description = 'An AI assistant integrated into Theia IDE, designed to assist software developers with code tasks.'; + override description = nls.localize('theia/ai/workspace/coderAgent/description', + 'An AI assistant integrated into Theia IDE, designed to assist software developers with code tasks.'); override promptTemplates = [getCoderReplacePromptTemplate(true), getCoderReplacePromptTemplate(false)]; override functions = [GET_WORKSPACE_DIRECTORY_STRUCTURE_FUNCTION_ID, GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID, WriteChangeToFileProvider.ID]; protected override systemPromptId: string | undefined = CODER_REPLACE_PROMPT_TEMPLATE_ID; diff --git a/packages/ai-ide-agents/src/browser/workspace-agent.ts b/packages/ai-ide-agents/src/browser/workspace-agent.ts index 1b2d9e171cf5f..e96c5956d5ee8 100644 --- a/packages/ai-ide-agents/src/browser/workspace-agent.ts +++ b/packages/ai-ide-agents/src/browser/workspace-agent.ts @@ -18,6 +18,7 @@ import { LanguageModelRequirement } from '@theia/ai-core'; import { injectable } from '@theia/core/shared/inversify'; import { workspacePromptTemplate } from '../common/workspace-prompt-template'; import { FILE_CONTENT_FUNCTION_ID, GET_WORKSPACE_FILE_LIST_FUNCTION_ID } from '../common/workspace-functions'; +import { nls } from '@theia/core'; @injectable() export class WorkspaceAgent extends AbstractStreamParsingChatAgent { @@ -30,9 +31,10 @@ export class WorkspaceAgent extends AbstractStreamParsingChatAgent { }]; protected defaultLanguageModelPurpose: string = 'chat'; - override description = 'This agent can access the users workspace, it can get a list of all available files and retrieve their content. \ + override description = nls.localize('theia/ai/workspace/workspaceAgent/description', + 'This agent can access the users workspace, it can get a list of all available files and retrieve their content. \ It can therefore answer questions about the current project, project files and source code in the workspace, such as how to build the project, \ - where to put source code, where to find specific code or configurations, etc.'; + where to put source code, where to find specific code or configurations, etc.'); override promptTemplates = [workspacePromptTemplate]; override functions = [GET_WORKSPACE_FILE_LIST_FUNCTION_ID, FILE_CONTENT_FUNCTION_ID]; protected override systemPromptId: string | undefined = workspacePromptTemplate.id; diff --git a/packages/ai-ide-agents/src/browser/workspace-preferences.ts b/packages/ai-ide-agents/src/browser/workspace-preferences.ts index 98b0bb00ef0b2..73591df4384e3 100644 --- a/packages/ai-ide-agents/src/browser/workspace-preferences.ts +++ b/packages/ai-ide-agents/src/browser/workspace-preferences.ts @@ -14,6 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** +import { nls } from '@theia/core'; import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; export const CONSIDER_GITIGNORE_PREF = 'ai-features.workspaceFunctions.considerGitIgnore'; @@ -24,14 +25,15 @@ export const WorkspacePreferencesSchema: PreferenceSchema = { properties: { [CONSIDER_GITIGNORE_PREF]: { type: 'boolean', - title: 'Consider .gitignore', - description: 'If enabled, excludes files/folders specified in a global .gitignore file (expected location is the workspace root).', + title: nls.localize('theia/ai/workspace/considerGitignore/title', 'Consider .gitignore'), + description: nls.localize('theia/ai/workspace/considerGitignore/description', + 'If enabled, excludes files/folders specified in a global .gitignore file (expected location is the workspace root).'), default: false }, [USER_EXCLUDE_PATTERN_PREF]: { type: 'array', - title: 'Excluded File Patterns', - description: 'List of patterns (glob or regex) for files/folders to exclude.', + title: nls.localize('theia/ai/workspace/excludedPattern/title', 'Excluded File Patterns'), + description: nls.localize('theia/ai/workspace/excludedPattern/description', 'List of patterns (glob or regex) for files/folders to exclude.'), default: ['node_modules', 'lib', '.*'], items: { type: 'string' diff --git a/packages/ai-ide-agents/src/common/orchestrator-chat-agent.ts b/packages/ai-ide-agents/src/common/orchestrator-chat-agent.ts index 0c3f0f73ab5a9..bec13814186d0 100644 --- a/packages/ai-ide-agents/src/common/orchestrator-chat-agent.ts +++ b/packages/ai-ide-agents/src/common/orchestrator-chat-agent.ts @@ -20,7 +20,7 @@ import { inject, injectable } from '@theia/core/shared/inversify'; import { ChatAgentService } from '@theia/ai-chat/lib/common/chat-agent-service'; import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents'; import { ChatRequestModelImpl, InformationalChatResponseContentImpl } from '@theia/ai-chat/lib/common/chat-model'; -import { generateUuid } from '@theia/core'; +import { generateUuid, nls } from '@theia/core'; import { ChatHistoryEntry } from '@theia/ai-chat/lib/common/chat-history-entry'; export const orchestratorTemplate: PromptTemplate = { @@ -75,8 +75,9 @@ export class OrchestratorChatAgent extends AbstractStreamParsingChatAgent { override variables = ['chatAgents']; override promptTemplates = [orchestratorTemplate]; - override description = 'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \ - (by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.'; + override description = nls.localize('theia/ai/chat/orchestrator/description', + 'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \ + (by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.'); override iconClass: string = 'codicon codicon-symbol-boolean'; protected override defaultLogging = false; diff --git a/packages/ai-ide-agents/src/common/universal-chat-agent.ts b/packages/ai-ide-agents/src/common/universal-chat-agent.ts index 0a7ae6e9f51f9..d57130c61f314 100644 --- a/packages/ai-ide-agents/src/common/universal-chat-agent.ts +++ b/packages/ai-ide-agents/src/common/universal-chat-agent.ts @@ -17,10 +17,11 @@ import { LanguageModelRequirement, PromptTemplate } from '@theia/ai-core/lib/common'; import { injectable } from '@theia/core/shared/inversify'; import { AbstractStreamParsingChatAgent } from '@theia/ai-chat/lib/common/chat-agents'; +import { nls } from '@theia/core'; export const universalTemplate: PromptTemplate = { - id: 'universal-system', - template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: + id: 'universal-system', + template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} # Instructions @@ -76,26 +77,26 @@ simple solutions. }; export const universalTemplateVariant: PromptTemplate = { - id: 'universal-system-empty', - template: '', - variantOf: universalTemplate.id, + id: 'universal-system-empty', + template: '', + variantOf: universalTemplate.id, }; export const UniversalChatAgentId = 'Universal'; @injectable() export class UniversalChatAgent extends AbstractStreamParsingChatAgent { - id: string = UniversalChatAgentId; - name = UniversalChatAgentId; - languageModelRequirements: LanguageModelRequirement[] = [{ - purpose: 'chat', - identifier: 'openai/gpt-4o', - }]; - protected defaultLanguageModelPurpose: string = 'chat'; - override description = 'This agent is designed to help software developers by providing concise and accurate ' - + 'answers to general programming and software development questions. It is also the fall-back for any generic ' - + 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot ' - + 'access the current user context or the workspace.'; - - override promptTemplates = [universalTemplate, universalTemplateVariant]; - protected override systemPromptId: string = universalTemplate.id; + id: string = UniversalChatAgentId; + name = UniversalChatAgentId; + languageModelRequirements: LanguageModelRequirement[] = [{ + purpose: 'chat', + identifier: 'openai/gpt-4o', + }]; + protected defaultLanguageModelPurpose: string = 'chat'; + override description = nls.localize('theia/ai/chat/universal/description', 'This agent is designed to help software developers by providing concise and accurate ' + + 'answers to general programming and software development questions. It is also the fall-back for any generic ' + + 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot ' + + 'access the current user context or the workspace.'); + + override promptTemplates = [universalTemplate, universalTemplateVariant]; + protected override systemPromptId: string = universalTemplate.id; } diff --git a/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts b/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts index cc7eff04d060a..5186481bea73e 100644 --- a/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts +++ b/packages/ai-llamafile/src/browser/llamafile-command-contribution.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory'; -import { CommandContribution, CommandRegistry, MessageService } from '@theia/core'; +import { CommandContribution, CommandRegistry, MessageService, nls } from '@theia/core'; import { PreferenceService, QuickInputService } from '@theia/core/lib/browser'; import { inject, injectable } from '@theia/core/shared/inversify'; import { LlamafileManager } from '../common/llamafile-manager'; @@ -23,11 +23,11 @@ import { LlamafileEntry } from './llamafile-frontend-application-contribution'; export const StartLlamafileCommand = { id: 'llamafile.start', - label: 'Start Llamafile', + label: nls.localize('theia/ai/llamaFile/start', 'Start Llamafile'), }; export const StopLlamafileCommand = { id: 'llamafile.stop', - label: 'Stop Llamafile', + label: nls.localize('theia/ai/llamaFile/stop', 'Stop Llamafile'), }; @injectable() diff --git a/packages/ai-llamafile/src/browser/llamafile-preferences.ts b/packages/ai-llamafile/src/browser/llamafile-preferences.ts index d9c94c9a87e1c..6d851f9a83f74 100644 --- a/packages/ai-llamafile/src/browser/llamafile-preferences.ts +++ b/packages/ai-llamafile/src/browser/llamafile-preferences.ts @@ -14,10 +14,11 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** +import { nls } from '@theia/core'; import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser'; import { interfaces } from '@theia/core/shared/inversify'; -export const AI_LLAMAFILE_PREFERENCES_TITLE = '✨ AI LlamaFile'; +export const AI_LLAMAFILE_PREFERENCES_TITLE = nls.localize('theia/ai/llamaFile/prefs/title', '✨ AI LlamaFile'); export const PREFERENCE_LLAMAFILE = 'ai-features.llamafile.llamafiles'; export const aiLlamafilePreferencesSchema: PreferenceSchema = { @@ -25,7 +26,7 @@ export const aiLlamafilePreferencesSchema: PreferenceSchema = { properties: { [PREFERENCE_LLAMAFILE]: { title: AI_LLAMAFILE_PREFERENCES_TITLE, - markdownDescription: 'This setting allows you to configure and manage LlamaFile models in Theia IDE.\ + markdownDescription: nls.localize('theia/ai/llamaFile/prefs/mdDescription', 'This setting allows you to configure and manage LlamaFile models in Theia IDE.\ \n\ Each entry requires a user-friendly `name`, the file `uri` pointing to your LlamaFile, and the `port` on which it will run.\ \n\ @@ -33,7 +34,7 @@ export const aiLlamafilePreferencesSchema: PreferenceSchema = { \n\ If you edit an entry (e.g., change the port), any running instance will stop, and you will need to manually start it again.\ \n\ - [Learn more about configuring and managing LlamaFiles in the Theia IDE documentation](https://theia-ide.org/docs/user_ai/#llamafile-models).', + [Learn more about configuring and managing LlamaFiles in the Theia IDE documentation](https://theia-ide.org/docs/user_ai/#llamafile-models).'), type: 'array', default: [], items: { @@ -41,15 +42,15 @@ export const aiLlamafilePreferencesSchema: PreferenceSchema = { properties: { name: { type: 'string', - description: 'The model name to use for this Llamafile.' + description: nls.localize('theia/ai/llamaFile/prefs/name/description', 'The model name to use for this Llamafile.') }, uri: { type: 'string', - description: 'The file uri to the Llamafile.' + description: nls.localize('theia/ai/llamaFile/prefs/uri/description', 'The file uri to the Llamafile.') }, port: { type: 'number', - description: 'The port to use to start the server.' + description: nls.localize('theia/ai/llamaFile/prefs/port/description', 'The port to use to start the server.') } } } diff --git a/packages/ai-mcp/src/browser/mcp-command-contribution.ts b/packages/ai-mcp/src/browser/mcp-command-contribution.ts index a14f28b670a77..8b0d36ff63183 100644 --- a/packages/ai-mcp/src/browser/mcp-command-contribution.ts +++ b/packages/ai-mcp/src/browser/mcp-command-contribution.ts @@ -14,18 +14,18 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory'; -import { CommandContribution, CommandRegistry, MessageService } from '@theia/core'; +import { CommandContribution, CommandRegistry, MessageService, nls } from '@theia/core'; import { QuickInputService } from '@theia/core/lib/browser'; import { inject, injectable } from '@theia/core/shared/inversify'; import { MCPFrontendService } from './mcp-frontend-service'; export const StartMCPServer = { id: 'mcp.startserver', - label: 'MCP: Start MCP Server', + label: nls.localize('theia/ai/mcp/start/label', 'MCP: Start MCP Server'), }; export const StopMCPServer = { id: 'mcp.stopserver', - label: 'MCP: Stop MCP Server', + label: nls.localize('theia/ai/mcp/stop/label', 'MCP: Stop MCP Server'), }; @injectable() diff --git a/packages/ai-mcp/src/browser/mcp-preferences.ts b/packages/ai-mcp/src/browser/mcp-preferences.ts index 27f39e3f15a10..6e7c50f13c326 100644 --- a/packages/ai-mcp/src/browser/mcp-preferences.ts +++ b/packages/ai-mcp/src/browser/mcp-preferences.ts @@ -14,77 +14,79 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** +import { nls } from '@theia/core'; import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; export const MCP_SERVERS_PREF = 'ai-features.mcp.mcpServers'; export const McpServersPreferenceSchema: PreferenceSchema = { - type: 'object', - properties: { - [MCP_SERVERS_PREF]: { + type: 'object', + properties: { + [MCP_SERVERS_PREF]: { + type: 'object', + title: nls.localize('theia/ai/mcp/servers/title', 'MCP Servers Configuration'), + markdownDescription: nls.localize('theia/ai/mcp/servers/mdDescription', 'Configure MCP servers with command, arguments, optionally environment variables, and autostart. \ +Each server is identified by a unique key, such as "brave-search" or "filesystem". \ +To start a server, use the "MCP: Start MCP Server" command, which enables you to select the desired server. \ +To stop a server, use the "MCP: Stop MCP Server" command. \ +\n\ +Example configuration:\n\ +```\ +{\n\ + "brave-search": {\n\ + "command": "npx",\n\ + "args": [\n\ + "-y",\n\ + "@modelcontextprotocol/server-brave-search"\n\ + ],\n\ + "env": {\n\ + "BRAVE_API_KEY": "YOUR_API_KEY"\n\ + },\n\ + "autostart": true\n\ + },\n\ + "filesystem": {\n\ + "command": "npx",\n\ + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/YOUR_USERNAME/Desktop"],\n\ + "env": {\n\ + "CUSTOM_ENV_VAR": "custom-value"\n\ + },\n\ + "autostart": false\n\ + }\n\ +}\n```'), + additionalProperties: { + type: 'object', + properties: { + command: { + type: 'string', + title: nls.localize('theia/ai/mcp/servers/command/title', 'Command to execute the MCP server'), + markdownDescription: nls.localize('theia/ai/mcp/servers/command/mdDescription', 'The command used to start the MCP server, e.g., "uvx" or "npx".') + }, + args: { + type: 'array', + title: nls.localize('theia/ai/mcp/servers/args/title', 'Arguments for the command'), + markdownDescription: nls.localize('theia/ai/mcp/servers/args/mdDescription', 'An array of arguments to pass to the command.'), + items: { + type: 'string' + } + }, + env: { type: 'object', - title: 'MCP Servers Configuration', - markdownDescription: 'Configure MCP servers with command, arguments, optionally environment variables, and autostart.\ - Each server is identified by a unique key, such as "brave-search" or "filesystem".\ - To start a server, use the "MCP: Start MCP Server" command, which enables you to select the desired server.\ - To stop a server, use the "MCP: Stop MCP Server" command.\ - \n\ - Example configuration:\n\ - ```\ - {\n\ - "brave-search": {\n\ - "command": "npx",\n\ - "args": [\n\ - "-y",\n\ - "@modelcontextprotocol/server-brave-search"\n\ - ],\n\ - "env": {\n\ - "BRAVE_API_KEY": "YOUR_API_KEY"\n\ - },\n\ - "autostart": true\n\ - },\n\ - "filesystem": {\n\ - "command": "npx",\n\ - "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/YOUR_USERNAME/Desktop"],\n\ - "env": {\n\ - "CUSTOM_ENV_VAR": "custom-value"\n\ - },\n\ - "autostart": false\n\ - }\n\ - }\n ```', + title: nls.localize('theia/ai/mcp/servers/env/title', 'Environment variables'), + markdownDescription: nls.localize('theia/ai/mcp/servers/env/mdDescription', 'Optional environment variables to set for the server, such as an API key.'), additionalProperties: { - type: 'object', - properties: { - command: { - type: 'string', - title: 'Command to execute the MCP server', - markdownDescription: 'The command used to start the MCP server, e.g., "uvx" or "npx".' - }, - args: { - type: 'array', - title: 'Arguments for the command', - markdownDescription: 'An array of arguments to pass to the command.', - items: { - type: 'string' - } - }, - env: { - type: 'object', - title: 'Environment variables', - markdownDescription: 'Optional environment variables to set for the server, such as an API key.', - additionalProperties: { - type: 'string' - } - }, - autostart: { - type: 'boolean', - title: 'Autostart', - markdownDescription: 'Automatically start this server when the frontend starts. Newly added servers are not immediatly auto stated.', - default: false - } - }, - required: ['command', 'args'] + type: 'string' } - } + }, + autostart: { + type: 'boolean', + title: nls.localize('theia/ai/mcp/servers/autostart/title', 'Autostart'), + markdownDescription: nls.localize('theia/ai/mcp/servers/autostart/mdDescription', + 'Automatically start this server when the frontend starts. Newly added servers are not immediately auto started.'), + default: false + } + }, + required: ['command', 'args'] + } } + } }; diff --git a/packages/ai-openai/src/browser/openai-preferences.ts b/packages/ai-openai/src/browser/openai-preferences.ts index d06428c3d9fb8..568c879105fe4 100644 --- a/packages/ai-openai/src/browser/openai-preferences.ts +++ b/packages/ai-openai/src/browser/openai-preferences.ts @@ -16,6 +16,7 @@ import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution'; import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences'; +import { nls } from '@theia/core'; export const API_KEY_PREF = 'ai-features.openAiOfficial.openAiApiKey'; export const MODELS_PREF = 'ai-features.openAiOfficial.officialOpenAiModels'; @@ -26,13 +27,14 @@ export const OpenAiPreferencesSchema: PreferenceSchema = { properties: { [API_KEY_PREF]: { type: 'string', - markdownDescription: 'Enter an API Key of your official OpenAI Account. **Please note:** By using this preference the Open AI API key will be stored in clear text\ - on the machine running Theia. Use the environment variable `OPENAI_API_KEY` to set the key securely.', + markdownDescription: nls.localize('theia/ai/openai/apiKey/mdDescription', + 'Enter an API Key of your official OpenAI Account. **Please note:** By using this preference the Open AI API key will be stored in clear text \ +on the machine running Theia. Use the environment variable `OPENAI_API_KEY` to set the key securely.'), title: AI_CORE_PREFERENCES_TITLE, }, [MODELS_PREF]: { type: 'array', - description: 'Official OpenAI models to use', + description: nls.localize('theia/ai/openai/models/description', 'Official OpenAI models to use'), title: AI_CORE_PREFERENCES_TITLE, default: ['gpt-4o', 'gpt-4o-2024-11-20', 'gpt-4o-2024-08-06', 'gpt-4o-mini', 'o1', 'o1-mini', 'o3-mini'], items: { @@ -42,58 +44,64 @@ export const OpenAiPreferencesSchema: PreferenceSchema = { [CUSTOM_ENDPOINTS_PREF]: { type: 'array', title: AI_CORE_PREFERENCES_TITLE, - markdownDescription: 'Integrate custom models compatible with the OpenAI API, for example via `vllm`. The required attributes are `model` and `url`.\ - \n\ - Optionally, you can\ - \n\ - - specify a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`.\ - \n\ - - provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global OpenAI API key.\ - \n\ - - provide an `apiVersion` to access the API served at the given url in Azure. Use `true` to indicate the use of the global OpenAI API version.\ - \n\ - - specify `supportsDeveloperMessage: false` to indicate that the developer role shall not be used.\ - \n\ - - specify `supportsStructuredOutput: false` to indicate that structured output shall not be used.\ - \n\ - - specify `enableStreaming: false` to indicate that streaming shall not be used.\ - \n\ - Refer to [our documentation](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) for more information.', + markdownDescription: nls.localize('theia/ai/openai/customEndpoints/mdDescription', + 'Integrate custom models compatible with the OpenAI API, for example via `vllm`. The required attributes are `model` and `url`.\ +\n\ +Optionally, you can\ +\n\ +- specify a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`.\ +\n\ +- provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global OpenAI API key.\ +\n\ +- provide an `apiVersion` to access the API served at the given url in Azure. Use `true` to indicate the use of the global OpenAI API version.\ +\n\ +- specify `supportsDeveloperMessage: false` to indicate that the developer role shall not be used.\ +\n\ +- specify `supportsStructuredOutput: false` to indicate that structured output shall not be used.\ +\n\ +- specify `enableStreaming: false` to indicate that streaming shall not be used.\ +\n\ +Refer to [our documentation](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) for more information.'), default: [], items: { type: 'object', properties: { model: { type: 'string', - title: 'Model ID' + title: nls.localize('theia/ai/openai/customEndpoints/modelId/title', 'Model ID') }, url: { type: 'string', - title: 'The Open AI API compatible endpoint where the model is hosted' + title: nls.localize('theia/ai/openai/customEndpoints/url/title', 'The Open AI API compatible endpoint where the model is hosted') }, id: { type: 'string', - title: 'A unique identifier which is used in the UI to identify the custom model', + title: nls.localize('theia/ai/openai/customEndpoints/id/title', 'A unique identifier which is used in the UI to identify the custom model'), }, apiKey: { type: ['string', 'boolean'], - title: 'Either the key to access the API served at the given url or `true` to use the global OpenAI API key', + title: nls.localize('theia/ai/openai/customEndpoints/apiKey/title', + 'Either the key to access the API served at the given url or `true` to use the global OpenAI API key'), }, apiVersion: { type: ['string', 'boolean'], - title: 'Either the version to access the API served at the given url in Azure or `true` to use the global OpenAI API version', + title: nls.localize('theia/ai/openai/customEndpoints/apiVersion/title', + 'Either the version to access the API served at the given url in Azure or `true` to use the global OpenAI API version'), }, supportsDeveloperMessage: { type: 'boolean', - title: 'Indicates whether the model supports the `developer` role. `true` by default.', + title: nls.localize('theia/ai/openai/customEndpoints/supportsDevMessage/title', + 'Indicates whether the model supports the `developer` role. `true` by default.'), }, supportsStructuredOutput: { type: 'boolean', - title: 'Indicates whether the model supports structured output. `true` by default.', + title: nls.localize('theia/ai/openai/customEndpoints/supportsStructuredOutput/title', + 'Indicates whether the model supports structured output. `true` by default.'), }, enableStreaming: { type: 'boolean', - title: 'Indicates whether the streaming API shall be used. `true` by default.', + title: nls.localize('theia/ai/openai/customEndpoints/enableStreaming/title', + 'Indicates whether the streaming API shall be used. `true` by default.'), } } } diff --git a/packages/ai-scanoss/src/browser/ai-scanoss-preferences.ts b/packages/ai-scanoss/src/browser/ai-scanoss-preferences.ts index def42c0f2350a..c1850c9822224 100644 --- a/packages/ai-scanoss/src/browser/ai-scanoss-preferences.ts +++ b/packages/ai-scanoss/src/browser/ai-scanoss-preferences.ts @@ -16,6 +16,7 @@ import { PreferenceSchema } from '@theia/core/lib/browser/preferences'; import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences'; +import { nls } from '@theia/core'; export const SCANOSS_MODE_PREF = 'ai-features.SCANOSS.mode'; @@ -26,12 +27,13 @@ export const AIScanOSSPreferencesSchema: PreferenceSchema = { type: 'string', enum: ['off', 'manual', 'automatic'], markdownEnumDescriptions: [ - 'Feature is turned off completely.', - 'User can manually trigger the scan by clicking the SCANOSS item in the chat view.', - 'Enable automatic scan of code snippets in chat views.' + nls.localize('theia/ai/scanoss/mode/off/description', 'Feature is turned off completely.'), + nls.localize('theia/ai/scanoss/mode/manual/description', 'User can manually trigger the scan by clicking the SCANOSS item in the chat view.'), + nls.localize('theia/ai/scanoss/mode/automatic/description', 'Enable automatic scan of code snippets in chat views.') ], - markdownDescription: 'Configure the SCANOSS feature for analyzing code snippets in chat views. This will send a hash of suggested code snippets to the SCANOSS\n\ - service hosted by the [Software Transparency foundation](https://www.softwaretransparency.org/osskb) for analysis.', + markdownDescription: nls.localize('theia/ai/scanoss/mode/description', + 'Configure the SCANOSS feature for analyzing code snippets in chat views. This will send a hash of suggested code snippets to the SCANOSS\n\ +service hosted by the [Software Transparency foundation](https://www.softwaretransparency.org/osskb) for analysis.'), default: 'off', title: AI_CORE_PREFERENCES_TITLE } diff --git a/packages/ai-terminal/src/browser/ai-terminal-agent.ts b/packages/ai-terminal/src/browser/ai-terminal-agent.ts index cdb6b8a916e19..9496d901a7860 100644 --- a/packages/ai-terminal/src/browser/ai-terminal-agent.ts +++ b/packages/ai-terminal/src/browser/ai-terminal-agent.ts @@ -22,7 +22,7 @@ import { LanguageModelRegistry, LanguageModelRequirement, PromptService } from '@theia/ai-core/lib/common'; -import { generateUuid, ILogger } from '@theia/core'; +import { generateUuid, ILogger, nls } from '@theia/core'; import { inject, injectable } from '@theia/core/shared/inversify'; import { z } from 'zod'; import zodToJsonSchema from 'zod-to-json-schema'; @@ -39,9 +39,9 @@ export class AiTerminalAgent implements Agent { id = 'Terminal Assistant'; name = 'Terminal Assistant'; - description = 'This agent provides assistance to write and execute arbitrary terminal commands. \ + description = nls.localize('theia/ai/terminal/agent/description', 'This agent provides assistance to write and execute arbitrary terminal commands. \ Based on the user\'s request, it suggests commands and allows the user to directly paste and execute them in the terminal. \ - It accesses the current directory, environment and the recent terminal output of the terminal session to provide context-aware assistance'; + It accesses the current directory, environment and the recent terminal output of the terminal session to provide context-aware assistance'); variables = []; functions = []; agentSpecificVariables = [ @@ -54,7 +54,7 @@ export class AiTerminalAgent implements Agent { { id: 'terminal-system', name: 'AI Terminal System Prompt', - description: 'Prompt for the AI Terminal Assistant', + description: nls.localize('theia/ai/terminal/systemPrompt/description', 'Prompt for the AI Terminal Assistant'), template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} # Instructions @@ -102,7 +102,7 @@ nothing to commit, working tree clean { id: 'terminal-user', name: 'AI Terminal User Prompt', - description: 'Prompt that contains the user request', + description: nls.localize('theia/ai/terminal/userPrompt/description', 'Prompt that contains the user request'), template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here: https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}} user-request: {{userRequest}}