Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into openai
Browse files Browse the repository at this point in the history
  • Loading branch information
eladb committed Mar 19, 2024
2 parents de79e2d + 568595a commit 11f222a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
9 changes: 9 additions & 0 deletions openai/api.w
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion openai/openai.w
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ pub class OpenAI {
}

extern "./openai.js" pub static inflight createNewInflightClient(apiKey: str, org: str?): IClient;
}
}
5 changes: 5 additions & 0 deletions openai/utils.w
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion vite/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion vite/vite-plugin.mjs
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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"));
},
};
Expand Down
4 changes: 2 additions & 2 deletions vite/vite.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 11f222a

Please sign in to comment.