mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
Merge pull request #6427 from Kilo-Org/feat/autocomplete-add-orgs
Pass orgId to Autocomplete requests
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// kilocode_change - Kilo Gateway server routes
|
||||
/**
|
||||
* Kilo Gateway specific routes
|
||||
* Handles profile fetching and organization management for Kilo Gateway provider
|
||||
@@ -8,10 +7,10 @@
|
||||
|
||||
import { fetchProfile, fetchBalance } from "../api/profile.js"
|
||||
import { fetchKilocodeNotifications, KilocodeNotificationSchema } from "../api/notifications.js"
|
||||
import { KILO_API_BASE, HEADER_FEATURE } from "../api/constants.js" // kilocode_change - added HEADER_FEATURE
|
||||
import { buildKiloHeaders } from "../headers.js" // kilocode_change
|
||||
import type { ImportDeps, DrizzleDb } from "../cloud-sessions.js" // kilocode_change
|
||||
import { fetchCloudSession, fetchCloudSessionForImport, importSessionToDb } from "../cloud-sessions.js" // kilocode_change
|
||||
import { KILO_API_BASE, HEADER_FEATURE } from "../api/constants.js"
|
||||
import { buildKiloHeaders } from "../headers.js"
|
||||
import type { ImportDeps, DrizzleDb } from "../cloud-sessions.js"
|
||||
import { fetchCloudSession, fetchCloudSessionForImport, importSessionToDb } from "../cloud-sessions.js"
|
||||
|
||||
// Type definitions for OpenCode dependencies (injected at runtime)
|
||||
type Hono = any
|
||||
@@ -223,6 +222,8 @@ export function createKiloRoutes(deps: KiloRoutesDeps) {
|
||||
return c.json({ error: "No valid token found" }, 401)
|
||||
}
|
||||
|
||||
const organizationId = auth.type === "oauth" ? auth.accountId : undefined
|
||||
|
||||
const { prefix, suffix, model, maxTokens, temperature } = c.req.valid("json")
|
||||
const fimModel = model ?? "mistralai/codestral-2501"
|
||||
const fimMaxTokens = maxTokens ?? 256
|
||||
@@ -231,16 +232,16 @@ export function createKiloRoutes(deps: KiloRoutesDeps) {
|
||||
const baseApiUrl = KILO_API_BASE + "/api/"
|
||||
const endpoint = new URL("fim/completions", baseApiUrl)
|
||||
|
||||
const response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
// kilocode_change start - include kilo headers with autocomplete feature override
|
||||
...buildKiloHeaders(),
|
||||
...buildKiloHeaders(undefined, { kilocodeOrganizationId: organizationId }),
|
||||
[HEADER_FEATURE]: "autocomplete",
|
||||
// kilocode_change end
|
||||
},
|
||||
}
|
||||
|
||||
const response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({
|
||||
model: fimModel,
|
||||
prompt: prefix,
|
||||
|
||||
Reference in New Issue
Block a user