diff --git a/scripts/infra/caddy/Caddyfile b/scripts/infra/caddy/Caddyfile index 8094626a7..9a0a685c1 100644 --- a/scripts/infra/caddy/Caddyfile +++ b/scripts/infra/caddy/Caddyfile @@ -16,6 +16,13 @@ hashirama.blog { resolvers 1.1.1.1 } + route /ws/* { + reverse_proxy localhost:3333 { + header_up Connection {>Connection} + header_up Upgrade {>Upgrade} + } + } + route /* { reverse_proxy localhost:3333 } diff --git a/web-ui/docs/Flaws-in-Facebooks-Data-Pipeline.md b/web-ui/docs/Flaws-in-Facebooks-Data-Pipeline.md new file mode 100644 index 000000000..3d6c3c65e --- /dev/null +++ b/web-ui/docs/Flaws-in-Facebooks-Data-Pipeline.md @@ -0,0 +1,33 @@ + +facebook is cool. llama is one of my favroite things ever! + + +llama is perhaps one of the most humane technologies on earth!!!! + + +but, sometimes instagram says people are fake when they are real :( + + + i wish they just used a slightly more better bayesian spam filter - heres a diagram. + + + but besdies this one small issue, i think meta is one of the most undervalued companies on earth + + because peopel are what change the world, not technology. + + + i love llama :) + + + if you buy 3-4 used GPUS for 700 each - you can make 1 million in 90 days -- anyone can do it!!! + + + + but if everyone does it , there will be notyhing left to do :( + + + one thing that can be infinite --- above software is hardware because -- -- chat bots can do anything - - except glue atoms together. + + +people who work with their hands will be the last to be automated, in facct they never will be. +to be continued..... (living bag that never stops imprving lo l) \ No newline at end of file diff --git a/web-ui/docs/blag/index.md b/web-ui/docs/blag/index.md index 491d74e14..d12354ffc 100644 --- a/web-ui/docs/blag/index.md +++ b/web-ui/docs/blag/index.md @@ -150,3 +150,6 @@ Advanced Computer Graphics Techniques 4. Voxels and Stixels 5. Server Side WebGPU Streaming 6. Ray Tracing (2D and 3D) - Visibility + +# Miscellaneous + 1. Flaws in Facebooks Data Pipeline \ No newline at end of file diff --git a/web-ui/docs/designing strema game - ---- b/web-ui/docs/designing strema game - ---- new file mode 100644 index 000000000..a29f8317a --- /dev/null +++ b/web-ui/docs/designing strema game - ---- @@ -0,0 +1,8 @@ +designing strema game - ---- + + + +everyone in the world could play saem game + + +they be desiginersi for quests that hey yget ive to orobot and then together tod oa epic group quests wow \ No newline at end of file diff --git a/web-ui/js/LLAMA_Tools.jsx b/web-ui/js/LLAMA_Tools.jsx index 00c28508b..63e47c86d 100644 --- a/web-ui/js/LLAMA_Tools.jsx +++ b/web-ui/js/LLAMA_Tools.jsx @@ -20,7 +20,7 @@ function LLAMA_Tools () { {/*
LLAMA Tools for JP, Abid, Raffi, Eric, and Mark
*/} {/*
*/} - +{/* */} diff --git a/web-ui/js/bun-helper-server.tsx b/web-ui/js/bun-helper-server.tsx index 5ceb76776..f5016aad2 100644 --- a/web-ui/js/bun-helper-server.tsx +++ b/web-ui/js/bun-helper-server.tsx @@ -1,17 +1,20 @@ +const { EgressClient, RoomCompositeEgressRequest } = require('livekit-server-sdk'); + const ollama = require('ollama'); import {$} from 'bun' import { renderToString } from "react-dom/server"; -import React, { Suspense, lazy } from 'react'; +import React, {lazy } from 'react'; import Bun from 'bun' import fs from "fs"; import path from "path"; import { connect_to_livekit } from './bun_handlers/bun-livekit-server.js' import llamaRoutes from './bun_handlers/llama-backend.js' import CgiRoutes from './bun_handlers/cgi-backend.js' -import { renderToReadableStream } from 'react-dom/server'; +//import { startEgress } from './bun_handlers/bun-livekit-server.js' +//import { renderToReadableStream } from 'react-dom/server'; import TurndownService from 'turndown'; -const port = 8080; +const port = 8003; console.log(`Server running at http://localhost:${port}`); const LlamaGrid = lazy(() => import('./llama-grid.tsx')); @@ -31,22 +34,22 @@ async function serveLlamaTools(req: Request) { const filePath = path.join(process.cwd(), "js/views/blag.html"); let indexHtmlContent = fs.readFileSync(filePath, "utf-8"); - const stream = await renderToReadableStream( - Loading...}> + const result = await renderToString( + - + ); // Wait for all content to be ready - await stream.allReady; - - const reader = stream.getReader(); - let result = ''; - while (true) { - const { done, value } = await reader.read(); - if (done) break; - result += new TextDecoder().decode(value); - } + // await stream.allReady; + + // const reader = stream.getReader(); + // let result = ''; + // while (true) { + // const { done, value } = await reader.read(); + // if (done) break; + // result += new TextDecoder().decode(value); + // } const htmlContent = indexHtmlContent.replace( "{{template blag}}", @@ -159,6 +162,79 @@ async function serveBlagArchive(req: Request) { } } +function saveScreenShare() { + +} + +async function startEgress(roomName) { + const { EgressClient, RoomServiceClient } = require('livekit-server-sdk'); + const apiKey = process.env.LIVEKIT_API_KEY; + const apiSecret = process.env.LIVEKIT_API_SECRET; + const wsUrl = process.env.LIVEKIT_WS_URL; + + const egressClient = new EgressClient(wsUrl, apiKey, apiSecret); + const roomService = new RoomServiceClient(wsUrl, apiKey, apiSecret); + + const outputParams = { + file: { + filepath: `./screen-share.mp4`, // Ensure this path is valid and writable + }, + }; + + const request = { + room_name: roomName, + output: outputParams, + }; + + // Check if outputParams is correctly structured + if (!outputParams.file || !outputParams.file.filepath) { + throw new Error("Output parameters are not correctly defined."); + } + + // Initiate egress + const response = await egressClient.startRoomCompositeEgress(request); + console.log('Egress response:', response); +} + + +function ReplayAnalyzer() { + startEgress('example-room') + return (
+

