Skip to content

make it possible to configurate the kilo backend to test the backend #1258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"preLaunchTask": "${defaultBuildTask}",
"env": {
"NODE_ENV": "development",
"VSCODE_DEBUG_MODE": "true"
"VSCODE_DEBUG_MODE": "true",
"KILOCODE_BASE_URL": "http://localhost:3000"
},
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
"presentation": {
Expand All @@ -43,7 +44,11 @@
"VSCODE_DEBUG_MODE": "true"
},
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
"presentation": { "hidden": false, "group": "tasks", "order": 1 }
"presentation": {
"hidden": false,
"group": "tasks",
"order": 1
}
}
]
}
2 changes: 2 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ export class ClineProvider
window.IMAGES_BASE_URI = "${imagesUri}"
window.AUDIO_BASE_URI = "${audioUri}"
window.MATERIAL_ICONS_BASE_URI = "${materialIconsUri}"
window.KILOCODE_BASE_URL = ${process.env.KILOCODE_BASE_URL ? `"${process.env.KILOCODE_BASE_URL}"` : "undefined"}
</script>
<title>Kilo Code</title>
</head>
Expand Down Expand Up @@ -776,6 +777,7 @@ export class ClineProvider
window.IMAGES_BASE_URI = "${imagesUri}"
window.AUDIO_BASE_URI = "${audioUri}"
window.MATERIAL_ICONS_BASE_URI = "${materialIconsUri}"
window.KILOCODE_BASE_URL = ${process.env.KILOCODE_BASE_URL ? `"${process.env.KILOCODE_BASE_URL}"` : "undefined"}
</script>
<title>Kilo Code</title>
</head>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/kilocode/api.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const getKiloCodeApiUrl = () => "https://kilocode.ai"
export const getKiloCodeApiUrl = () => process.env.KILOCODE_BASE_URL ?? "https://kilocode.ai"
11 changes: 9 additions & 2 deletions webview-ui/src/components/kilocode/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// Declare the window property to avoid TypeScript errors
declare global {
interface Window {
KILOCODE_BASE_URL?: string
}
}

export function getKiloCodeBackendSignInUrl(uriScheme: string = "vscode", uiKind: string = "Desktop") {
const baseUrl = "https://kilocode.ai"
const baseUrl = window.KILOCODE_BASE_URL || "https://kilocode.ai"
const source = uiKind === "Web" ? "web" : uriScheme
return `${baseUrl}/sign-in-to-editor?source=${source}`
}

export function getKiloCodeBackendSignUpUrl(uriScheme: string = "vscode", uiKind: string = "Desktop") {
const baseUrl = "https://kilocode.ai"
const baseUrl = window.KILOCODE_BASE_URL || "https://kilocode.ai"
const source = uiKind === "Web" ? "web" : uriScheme
return `${baseUrl}/users/sign_up?source=${source}`
}
3 changes: 3 additions & 0 deletions webview-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export default defineConfig(({ mode }) => {
"process.env.PKG_NAME": JSON.stringify(pkg.name),
"process.env.PKG_VERSION": JSON.stringify(pkg.version),
"process.env.PKG_OUTPUT_CHANNEL": JSON.stringify("Kilo-Code"),
"process.env.KILOCODE_BASE_URL": process.env.KILOCODE_BASE_URL
? JSON.stringify(process.env.KILOCODE_BASE_URL)
: undefined,
...(gitSha ? { "process.env.PKG_SHA": JSON.stringify(gitSha) } : {}),
}

Expand Down