diff --git a/src/vs/platform/void/common/refreshModelService.ts b/src/vs/platform/void/common/refreshModelService.ts index 69a1c102..39d243b5 100644 --- a/src/vs/platform/void/common/refreshModelService.ts +++ b/src/vs/platform/void/common/refreshModelService.ts @@ -36,7 +36,7 @@ const refreshBasedOn: { [k in RefreshableProviderName]: (keyof SettingsOfProvide openAICompatible: ['enabled', 'endpoint', 'apiKey'], } const REFRESH_INTERVAL = 5_000 -const COOLDOWN_TIMEOUT = 300 +// const COOLDOWN_TIMEOUT = 300 // element-wise equals function eq(a: T[], b: T[]): boolean { @@ -92,18 +92,23 @@ export class RefreshModelService extends Disposable implements IRefreshModelServ this.voidSettingsService.onDidChangeState(() => { // we might want to debounce this const newVals = relevantVals() if (!eq(prevVals, newVals)) { - prevVals = newVals - const { enabled } = this.voidSettingsService.state.settingsOfProvider[providerName] - if (enabled) { + const prevEnabled = prevVals[0] as boolean + const enabled = newVals[0] as boolean + + // if it was just enabled, or there was a change and it wasn't to the enabled state, refresh + if ((enabled && !prevEnabled) || (!enabled && !prevEnabled)) { // if user just clicked enable, refresh this.refreshModels(providerName, !enabled) } else { - // else if user just clicked disable, give cooldown before re-enabling (or at least re-fetching) - const timeoutId = setTimeout(() => this.refreshModels(providerName, !enabled), COOLDOWN_TIMEOUT) - this._setTimeoutId(providerName, timeoutId) + // else if user just clicked disable, don't refresh + + // //give cooldown before re-enabling (or at least re-fetching) + // const timeoutId = setTimeout(() => this.refreshModels(providerName, !enabled), COOLDOWN_TIMEOUT) + // this._setTimeoutId(providerName, timeoutId) } + prevVals = newVals } }) ) diff --git a/src/vs/platform/void/common/voidSettingsTypes.ts b/src/vs/platform/void/common/voidSettingsTypes.ts index a02d27fb..1b1b2ff7 100644 --- a/src/vs/platform/void/common/voidSettingsTypes.ts +++ b/src/vs/platform/void/common/voidSettingsTypes.ts @@ -155,22 +155,47 @@ export type SettingName = keyof SettingsForProvider +type DisplayInfoForProviderName = { + title: string, +} -export const titleOfProviderName = (providerName: ProviderName) => { - if (providerName === 'anthropic') - return 'Anthropic' - else if (providerName === 'openAI') - return 'OpenAI' - else if (providerName === 'ollama') - return 'Ollama' - else if (providerName === 'openRouter') - return 'OpenRouter' - else if (providerName === 'openAICompatible') - return 'OpenAI-Compatible' - else if (providerName === 'gemini') - return 'Gemini' - else if (providerName === 'groq') - return 'Groq' +export const displayInfoOfProviderName = (providerName: ProviderName): DisplayInfoForProviderName => { + if (providerName === 'anthropic') { + return { + title: 'Anthropic', + } + } + else if (providerName === 'openAI') { + return { + title: 'OpenAI', + } + } + else if (providerName === 'openRouter') { + return { + title: 'OpenRouter', + } + } + else if (providerName === 'ollama') { + return { + title: 'Ollama', + + } + } + else if (providerName === 'openAICompatible') { + return { + title: 'OpenAI-Compatible', + } + } + else if (providerName === 'gemini') { + return { + title: 'Gemini', + } + } + else if (providerName === 'groq') { + return { + title: 'Groq', + } + } throw new Error(`descOfProviderName: Unknown provider name: "${providerName}"`) } @@ -178,9 +203,7 @@ export const titleOfProviderName = (providerName: ProviderName) => { type DisplayInfo = { title: string, placeholder: string, - - helpfulUrl?: string, - urlPurpose?: string, + subTextMd?: string, } export const displayInfoOfSettingName = (providerName: ProviderName, settingName: SettingName): DisplayInfo => { if (settingName === 'apiKey') { @@ -194,15 +217,13 @@ export const displayInfoOfSettingName = (providerName: ProviderName, settingName providerName === 'openAICompatible' ? 'sk-key...' : '(never)', - helpfulUrl: providerName === 'anthropic' ? 'https://console.anthropic.com/settings/keys' : - providerName === 'openAI' ? 'https://platform.openai.com/api-keys' : - providerName === 'openRouter' ? 'https://openrouter.ai/settings/keys' : - providerName === 'gemini' ? 'https://aistudio.google.com/apikey' : - providerName === 'groq' ? 'https://console.groq.com/keys' : + subTextMd: providerName === 'anthropic' ? 'Get your [API Key here](https://console.anthropic.com/settings/keys).' : + providerName === 'openAI' ? 'Get your [API Key here](https://platform.openai.com/api-keys).' : + providerName === 'openRouter' ? 'Get your [API Key here](https://openrouter.ai/settings/keys).' : + providerName === 'gemini' ? 'Get your [API Key here](https://aistudio.google.com/apikey).' : + providerName === 'groq' ? 'Get your [API Key here](https://console.groq.com/keys).' : providerName === 'openAICompatible' ? undefined : undefined, - - urlPurpose: 'to get your API key.', } } else if (settingName === 'endpoint') { @@ -215,11 +236,8 @@ export const displayInfoOfSettingName = (providerName: ProviderName, settingName : providerName === 'openAICompatible' ? 'https://my-website.com/v1' : '(never)', - helpfulUrl: providerName === 'ollama' ? 'https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-expose-ollama-on-my-network' - : providerName === 'openAICompatible' ? undefined - : undefined, - - urlPurpose: 'for more information.', + subTextMd: providerName === 'ollama' ? 'Read about Ollama [Endpoints here](https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-expose-ollama-on-my-network).' : + undefined, } } else if (settingName === 'enabled') { diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx index 0977a18a..c1750d81 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx @@ -169,7 +169,7 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested? if (t.type === "link") { return ( - + { window.open(t.href) }} href={t.href} title={t.title ?? undefined}> {t.text} ) diff --git a/src/vs/workbench/contrib/void/browser/react/src/styles.css b/src/vs/workbench/contrib/void/browser/react/src/styles.css index ad8b42e3..31742153 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/styles.css +++ b/src/vs/workbench/contrib/void/browser/react/src/styles.css @@ -8,12 +8,10 @@ @tailwind utilities; -@layer components { - .select-ellipsis select { - text-overflow: ellipsis; - white-space: nowrap; - padding-right: 24px; - } +.select-child-restyle select { + text-overflow: ellipsis; + white-space: nowrap; + padding-right: 24px; } * { @@ -22,6 +20,7 @@ + /* html { font-size: var(--vscode-font-size); } diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index 3aba6510..6cfcf9a5 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -194,7 +194,7 @@ export const VoidSelectBox = ({ onChangeSelection, onCreateInstance, selectB let containerRef = useRef(null); return { containerRef.current = container diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index 56493127..cc00422e 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -1,10 +1,11 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js' -import { ProviderName, SettingName, displayInfoOfSettingName, titleOfProviderName, providerNames, VoidModelInfo, featureFlagNames, displayInfoOfFeatureFlag, customSettingNamesOfProvider, RefreshableProviderName, refreshableProviderNames } from '../../../../../../../platform/void/common/voidSettingsTypes.js' +import { ProviderName, SettingName, displayInfoOfSettingName, providerNames, VoidModelInfo, featureFlagNames, displayInfoOfFeatureFlag, customSettingNamesOfProvider, RefreshableProviderName, refreshableProviderNames, displayInfoOfProviderName } from '../../../../../../../platform/void/common/voidSettingsTypes.js' import ErrorBoundary from '../sidebar-tsx/ErrorBoundary.js' import { VoidCheckBox, VoidInputBox, VoidSelectBox, VoidSwitch } from '../util/inputs.js' import { useIsDark, useRefreshModelListener, useRefreshModelState, useService, useSettingsState } from '../util/services.js' import { X, RefreshCw, Loader2, Check } from 'lucide-react' +import { ChatMarkdownRender } from '../markdown/ChatMarkdownRender.js' @@ -30,12 +31,14 @@ const RefreshModelButton = ({ providerName }: { providerName: RefreshableProvide const { state } = refreshModelState[providerName] const isRefreshing = state === 'refreshing' - const providerTitle = titleOfProviderName(providerName) + const { title: providerTitle } = displayInfoOfProviderName(providerName) return
- Refresh Default Models for {providerTitle}. + { + justFinished ? `${providerTitle} Models are up-to-date!` : `Refresh Models List for ${providerTitle}.` + }
} @@ -65,7 +68,8 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => { const [errorString, setErrorString] = useState('') - const providerOptions = useMemo(() => providerNames.map(providerName => ({ text: titleOfProviderName(providerName), value: providerName })), [providerNames]) + + const providerOptions = useMemo(() => providerNames.map(providerName => ({ text: displayInfoOfProviderName(providerName).title, value: providerName })), [providerNames]) return <>
@@ -129,7 +133,7 @@ const AddModelMenu = ({ onSubmit }: { onSubmit: () => void }) => { const AddModelMenuFull = () => { const [open, setOpen] = useState(false) - return
+ return
{open ? { setOpen(false) }} /> :