File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
src/services/code-index/embedders
webview-ui/src/components/settings Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,12 @@ export class CodeIndexGeminiEmbedder extends GeminiHandler implements IEmbedder
112112
113113 // Process the current batch if not empty
114114 if ( currentBatch . length > 0 ) {
115- // Add proactive delay for rate limiting, except for the very first batch.
116- if ( ! isFirstBatch ) {
117- console . log ( `Adding proactive delay of ${ GEMINI_RATE_LIMIT_DELAY_MS } ms before Gemini batch` )
118- await new Promise ( ( resolve ) => setTimeout ( resolve , GEMINI_RATE_LIMIT_DELAY_MS ) )
119- }
120- isFirstBatch = false // Set to false after the first potential delay or first run
115+ const delayMs =
116+ this . options . rateLimitSeconds !== undefined
117+ ? this . options . rateLimitSeconds * 1000
118+ : GEMINI_RATE_LIMIT_DELAY_MS
119+ console . log ( `Adding proactive delay of ${ delayMs } ms before Gemini batch` )
120+ await new Promise ( ( resolve ) => setTimeout ( resolve , delayMs ) )
121121
122122 try {
123123 const batchResult = await this . _embedBatchWithRetries ( currentBatch , model , taskType )
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import {
3030} from "@src/components/ui"
3131
3232import { SetCachedStateField } from "./types"
33+ import { RateLimitSecondsControl } from "./RateLimitSecondsControl"
3334
3435interface CodeIndexSettingsProps {
3536 codebaseIndexModels : CodebaseIndexModels | undefined
@@ -401,6 +402,12 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
401402 </ div >
402403 </ div >
403404 </ div >
405+ < div className = "flex flex-col gap-3" >
406+ < RateLimitSecondsControl
407+ value = { apiConfiguration . rateLimitSeconds || 0 }
408+ onChange = { ( value ) => setApiConfigurationField ( "rateLimitSeconds" , value ) }
409+ />
410+ </ div >
404411 </ >
405412 ) }
406413
You can’t perform that action at this time.
0 commit comments