@langgraph-js/ui 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.langgraph_api/trace.db +0 -0
- package/package.json +1 -1
- package/vite.config.ts +28 -29
- package/.langgraph_api/trace.db-shm +0 -0
- package/.langgraph_api/trace.db-wal +0 -0
package/.langgraph_api/trace.db
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -2,42 +2,41 @@ import react from "@vitejs/plugin-react";
|
|
|
2
2
|
import { defineConfig, Plugin } from "vite";
|
|
3
3
|
import basicSsl from "@vitejs/plugin-basic-ssl";
|
|
4
4
|
import tailwindcss from "@tailwindcss/vite";
|
|
5
|
-
import { app } from "@langgraph-js/open-smith/dist/app.js";
|
|
6
5
|
import { Readable } from "stream";
|
|
7
6
|
const OpenSmithPlugin = () =>
|
|
8
7
|
({
|
|
9
8
|
name: "open-smith",
|
|
10
9
|
configureServer(server) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
server.middlewares.use("/api/open-smith", async (req, res, next) => {
|
|
11
|
+
const { app } = await import("@langgraph-js/open-smith/dist/app.js");
|
|
12
|
+
try {
|
|
13
|
+
const body = Readable.toWeb(req);
|
|
14
|
+
// Build a compatible Request for Fetch API
|
|
15
|
+
const url = `http://localhost${req.url}`;
|
|
16
|
+
const fetchRequest = new Request(url, {
|
|
17
|
+
method: req.method,
|
|
18
|
+
headers: req.headers as any,
|
|
19
|
+
body: req.method && !["GET", "HEAD"].includes(req.method.toUpperCase()) && body ? body : undefined,
|
|
20
|
+
...(req.method && !["GET", "HEAD"].includes(req.method.toUpperCase()) && body ? { duplex: "half" as const } : {}),
|
|
21
|
+
});
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// Proxy the request to app.basePath handler
|
|
24
|
+
const response = await app.basePath("/api/open-smith").fetch(fetchRequest);
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Send the response body
|
|
35
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
36
|
-
res.end(Buffer.from(arrayBuffer));
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.log(error);
|
|
26
|
+
// Set status and headers
|
|
27
|
+
res.statusCode = response.status;
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
for (const [key, value] of response.headers.entries()) {
|
|
30
|
+
res.setHeader(key, value);
|
|
39
31
|
}
|
|
40
|
-
|
|
32
|
+
|
|
33
|
+
// Send the response body
|
|
34
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
35
|
+
res.end(Buffer.from(arrayBuffer));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.log(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
41
40
|
},
|
|
42
41
|
}) as Plugin;
|
|
43
42
|
|
|
@@ -45,7 +44,7 @@ const OpenSmithPlugin = () =>
|
|
|
45
44
|
export default defineConfig(({ mode }) => {
|
|
46
45
|
const isHttps = mode === "https";
|
|
47
46
|
return {
|
|
48
|
-
plugins: [react(), tailwindcss(), isHttps ? basicSsl() : undefined, OpenSmithPlugin()],
|
|
47
|
+
plugins: [react(), tailwindcss(), isHttps ? basicSsl() : undefined, process.env.NODE_ENV === "development" && OpenSmithPlugin()],
|
|
49
48
|
resolve: {
|
|
50
49
|
alias: {
|
|
51
50
|
"@langgraph-js/sdk": new URL("../langgraph-client/src", import.meta.url).pathname,
|
|
Binary file
|
|
Binary file
|