Replay Analyzer

+ +
+
+ + + + +
+ +
+

Results of the replay analysis will appear here...

+
+
+ +
+

© 2023 Replay Analyzer. All rights reserved.

+
+
+ ); +} + + +function replay_analyzer(req: Request) { + const replay_html = renderToString() + + + return new Response(replay_html, { + headers: { + "Content-Type": "text/html", + }, + }); +} + + const CgiRoutesHandlers = Object.fromEntries( Object.entries(CgiRoutes).map(([key, value]) => [`/cgi-tools${key}`, value]) ); @@ -167,7 +243,8 @@ const llamaRoutesHandlers = Object.fromEntries( Object.entries(llamaRoutes).map(([key, value]) => [`/llama-tools${key}`, value]) ); const routes = { - "/livekit_connect": (req: Request) => livekit_connect(req), + "/api/livekit_connect": (req: Request) => livekit_connect(req), + "/api/replay_analyzer": (req: Request) => replay_analyzer(req), ///"/os/*": (req: Request) => os_automation(req), "/docs": (req: Request) => docs_response(routes), "/": (req: Request) => serveBlag(req), @@ -262,9 +339,9 @@ async function fetch(req: Request) { async function livekit_connect(req: Request) { - const jsonData = await req.json(); - console.log('Received JSON data:', jsonData); - + //const jsonData = await req.json(); + //console.log('Received JSON data:', jsonData); +const jsonData = {identity: 'voice to prompt?' + Date.now()} const identity = jsonData.identity; if (!identity) { return new Response("Identity parameter is missing", { status: 400 }); @@ -432,3 +509,4 @@ function makeReactApp(component_name) { + diff --git a/web-ui/js/bun_handlers/bun-livekit-server.js b/web-ui/js/bun_handlers/bun-livekit-server.js index 797e3411e..5d2264b9c 100644 --- a/web-ui/js/bun_handlers/bun-livekit-server.js +++ b/web-ui/js/bun_handlers/bun-livekit-server.js @@ -72,24 +72,26 @@ import { spawn } from "bun"; // const apiKey = process.env.LIVEKIT_API_KEY // const apiSecret = process.env.LIVEKIT_API_SECRET -// const egressClient = new EgressClient(livekitHost, apiKey, apiSecret); -// // https://dev.twitch.tv/docs/api/ -// //microbox + microsaur - -// //localhost -> connects to tailscale serve / funnel -> auto symlink to mothership - 4pb desktopx4 -// async function startEgress() { -// const request = RoomCompositeEgressRequest.fromPartial({ -// roomName: 'example-room', -// layout: 'speaker-dark', -// audioOnly: true, -// fileOutputs: [ -// { -// fileType: 'OGG', // LiveKit supports OGG for audio-only recordings -// filepath: '/audio.ogg', -// }, -// ], -// }); +const egressClient = new EgressClient(wsUrl, apiKey, apiSecret); +// https://dev.twitch.tv/docs/api/ +//microbox + lamasaur - homeage to nanosaur.ai (nanosaur w/ pi) +//localhost -> connects to tailscale serve / funnel -> auto symlink to mothership - 4pb desktopx4 +async function startEgress() { + const request = RoomCompositeEgressRequest.fromPartial({ + roomName: 'example-room', + layout: 'speaker-dark', + audioOnly: true, + fileOutputs: [ + { + fileType: 'OGG', // LiveKit supports OGG for audio-only recordings + filepath: '/audio.ogg', + }, + ], + }); + + const response = await egressClient.startRoomCompositeEgress(request); + console.log('Egress started with egress ID:', response.egressId); + return response.egressId +} -// const response = await egressClient.startRoomCompositeEgress(request); -// console.log('Egress started with egress ID:', response.egressId); -// return response.egressId -// } \ No newline at end of file +export { startEgress } \ No newline at end of file diff --git a/web-ui/js/bun_main_server.tsx b/web-ui/js/bun_main_server.tsx index e2ceae072..2e6fd1afb 100644 --- a/web-ui/js/bun_main_server.tsx +++ b/web-ui/js/bun_main_server.tsx @@ -10,12 +10,55 @@ const port = 3333; ////then youge tto read papers not write app code ---- vp of eng not a junir odev. Bun.serve({ + websocket: { + open(ws) { + console.log("WebSocket connection opened"); + }, + message(ws, message) { + console.log("Received message:", message); + // Handle the WebSocket message here + // You might want to forward this to your Vite server if needed + }, + close(ws, code, message) { + console.log("WebSocket connection closed"); + }, + }, port, // The port your proxy server will listen on async fetch(req) { const url = new URL(req.url); url.port = "8001"; // Forward to Vite server's port url.hostname = "localhost"; // Assuming Vite is running locally +if (url.pathname === '/ollama') { + return new Response(JSON.stringify({ message: 'ok' }), { + headers: { 'Content-Type': 'application/json' }, + }); +} + +if (url.pathname.startsWith('/api')) { + // return new Response(JSON.stringify({ message: 'ok' }), { + // headers: { 'Content-Type': 'application/json' }, + // }); + // Proxy the entire request to port 8080 + url.port = "8003"; // Forward to the server running on port 8080 + url.hostname = "localhost"; // Assuming the server is running locally + + try { + // Forward the request to the server running on port 8080 + const response = await fetch(url.toString(), { + method: req.method, + headers: req.headers, + body: req.body, + duplex: 'half', // Necessary for streaming request bodies + }); + + return response; // Return the server's response to the client + } catch (error) { + console.error('Error proxying request:', error); + return new Response('Internal Server Error', { status: 500 }); + } +} + try { // Forward the request to the Vite server const response = await fetch(url.toString(), { @@ -31,5 +74,36 @@ Bun.serve({ return new Response('Internal Server Error', { status: 500 }); } }, + }); -console.log("server running on port", port); \ No newline at end of file +console.log("server running on port", port); + + + +import { spawn } from 'child_process'; + +function startBunHelperServer() { + const bunHelperServer = spawn('bun', ['js/bun-helper-server.tsx'], { + stdio: 'inherit', + }); + + bunHelperServer.on('close', (code) => { + console.log(`bun-helper-server.tsx process exited with code ${code}`); + }); + + bunHelperServer.on('error', (err) => { + console.error('Failed to start bun-helper-server.tsx:', err); + }); + + const fs = require('fs'); + + fs.watch('js', { recursive: true }, (eventType, filename) => { + if (filename) { + console.log(`File changed: ${filename}. Restarting bun-helper-server...`); + bunHelperServer.kill(); + startBunHelperServer(); + } + }); +} + +startBunHelperServer(); diff --git a/web-ui/js/llama-grid.tsx b/web-ui/js/llama-grid.tsx index 45e52282c..3b543b108 100644 --- a/web-ui/js/llama-grid.tsx +++ b/web-ui/js/llama-grid.tsx @@ -64,14 +64,14 @@ const proxy_docs = [ /// spoken word = unifies groups from 5 to 100 - written word - 100,000 - pictures = 1 billion - Proof:youtube -async function getLivekitData() { +async function getLivekitData(identity) { const livekit_connect = 'livekit_connect' const response = await fetch('/api/livekit_connect', { method: 'POST', headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify({ identity: 'voice to prompt' }), + body: JSON.stringify({ identity: identity || 'voice to prompt' }), }); if (!response.ok) { @@ -86,7 +86,8 @@ async function getLivekitData() { //const liveKit_data = await postLivekitConnect(); // livekit video + audio - replay -async function joinRoom(screenShareVideo, audioElement) { +async function joinRoom(not_used, audioElement) { + let screenShareVideo = document.getElementById("screenShareVideo") let room = new Room(); const liveKit_data = await getLivekitData(); const url = "wss://omnissiah-university-kmuz0plz.livekit.cloud"; @@ -347,9 +348,9 @@ function Example() {

Lama-tools.com

-

+ {/*

10 days of learning llama. -

+

*/}
@@ -362,11 +363,11 @@ function Example() {

LiveKit Voice Agent

-

Lightning-fast builds

+ {/*

Lightning-fast builds

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In gravida justo et nulla efficitur, maximus egestas sem pellentesque. -

+

*/}
@@ -374,18 +375,24 @@ function Example() {
- + /> */} +
+ + +

ObervableHQ Infrastructure

-

Push to deploy

+ {/*

Push to deploy

Curabitur auctor, ex quis auctor venenatis, eros arcu rhoncus massa, laoreet dapibus ex elit vitae odio. -

+

*/}
@@ -400,10 +407,10 @@ function Example() { />

denoWEBGPU - cognition engine - alan kay game design

-

Built for power users

+ {/*

Built for power users

Sed congue eros non finibus molestie. Vestibulum euismod augue. -

+

*/}
@@ -411,17 +418,13 @@ function Example() {
- +

Replay analyzer

-

Connect your favorite tools

+ {/*

Connect your favorite tools

Maecenas at augue sed elit dictum vulputate, in nisi aliquam maximus arcu. -

+

*/}
@@ -436,10 +439,10 @@ function Example() { />

Continuous eval for helpers for robotics - bc learn prediction -coolest field in ai (worory dream said "tools that anticpate rather than obey in 2008" - invent at the intersection of robotics and LLAMA - because LLAMA = self-owned ai - seizing means of productions p2p robots

-

Globally distributed CDN

+ {/*

Globally distributed CDN

Aenean vulputate justo commodo auctor vehicula in malesuada semper. -

+

*/}
@@ -453,12 +456,51 @@ function Example() { import React, { Suspense, lazy } from 'react'; +async function handleInputChange(e) { +let typingTimeout; + +async function sendRequest(prompt) { + try { + const response = await fetch('/ollama', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ prompt }), + }); + + if (!response.ok) { + throw new Error('Network response was not ok'); + } + + const data = await response.json(); + console.log('Server response:', data); + } catch (error) { + console.error('Error sending request:', error); + } + +} +const prompt = e.target.value; + + + sendRequest(prompt); + +// function handleInputChange(e) { +// clearTimeout(typingTimeout); + +// const prompt = e.target.value; + +// typingTimeout = setTimeout(() => { +// sendRequest(prompt); +// }, 1000); +// } +} function App() { return (
- + Loading...
}> @@ -519,3 +561,131 @@ export default App; +async function screnshareis_cool ( ) { + //import { Livekit }from "https://cdn.jsdelivr.net/npm/livekit-client@2.5.9/+esm"; +// import { +// Room, +// RoomEvent, +// Track, +// } from "https://cdn.jsdelivr.net/npm/livekit-client@2.5.9/+esm"; + +let Livekit = { + Room, + RoomEvent, + Track, +}; + +// const token = +// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjkxOTU3MjEsImlzcyI6IkFQSXRTYndYdlNqaDRjZiIsIm5hbWUiOiJzY3JlZW5fc2hhcmUiLCJuYmYiOjE3MjkxMDkzMjEsInN1YiI6InNjcmVlbl9zaGFyZSIsInZpZGVvIjp7ImNhblVwZGF0ZU93bk1ldGFkYXRhIjp0cnVlLCJyb29tIjoicm9vbSIsInJvb21BZG1pbiI6dHJ1ZSwicm9vbUNyZWF0ZSI6dHJ1ZSwicm9vbUpvaW4iOnRydWUsInJvb21MaXN0Ijp0cnVlLCJyb29tUmVjb3JkIjp0cnVlfX0.Ub3VigeCkaL4sG4cdw7VaPfaHECuMg8buy6u38xqZPQ"; + +const livekit_connect = 'livekit_connect' + +let room; +//const button = document.getElementById("share"); +//button.addEventListener("click", joinRoom); +joinRoom() +async function joinRoom() { + room = new Room(); + //console.log('room', room.name) + const url = "wss://omnissiah-university-kmuz0plz.livekit.cloud"; + const datum = await getLivekitData('identity') + + + await room.connect(url, datum.token); + + room.on( + RoomEvent.TrackSubscribed, + (track, publication, participant) => { + if ( + track.kind === Track.Kind.Video && + track.source === Track.Source.ScreenShare + ) { + track.attach(screenShareVideo); + } + }, + ); + + room.on( + RoomEvent.TrackUnsubscribed, + (track, publication, participant) => { + if ( + track.kind === Track.Kind.Video && + track.source === Track.Source.ScreenShare + ) { + track.detach(screenShareVideo); + } + }, + ); + + room.on(RoomEvent.LocalTrackPublished, (publication, participant) => { + if ( + publication.kind === Track.Kind.Video && + publication.source === Track.Source.ScreenShare + ) { + publication.track.attach(screenShareVideo); + } + }); + + room.on(RoomEvent.LocalTrackUnpublished, (publication, participant) => { + if ( + publication.kind === Track.Kind.Video && + publication.source === Track.Source.ScreenShare + ) { + publication.track.detach(screenShareVideo); + } + }); + toggleScreenShare(room); +} + +async function toggleScreenShare(room) { + const enabled = room.localParticipant.isScreenShareEnabled; + console.log(`${enabled ? "stopping" : "starting"} screen share`); + try { + await room.localParticipant.setScreenShareEnabled(!enabled, { + audio: true, + }); + } catch (e) { + console.error("error sharing screen", e); + } +} +//private tracker - 1tb animated stories(comics, hn, cartoons) +// 1 tb - robot actions +// 1tb research ppapers and books - discussion. +// 1tb intermediate represenstaiton +//we 'll meet someday. +// you'll be megaman x, and i'll be one of dr lights - helpers in the capsule. +// all of you will be mega manx. you'll have boots, armor, and hellmet. +// you win. i lost. i was weak. i am weak. i will always be weak. +// but mega man x will always be strong. because the world needs everyone to be a champion. +//mass effect, matt, shodan, and the 3 factions and inner circle and 3 pyramid = mega man x * 1 million. you win. +//i dont believe in spiritaulity, i believe in science and art - those are the answer krishnamurtih and so on sought. +//self sacrifice is okay sometimes. if a lion attacks your tribe - it might be the only answer +// until dynamicland. +//rest easy, dynamicland is here. + +} + + + + + + + +function handleButtonPress() { + console.log('button pressed') + screnshareis_cool() +} + + +function ReplayAnalyzer() { + + + + + return (<>
Replay Analyzer
+ + ) + + + +} \ No newline at end of file diff --git a/web-ui/js/views/views_/llama-tools/replay_analyzer.html b/web-ui/js/views/views_/llama-tools/replay_analyzer.html index b5d763884..4ed0b28e1 100644 --- a/web-ui/js/views/views_/llama-tools/replay_analyzer.html +++ b/web-ui/js/views/views_/llama-tools/replay_analyzer.html @@ -11,25 +11,6 @@ -
-

Replay Analyzer

- -
-
- - - - -
- - -
- -
-

© 2023 Replay Analyzer. All rights reserved.

-