Skip to content

Commit d436c90

Browse files
authored
feat(completion): add client ID header to API requests (#570)
1 parent 5cec271 commit d436c90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/costrict/completion/CompletionClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,20 +246,21 @@ export class CompletionClient {
246246

247247
const abortController = new AbortController()
248248
this.reqs.set(cp.id, abortController)
249+
// machineId
250+
const client_id = getClientId()
249251

250252
Logger.log(`Completion [${cp.id}]: Sending API request`)
251253
const headers = {
252254
...COSTRICT_DEFAULT_HEADERS,
253255
"X-Request-ID": uuidv7(),
256+
"zgsm-client-id": client_id,
254257
}
255258
const repo = workspace?.name?.split(" ")[0] ?? ""
256259

257260
const config = await this.getApiConfig(apiConfiguration)
258261

259262
this.openai.baseURL = `${config.baseUrl}${config.completionUrl}`
260263
this.openai.apiKey = config.apiKey
261-
// machineId
262-
const client_id = getClientId()
263264
// project_dir
264265
let workspaceFolder = ""
265266
if (vscode.workspace.workspaceFolders) {

0 commit comments

Comments
 (0)