diff --git a/data/port_list.json b/data/port_list.json new file mode 100644 index 000000000..736a626fc --- /dev/null +++ b/data/port_list.json @@ -0,0 +1,9 @@ +{ + "llama-backend": 7095, + "cgi-backend": 7096, + "flow-backend": 7097, + "robotics-odyssey-demo": 7998, + "main.go": 7999, + "air": 8001, + "jupyter": 8888 +} \ No newline at end of file diff --git a/js/arcyive/demo.ts b/js/arcyive/demo.ts deleted file mode 100644 index 2f4a4353a..000000000 --- a/js/arcyive/demo.ts +++ /dev/null @@ -1,27 +0,0 @@ - -import { serve } from "bun"; - -const htmlContent = ` - - -

Welcome to the Bun LiveKit Server

-
oafisndfoa sdfa
-
asdlfkajslfkasjdlfaksjdflkajfalsdkfj
- - -`; - - - -serve({ - fetch(req) { - return new Response(htmlContent, { - headers: { - "Content-Type": "text/html", - }, - }); - }, - port: 3009, // You can change the port if needed -}); - -console.log("Bun server is running on http://localhost:3009"); diff --git a/js/bun-livekit-server.js b/js/bun-livekit-server.js index f9c070e4d..03727e973 100644 --- a/js/bun-livekit-server.js +++ b/js/bun-livekit-server.js @@ -25,422 +25,3 @@ async function connect_to_livekit() { export { connect_to_livekit } - -// const diffusion_policy = () => ` -//
-// -//
- - -// -// -// https://3d-diffusion-policy.github.io/ -//
- -// -// - -//
-// `; - -// const democracy_mode = () => ` -//
-// -//

Democracy Mode

-//

This is a simple HTML string indicating democracy mode.

-// -//
-//

Twitch Plays Pokémon

-//

5d 13h 45m 21s

- -//
-// Anarchy -// -// Democracy -//
- -//
- -//
-// -//
-//
- -// - -//
- -// `; - -// const idk = () => ` -//
-//

diffusion !?!?! Mode

-//
-// `; - -// const dynamicland_org = () => ` -//
-// -// -// -//
-// `; -// const how = () => ` -//
-// -//
-//

Credit: ALan - how? by roboticsuniversity

- -// -// -// `; - - - -// const htmlContent = ` -// -// -// -// -// -// - -// -// -//

Welcome to the Bun ___ Server

-//
${jwt}
-//
${wsUrl}
- - -//

This is a simple HTML page served by Bun.

-// -// -// -// `; - -// function meforgert() { -// return ` -//
-//
- - -// -// -//
-// ` - -// } - - -// const pages = [ -// diffusion_policy(), -// democracy_mode(), -// idk(), -// dynamicland_org(), -// how(), -// meforgert() -// ] - -// const order = [ -// "diffusion-policy", -// "democracy-mode", -// "idk", -// "dynamicland.org", -// "how", -// "meforgert" -// ] - -// const port = 3003 - -// serve({ -// fetch(req) { -// console.log(req.url) -// const idk = req.url.split("?idk=")[1]; -// console.log(idk) - -// let templated = `` -// const container_start = ` -// -// bunkit livekit server -// -//
-//
-// ` -// const container_end = ` -// -//
-// ` - - -// if (idk) { -// templated += pages[order.indexOf(idk)] -// } - - -// return new Response(container_start + templated + container_end, { -// headers: { -// "Content-Type": "text/html", -// }, -// }); -// }, -// port: port, // You can change the port if needed -// }); - -// console.log("Bun server is running on http://localhost:" + port); diff --git a/js/robotics-odyssey-backend.ts b/js/robotics-odyssey-backend.ts new file mode 100644 index 000000000..b26ccb72e --- /dev/null +++ b/js/robotics-odyssey-backend.ts @@ -0,0 +1,468 @@ +import { AccessToken } from 'livekit-server-sdk'; + +import { serve } from "bun"; +const {jwt, wsUrl} = connect_to_livekit() + +// const htmlContent = ` +// +// +//

Welcome to the Bun LiveKit Server

+//
oafisndfoa sdfa
+//
asdlfkajslfkasjdlfaksjdflkajfalsdkfj
+// +// +// `; + + + +// serve({ +// fetch(req) { +// return new Response(htmlContent, { +// headers: { +// "Content-Type": "text/html", +// }, +// }); +// }, +// port: 3009, // You can change the port if needed +// }); + +// console.log("Bun server is running on http://localhost:3009"); + + + +const diffusion_policy = () => ` +
+ +
+ + + + + https://3d-diffusion-policy.github.io/ +
+ + + + +
+`; + +const democracy_mode = () => ` +
+ +

Democracy Mode

+

This is a simple HTML string indicating democracy mode.

+ +
+

Twitch Plays Pokémon

+

5d 13h 45m 21s

+ +
+ Anarchy + + Democracy +
+ +
+ +
+ +
+
+ + + +
+ +`; + +const idk = () => ` +
+

diffusion !?!?! Mode

+
+`; + +const dynamicland_org = () => ` +
+ + + +
+`; +const how = () => ` +
+ +
+

Credit: ALan - how? by roboticsuniversity

+ + + +`; + + +async function connect_to_livekit() { + const apiKey = process.env.livekit_api_key + const apiSecret = process.env.livekit_api_secret + const token = new AccessToken(apiKey, apiSecret, { + identity: 'example-participant', + }); + ;token.addGrant({ + room: 'example-room', + roomJoin: true, + canPublish: true, + }); + const jwt = await token.toJwt(); + + + + return {token: jwt, wsUrl} +} + + +const htmlContent = ` + + + + + + + + + +

Welcome to the Bun ___ Server

+
${jwt}
+
${wsUrl}
+ + +

This is a simple HTML page served by Bun.

+ + + +`; + +function meforgert() { +return ` +
+
+ + + + +
+` + +} + + +const pages = [ + diffusion_policy(), +democracy_mode(), + idk(), + dynamicland_org(), +how(), +meforgert() +] + +const order = [ + "diffusion-policy", + "democracy-mode", + "idk", + "dynamicland.org", + "how", + "meforgert" +] + +const port = 3003 + +serve({ + fetch(req) { + console.log(req.url) + const idk = req.url.split("?idk=")[1]; + console.log('idk',idk) + + let templated = `` + const container_start = ` + + bunkit livekit server + +
+
+ ` + const container_end = ` + +
+ ` + + + if (idk) { + templated += pages[order.indexOf(idk)] + } + + + return new Response(container_start + templated + container_end, { + headers: { + "Content-Type": "text/html", + }, + }); + }, + port: port, // You can change the port if needed +}); + +console.log("Bun server is running on http://localhost:" + port); diff --git a/main.go b/main.go index 00d33b7d6..fb9824feb 100644 --- a/main.go +++ b/main.go @@ -12,12 +12,12 @@ import ( ) var serverPorts = map[string]int{ - "llama-backend": 8900, - "cgi-backend": 8003, - "flirt-flow-backend": 8004, - "odyssey": 7999, // Assuming 7999 is one of the ports for odyssey - "air": 8000, // Assuming 8000 is another port for odyssey - "proxy-jupyter": 8888, + "llama-backend": 7095, + "cgi-backend": 7096, + "robotics-odyssey-backend": 7998, + //oddyssey - + "main.go": 8000, + "proxy-jupyter": 8888, } func main() { @@ -27,25 +27,32 @@ func main() { e.Static("/data", "data") utils.SetupRendering(e) - for backend, port := range serverPorts { - e.GET(fmt.Sprintf("/%s/*", backend), func(c echo.Context) error { - targetURL := fmt.Sprintf("http://localhost:%d%s", port, c.Request().URL.Path[len(fmt.Sprintf("/%s", backend)):]) - resp, err := http.Get(targetURL) - if err != nil { - return c.String(http.StatusInternalServerError, fmt.Sprintf("Error proxying request: %v", err)) - } - defer resp.Body.Close() - - for k, v := range resp.Header { - c.Response().Header().Set(k, v[0]) - } - c.Response().WriteHeader(resp.StatusCode) - _, err = io.Copy(c.Response().Writer, resp.Body) - return err - }) - } - - if err := e.Start(":7999"); err != nil && !errors.Is(err, http.ErrServerClosed) { + //for backend, port := range serverPorts { + backend := "/robotics-odyssey-backend" + port := 3003 + route_name := fmt.Sprintf("%s/*", backend) + fmt.Println(route_name, port) + e.GET(route_name, func(c echo.Context) error { + + route_path := c.Request().URL.Path + targetURL := fmt.Sprintf("http://localhost:%d%s", port, route_path) + fmt.Println(targetURL) + resp, err := http.Get(targetURL) + if err != nil { + return c.String(http.StatusInternalServerError, fmt.Sprintf("Error proxying request: %v", err)) + } + defer resp.Body.Close() + + for k, v := range resp.Header { + c.Response().Header().Set(k, v[0]) + } + c.Response().WriteHeader(resp.StatusCode) + _, err = io.Copy(c.Response().Writer, resp.Body) + return err + }) + //} + + if err := e.Start(":3000"); err != nil && !errors.Is(err, http.ErrServerClosed) { log.Fatal(err) } } diff --git a/pkg/utils/rendering.go b/pkg/utils/rendering.go index 6ee572be8..0025b2c12 100644 --- a/pkg/utils/rendering.go +++ b/pkg/utils/rendering.go @@ -102,6 +102,9 @@ func SetupRendering(e *echo.Echo) { e.GET("/", func(c echo.Context) error { return c.Render(http.StatusOK, "index.html", nil) }) + e.GET("/robotics-odyssey", func(c echo.Context) error { + return c.Render(http.StatusOK, "robotics-odyssey.html", nil) + }) e.GET("/cgi-tools", func(c echo.Context) error { fmt.Println("cgi page", "hi") return c.Render(http.StatusOK, "cgi-tools.html", nil) diff --git a/readme.md b/readme.md index 1203701ea..a4d2a66f2 100644 --- a/readme.md +++ b/readme.md @@ -81,3 +81,9 @@ and this repo just the LUA-based llm customzation layer for robotics - thats the # oct 11 - 3d diffusion - 4 hours - hardware module - 5 hours + + + +# + +https://dougengelbart.org/content/view/374/ diff --git a/start_app.sh b/start_app.sh new file mode 100644 index 000000000..29e67bdf2 --- /dev/null +++ b/start_app.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# "llama-backend": 7095, +# "cgi-backend": 7096, +#"flow-backend": 7097, +# "robotics-odyssey-demo": 7998, +# "main.go": 7999, + +# caddy port 80 +# "air": 8001, +# "jupyter": 8888 +# Start Node.js services +pm2 start js/llama-backend.js --name "server1" +pm2 start js/cgi-backend.js --name "server2" +pm2 start js/robotics-odyssey-demo.ts --name "server3" +# pm2 start js/server4.js --name "server4" +# pm2 start server5.js --name "server5" + +# Start Go server +#nohup go run main.go > go_server.log 2>&1 & +# switch to air later +air + +# Start Jupyter Notebook +#nohup jupyter notebook --no-browser --port=8888 > jupyter.log 2>&1 & + + +# to stop them - pm2 stop all diff --git a/tmp/main b/tmp/main index 166b713fd..b60596d0f 100755 Binary files a/tmp/main and b/tmp/main differ diff --git a/views/odyssey/1_tele_guidance.html b/views/odyssey/1_tele_guidance.html index c2f9048f2..1206b9a2e 100644 --- a/views/odyssey/1_tele_guidance.html +++ b/views/odyssey/1_tele_guidance.html @@ -4,19 +4,20 @@ {{end}} {{define "tele-guidance-2"}} - - + + + {{end}} {{define "tele-guidance-3"}} {{end}} {{define "tele-guidance-4"}} - + {{end}} //https://3d-diffusion-policy.github.io/ {{define "iframe_livekit"}} @@ -75,7 +76,7 @@

Releases

-->
- + - MOAR ART + SCIENCE ???? + Robotics Odyssey - Info Course like pwf {{ define "course_content" }} - {{ end }}