Skip to content

Commit f68a349

Browse files
committed
feat: add model dimension input for openai-compatible provider
1 parent ee6e3e4 commit f68a349

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

webview-ui/src/components/settings/CodeIndexSettings.tsx

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -329,38 +329,6 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
329329
}
330330
style={{ width: "100%" }}></VSCodeTextField>
331331
</div>
332-
<div className="flex items-center gap-4 font-bold">
333-
<div>{t("settings:codeIndex.openaiCompatibleModelDimensionLabel")}</div>
334-
</div>
335-
<div>
336-
<VSCodeTextField
337-
type="text"
338-
value={
339-
apiConfiguration.codebaseIndexOpenAiCompatibleModelDimension?.toString() || ""
340-
}
341-
onInput={(e: any) => {
342-
const value = e.target.value
343-
if (value === "") {
344-
setApiConfigurationField(
345-
"codebaseIndexOpenAiCompatibleModelDimension",
346-
undefined,
347-
)
348-
} else {
349-
const parsedValue = parseInt(value, 10)
350-
if (!isNaN(parsedValue)) {
351-
setApiConfigurationField(
352-
"codebaseIndexOpenAiCompatibleModelDimension",
353-
parsedValue,
354-
)
355-
}
356-
}
357-
}}
358-
placeholder={t("settings:codeIndex.openaiCompatibleModelDimensionPlaceholder")}
359-
style={{ width: "100%" }}></VSCodeTextField>
360-
<p className="text-vscode-descriptionForeground text-sm mt-1">
361-
{t("settings:codeIndex.openaiCompatibleModelDimensionDescription")}
362-
</p>
363-
</div>
364332
</div>
365333
)}
366334

@@ -404,6 +372,43 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
404372
</div>
405373
</div>
406374

375+
{codebaseIndexConfig?.codebaseIndexEmbedderProvider === "openai-compatible" && (
376+
<div className="flex flex-col gap-3">
377+
<div className="flex items-center gap-4 font-bold">
378+
<div>{t("settings:codeIndex.openaiCompatibleModelDimensionLabel")}</div>
379+
</div>
380+
<div>
381+
<VSCodeTextField
382+
type="text"
383+
value={
384+
apiConfiguration.codebaseIndexOpenAiCompatibleModelDimension?.toString() || ""
385+
}
386+
onInput={(e: any) => {
387+
const value = e.target.value
388+
if (value === "") {
389+
setApiConfigurationField(
390+
"codebaseIndexOpenAiCompatibleModelDimension",
391+
undefined,
392+
)
393+
} else {
394+
const parsedValue = parseInt(value, 10)
395+
if (!isNaN(parsedValue)) {
396+
setApiConfigurationField(
397+
"codebaseIndexOpenAiCompatibleModelDimension",
398+
parsedValue,
399+
)
400+
}
401+
}
402+
}}
403+
placeholder={t("settings:codeIndex.openaiCompatibleModelDimensionPlaceholder")}
404+
style={{ width: "100%" }}></VSCodeTextField>
405+
<p className="text-vscode-descriptionForeground text-sm mt-1">
406+
{t("settings:codeIndex.openaiCompatibleModelDimensionDescription")}
407+
</p>
408+
</div>
409+
</div>
410+
)}
411+
407412
{codebaseIndexConfig?.codebaseIndexEmbedderProvider === "ollama" && (
408413
<div className="flex flex-col gap-3">
409414
<div className="flex items-center gap-4 font-bold">

0 commit comments

Comments
 (0)