Skip to content

Commit

Permalink
Refine AI settings (#14202)
Browse files Browse the repository at this point in the history
* Refine AI settings

fixed #14201

Signed-off-by: Jonas Helming <[email protected]>
  • Loading branch information
JonasHelming authored Sep 19, 2024
1 parent 5de5772 commit 5312708
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions packages/ai-chat/src/browser/ai-chat-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences';
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';

export const DEFAULT_CHAT_AGENT_PREF = 'ai-features.chat.default-chat-agent';
export const DEFAULT_CHAT_AGENT_PREF = 'ai-features.chat.defaultChatAgent';

export const aiChatPreferences: PreferenceSchema = {
type: 'object',
properties: {
[DEFAULT_CHAT_AGENT_PREF]: {
type: 'string',
description: '<agent-name> of the Chat Agent that shall be invoked, if no agent is explicitly mentioned with @<agent-name> in the user query.',
description: 'Optional: <agent-name> of the Chat Agent that shall be invoked, if no agent is explicitly mentioned with @<agent-name> in the user query.\
If no Default Agent is configured, Theia´s defaults will be applied.',
title: AI_CORE_PREFERENCES_TITLE,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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';

export const PREF_AI_INLINE_COMPLETION_ENABLE = 'ai-features.code-completion-inline.enable';
export const PREF_AI_INLINE_COMPLETION_ENABLE = 'ai-features.codeCompletion.enableCodeCompletion';

export const AICodeCompletionPreferencesSchema: PreferenceSchema = {
type: 'object',
Expand Down
7 changes: 4 additions & 3 deletions packages/ai-core/src/browser/ai-core-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { PreferenceProxyFactory } from '@theia/core/lib/browser/preferences/inje
import { interfaces } from '@theia/core/shared/inversify';

export const AI_CORE_PREFERENCES_TITLE = '✨ AI Features [Experimental]';
export const PREFERENCE_NAME_ENABLE_EXPERIMENTAL = 'ai-features.ai-enable.enable';
export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.templates.templates-folder';
export const PREFERENCE_NAME_ENABLE_EXPERIMENTAL = 'ai-features.AiEnable.enableAI';
export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder';

export const aiCorePreferenceSchema: PreferenceSchema = {
type: 'object',
Expand All @@ -42,7 +42,8 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
},
[PREFERENCE_NAME_PROMPT_TEMPLATES]: {
title: AI_CORE_PREFERENCES_TITLE,
description: 'Folder for managing custom prompt templates. If not customized the user config directory is used.',
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: {
Expand Down
5 changes: 2 additions & 3 deletions packages/ai-ollama/src/browser/ollama-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences';

export const HOST_PREF = 'ai-features.ollama.host';
export const MODELS_PREF = 'ai-features.ollama.models';
export const HOST_PREF = 'ai-features.ollama.ollamaHost';
export const MODELS_PREF = 'ai-features.ollama.ollamaModels';

export const OllamaPreferencesSchema: PreferenceSchema = {
type: 'object',
properties: {
[HOST_PREF]: {
type: 'string',
title: AI_CORE_PREFERENCES_TITLE,
description: 'Ollama Host',
default: 'http://localhost:11434'
},
[MODELS_PREF]: {
Expand Down
12 changes: 6 additions & 6 deletions packages/ai-openai/src/browser/openai-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences';

export const API_KEY_PREF = 'ai-features.openai.api-key';
export const MODELS_PREF = 'ai-features.openai.models';
export const CUSTOM_ENDPOINTS_PREF = 'ai-features.openai.models-custom';
export const API_KEY_PREF = 'ai-features.openAiOfficial.openAiApiKey';
export const MODELS_PREF = 'ai-features.openAiOfficial.officialOpenAiModels';
export const CUSTOM_ENDPOINTS_PREF = 'ai-features.openAiCustom.customOpenAiModels';

export const OpenAiPreferencesSchema: PreferenceSchema = {
type: 'object',
properties: {
[API_KEY_PREF]: {
type: 'string',
markdownDescription: '**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: '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]: {
Expand All @@ -43,7 +43,7 @@ export const OpenAiPreferencesSchema: PreferenceSchema = {
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`.\
Optionally, you can provide a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`',
Optionally, you can provide a unique `id` to identify the custom model in the UI. If none is given `model` will be used as `id`.',
default: [],
items: {
type: 'object',
Expand Down

0 comments on commit 5312708

Please sign in to comment.