Skip to content

Commit e10eb0a

Browse files
committed
fix: address PR review feedback
- Add double-prefix guard to OpenAI embedder to prevent duplicate query prefixes - Update Advanced Configuration UI to match ModesView.tsx style with proper hover effects and aria attributes
1 parent 8419ecc commit e10eb0a

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

src/services/code-index/embedders/openai.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export class OpenAiEmbedder extends OpenAiNativeHandler implements IEmbedder {
4242
const queryPrefix = getModelQueryPrefix("openai", modelToUse)
4343
const processedTexts = queryPrefix
4444
? texts.map((text, index) => {
45+
// Prevent double-prefixing
46+
if (text.startsWith(queryPrefix)) {
47+
return text
48+
}
4549
const prefixedText = `${queryPrefix}${text}`
4650
const estimatedTokens = Math.ceil(prefixedText.length / 4)
4751
if (estimatedTokens > MAX_ITEM_TOKENS) {

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

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -505,27 +505,18 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
505505
</div>
506506

507507
{/* Advanced Configuration Section */}
508-
<div className="mt-6 pt-4 border-t border-vscode-widget-border">
508+
<div className="mt-4">
509509
<button
510-
className="flex items-center justify-between w-full text-left group hover:bg-vscode-list-hoverBackground rounded p-2 -m-2"
511510
onClick={() => setAdvancedExpanded(!advancedExpanded)}
512-
aria-expanded={advancedExpanded}
513-
aria-controls="advanced-config-section">
514-
<div className="flex items-center gap-2 font-bold">
515-
<div>{t("settings:codeIndex.advancedConfigLabel")}</div>
516-
</div>
517-
<svg
518-
className={`w-4 h-4 text-vscode-foreground transition-transform duration-200 ${
519-
advancedExpanded ? "rotate-90" : ""
520-
}`}
521-
fill="none"
522-
stroke="currentColor"
523-
viewBox="0 0 24 24">
524-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
525-
</svg>
511+
className="flex items-center text-xs text-vscode-foreground hover:text-vscode-textLink-foreground focus:outline-none"
512+
aria-expanded={advancedExpanded}>
513+
<span
514+
className={`codicon codicon-${advancedExpanded ? "chevron-down" : "chevron-right"} mr-1`}></span>
515+
<span>{t("settings:codeIndex.advancedConfigLabel")}</span>
526516
</button>
517+
527518
{advancedExpanded && (
528-
<div id="advanced-config-section" className="mt-4">
519+
<div className="text-xs text-vscode-descriptionForeground mt-2 ml-5">
529520
<div className="flex flex-col gap-3">
530521
<div>
531522
<span className="block font-medium mb-1">

0 commit comments

Comments
 (0)