Skip to content

Commit aecebd2

Browse files
committed
Internalize request id generation and make api key required in send llm message
- set request_id in api manager, not `apps/editor/src/views/panel/backend/message-handlers/handle-make-api-call.ts`
1 parent d17d21e commit aecebd2

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

‎apps/editor/src/services/api-manager.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ export class ApiManager {
2626

2727
public async send_llm_message(params: {
2828
base_url: string
29-
api_key?: string
29+
api_key: string
3030
body: any
31-
request_id?: string
3231
provider_name: string
3332
model?: string
3433
reasoning_effort?: string
3534
}): Promise<{ response: string; thoughts?: string } | null> {
36-
const request_id = params.request_id || randomUUID()
35+
const request_id = randomUUID()
3736
const abort_controller = new AbortController()
3837
this.abort_controllers.set(request_id, abort_controller)
3938

‎apps/editor/src/views/panel/backend/message-handlers/handle-make-api-call.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
map_api_configuration_to_item
3434
} from '@/utils/show-configuration-quick-pick'
3535
import { PromptBuilder } from '@/utils/prompt-builder'
36-
import { randomUUID } from 'crypto'
3736
import { ApiPromptType } from '@shared/types/prompt-types'
3837
import {
3938
EDIT_FORMAT_INSTRUCTIONS_DIFF,
@@ -417,7 +416,6 @@ export const handle_make_api_call = async (
417416

418417
const promises = Array.from({ length: message.invocation_count }).map(
419418
async () => {
420-
const request_id = randomUUID()
421419
const body: { [key: string]: any } = {
422420
messages,
423421
model: api_configuration.model,
@@ -436,7 +434,6 @@ export const handle_make_api_call = async (
436434
base_url: model_provider.base_url,
437435
api_key: model_provider.api_key,
438436
body,
439-
request_id,
440437
provider_name: api_configuration.model_provider_name,
441438
model: api_configuration.model,
442439
reasoning_effort: api_configuration.reasoning_effort

0 commit comments

Comments
 (0)