forked from ericc-ch/copilot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
26 lines (19 loc) · 696 Bytes
/
utils.ts
File metadata and controls
26 lines (19 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import consola from "consola"
import { getModels } from "~/services/copilot/get-models"
import { getVSCodeVersion } from "~/services/get-vscode-version"
import { state } from "./state"
export const sleep = (ms: number) =>
new Promise((resolve) => {
setTimeout(resolve, ms)
})
export const isNullish = (value: unknown): value is null | undefined =>
value === null || value === undefined
export async function cacheModels(): Promise<void> {
const models = await getModels()
state.models = models
}
export const cacheVSCodeVersion = async () => {
const response = await getVSCodeVersion()
state.vsCodeVersion = response
consola.info(`Using VSCode version: ${response}`)
}