diff --git a/openai/api.w b/openai/api.w new file mode 100644 index 00000000..9ea0c07e --- /dev/null +++ b/openai/api.w @@ -0,0 +1,9 @@ +pub struct CompletionParams { + model: str; + max_tokens: num; +} + +// TODO: need to recreate the openai interface with higher fidelity +pub interface IOpenAI { + inflight createCompletion(prompt: str, params: CompletionParams?): str; +} diff --git a/openai/openai.w b/openai/openai.w index 88f0582c..b2ad590a 100644 --- a/openai/openai.w +++ b/openai/openai.w @@ -80,4 +80,4 @@ pub class OpenAI { } extern "./openai.js" pub static inflight createNewInflightClient(apiKey: str, org: str?): IClient; -} \ No newline at end of file +} diff --git a/openai/utils.w b/openai/utils.w new file mode 100644 index 00000000..1f080534 --- /dev/null +++ b/openai/utils.w @@ -0,0 +1,5 @@ +bring "./api.w" as api; + +pub class Util { + extern "./openai.js" pub static inflight createNewInflightClient(apiKey: str, org: str?): api.IOpenAI; +} \ No newline at end of file diff --git a/vite/package.json b/vite/package.json index 859ef9e5..de901866 100644 --- a/vite/package.json +++ b/vite/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/vite", - "version": "0.1.2", + "version": "0.1.3", "description": "Wing resource that allows deploying a Vite application to the cloud", "repository": { "type": "git", diff --git a/vite/vite-plugin.mjs b/vite/vite-plugin.mjs index bed67b45..0ac69a72 100644 --- a/vite/vite-plugin.mjs +++ b/vite/vite-plugin.mjs @@ -1,5 +1,6 @@ import { mkdir, writeFile } from "node:fs/promises"; import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; const PLUGIN_NAME = "@winglibs/vite"; @@ -74,7 +75,8 @@ export const plugin = (options) => { ); const dtsFilename = new URL(options.typeDefinitionsFilename, root); - await mkdir(dirname(dtsFilename.pathname), { recursive: true }); + let path = dirname(fileURLToPath(dtsFilename)); + await mkdir(path, { recursive: true }); await writeFile(dtsFilename, dts.join("\n")); }, }; diff --git a/vite/vite.sim.w b/vite/vite.sim.w index f812f763..914e6a1b 100644 --- a/vite/vite.sim.w +++ b/vite/vite.sim.w @@ -17,8 +17,8 @@ pub class Vite_sim { this.url = state.token("url"); let cliFilename = Vite_sim.cliFilename(); - let homeEnv = util.env("HOME"); - let pathEnv = util.env("PATH"); + let homeEnv = util.tryEnv("HOME") ?? ""; + let pathEnv = util.tryEnv("PATH") ?? ""; let openBrowser = util.env("WING_IS_TEST") != "true"; new cloud.Service(inflight () => {