From 2a930b0ba0083d713c9259e203bb343f73c45813 Mon Sep 17 00:00:00 2001 From: adnan wahab Date: Thu, 24 Oct 2024 00:11:59 -0500 Subject: [PATCH] asd --- readme.md | 5 + tailwind.config.js | 1 + .../TwitchPlaysPokemonPanel.tsx | 0 web-ui/my-app/src/client.js | 289 ----------------- web-ui/my-app/src/index.ts | 102 +----- web-ui/my-app/src/llama-tools.jsx | 85 ----- web-ui/my-app/src/llama-tools/blag.html | 141 ++++++++ .../my-app/src/llama-tools/llama-tools.html | 67 ++++ web-ui/my-app/src/{ => odysssey}/Box.tsx | 0 web-ui/my-app/src/odysssey/DynamicHow.tsx | 2 +- .../my-app/{views => src/odysssey}/Footer.tsx | 258 +++++---------- web-ui/my-app/src/odysssey/sisterschools.tsx | 106 ++++++ web-ui/my-app/src/robotics-odyssey.tsx | 198 ++++++------ web-ui/my-app/src/utils.ts | 83 +---- web-ui/my-app/views/TeleGuidanceFrame.tsx | 2 +- web-ui/my-app/views/blag.jsx | 305 ------------------ web-ui/my-app/views/sisterschools.tsx | 48 --- web-ui/tailwind.config.js | 38 +-- 18 files changed, 532 insertions(+), 1198 deletions(-) create mode 100644 tailwind.config.js rename web-ui/my-app/{views => src}/TwitchPlaysPokemonPanel.tsx (100%) delete mode 100644 web-ui/my-app/src/client.js delete mode 100644 web-ui/my-app/src/llama-tools.jsx create mode 100644 web-ui/my-app/src/llama-tools/blag.html create mode 100644 web-ui/my-app/src/llama-tools/llama-tools.html rename web-ui/my-app/src/{ => odysssey}/Box.tsx (100%) rename web-ui/my-app/{views => src/odysssey}/Footer.tsx (64%) create mode 100644 web-ui/my-app/src/odysssey/sisterschools.tsx delete mode 100644 web-ui/my-app/views/blag.jsx delete mode 100644 web-ui/my-app/views/sisterschools.tsx diff --git a/readme.md b/readme.md index d36daa1d..631b2e75 100644 --- a/readme.md +++ b/readme.md @@ -44,3 +44,8 @@ incorpate -- ideas from 8 billion people ![https://worrydream.com/SeeingSpaces/SeeingSpaces.jpg](https://worrydream.com/SeeingSpaces/SeeingSpaces.jpg) [![alt text](https://dynamicland.org/2024/Front_shelf/2dc5b9c5984d24df5d2aeaedf06442f8.jpg)](https://dynamicland.org/2024/Front_shelf/2dc5b9c5984d24df5d2aeaedf06442f8.jpg) https://youtu.be/y4ajXJ3nj1Q?si=CMpEXr9DBH86-9jG + +https://tevisthompson.com/saving-zelda/ + +1e14 = 100 trillion -> (100 million) - (millionaires) - who can create at least 10 AI-Proof jobs that create the future - Artist-Scientist Wizards who use dynamicland.org - the best invention of all time. +odysseys purpose is to implment dynamicland.org's research into every neighborhood in the world. \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 00000000..0519ecba --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web-ui/my-app/views/TwitchPlaysPokemonPanel.tsx b/web-ui/my-app/src/TwitchPlaysPokemonPanel.tsx similarity index 100% rename from web-ui/my-app/views/TwitchPlaysPokemonPanel.tsx rename to web-ui/my-app/src/TwitchPlaysPokemonPanel.tsx diff --git a/web-ui/my-app/src/client.js b/web-ui/my-app/src/client.js deleted file mode 100644 index e8787a4a..00000000 --- a/web-ui/my-app/src/client.js +++ /dev/null @@ -1,289 +0,0 @@ -// JSX parts above here -import React, { Suspense, lazy } from 'react'; -import { useRef, useState, useEffect } from 'react'; -import { - Room, - RoomEvent, - Track, - LocalTrack, - RoomOptions, -} from "livekit-client"; - -function LivekitAudio() { - const screenShareVideo = useRef(null); - const audioElement = useRef(null); - const [isRecording, setIsRecording] = useState(false); - const [audioContext, setAudioContext] = useState(null); - const [mediaRecorder, setMediaRecorder] = useState(null); - const [audioChunks, setAudioChunks] = useState([]); - console.log('LivekitAudio - rendering blah') - const chunks = []; - - const handleStopRecording = () => { - console.log('stopping recording') - console.log(chunks) - if (mediaRecorder && mediaRecorder.state !== 'inactive') { - mediaRecorder.stop(); - setIsRecording(false); - } - } - - function handleRecordButtonPress() { - if (isRecording) { - stopRecording(); - } else { - startRecording(); - } - } - - useEffect(() => { - const context = new (window.AudioContext || window.webkitAudioContext)(); - setAudioContext(context); - }, []); - - async function startRecording() { - if (!audioContext) return; - console.log('starting recording') - const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); - const recorder = new MediaRecorder(stream); - setMediaRecorder(recorder); - - recorder.ondataavailable = (e) => chunks.push(e.data); - - recorder.onstop = () => { - console.log('sending 5 seconds of audio to server') - sendAudioToServer(chunks); - }; - - recorder.start(); - setIsRecording(true); - setAudioChunks([]); - - // Stop recording after 5 seconds - setTimeout(() => { - console.log('stopping recording after 5 seconds') - stopRecording() - }, 5000); - } - - function stopRecording() { - console.log('stopping recording') - if (mediaRecorder && mediaRecorder.state !== 'inactive') { - mediaRecorder.stop(); - setIsRecording(false); - } - } - - async function sendAudioToServer(chunks) { - console.log('sendAudioToServer') - const audioBlob = new Blob(chunks, { type: 'audio/webm' }); - const formData = new FormData(); - formData.append('audio', audioBlob, 'audio.webm'); - - try { - const response = await fetch('/api/save_audio_to_whisper', { - method: 'POST', - body: formData, - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const result = await response.json(); - console.log('Server response:', result); - } catch (error) { - console.error('Error sending audio to server:', error); - } - return audioBlob; - } - - function handleButtonPress() { - console.log('Button pressed!'); - joinRoom(screenShareVideo.current, audioElement.current); - handleRecordButtonPress(); - } - - return ( -
-
- Audio - {ENABLE_SCREEN_SHARE ? ' and screen sharing' : ''} - {ENABLE_AUDIO_PLAYBACK ? ' with playback' : ' without playback'} - {' with LiveKit'} -
- {ENABLE_SCREEN_SHARE &&
- ); -} - - -// Rest of the JavaScript code below here -let Livekit = { - Room, - RoomEvent, - Track, -}; - -const ENABLE_SCREEN_SHARE = false; -const ENABLE_AUDIO_PLAYBACK = true; // New environment variable - -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: identity || 'voice to prompt' }), - }); - - if (!response.ok) { - console.error('Failed to connect to Livekit:', response.statusText); - return; - } - - const data = await response.json(); - return data; -} - -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"; - - const roomOptions: RoomOptions = { - adaptiveStream: true, - dynacast: true, - publishDefaults: { - simulcast: true, - audioEnabled: true, - videoEnabled: false, - }, - }; - - await room.connect(url, liveKit_data.token, roomOptions); - takeScreenshot(); - - 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); - } else if (publication.kind === Track.Kind.Audio && ENABLE_AUDIO_PLAYBACK) { - publication.track.attach(audioElement); - } - }); - - room.on(RoomEvent.LocalTrackUnpublished, (publication, participant) => { - if (publication.kind === Track.Kind.Video && publication.source === Track.Source.ScreenShare) { - publication.track.detach(screenShareVideo); - } else if (publication.kind === Track.Kind.Audio && ENABLE_AUDIO_PLAYBACK) { - publication.track.detach(audioElement); - } - }); - - await toggleMicrophone(room); - - if (ENABLE_SCREEN_SHARE) { - await toggleScreenShare(room); - } -} - -async function toggleMicrophone(room) { - const enabled = room.localParticipant.isMicrophoneEnabled; - console.log(`${enabled ? "stopping" : "starting"} microphone`); - try { - await room.localParticipant.setMicrophoneEnabled(!enabled); - } catch (e) { - console.error("error toggling microphone", e); - } -} - -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); - } -} - -function handleButtonPress() { - console.log('button pressed'); - screnshareis_cool(); -} - -function ReplayAnalyzer() { - return ( - <> -
Replay Analyzer
- - - ); -} - -function takeScreenshot() { - console.log('screenshot taken'); - - function captureScreenshot() { - const video = document.getElementById('screenShareVideo'); - - // Ensure the video has loaded metadata - if (video.readyState >= 2) { // HAVE_CURRENT_DATA - const canvas = document.createElement('canvas'); - canvas.width = video.videoWidth; - canvas.height = video.videoHeight; - - const context = canvas.getContext('2d'); - context.drawImage(video, 0, 0, canvas.width, canvas.height); - - const dataURL = canvas.toDataURL('image/png'); - - const img = document.createElement('img'); - img.src = dataURL; - document.body.appendChild(img); - const link = document.createElement('a'); - link.href = dataURL; - link.download = 'screenshot.png'; - link.click(); - } else { - // Video metadata not loaded yet - video.addEventListener('loadeddata', captureScreenshot); - } - } - - captureScreenshot(); -} - -console.log('llama-grid loaded'); diff --git a/web-ui/my-app/src/index.ts b/web-ui/my-app/src/index.ts index aa892248..464b3d37 100644 --- a/web-ui/my-app/src/index.ts +++ b/web-ui/my-app/src/index.ts @@ -1,16 +1,8 @@ import { Context, Hono } from 'hono' import { html } from 'hono/html' import { AccessToken } from "livekit-server-sdk"; - -const app = new Hono() - -// const hono_livekit_connect = async (c: Context) => { -// return c.json(await livekit_connect(c.req.raw)) -// } import odyssey from './robotics-odyssey.jsx' - import grid from './llama-tools.jsx' -import { flushSync } from 'react-dom' import fs from 'fs' import { logger } from 'hono/logger'; import { prettyJSON } from 'hono/pretty-json'; @@ -19,12 +11,10 @@ import { etag } from 'hono/etag'; import { serveStatic } from 'hono/serve-static'; import { jwt } from 'hono/jwt'; import { cors } from 'hono/cors'; - +import * as utils from './utils.js' +const app = new Hono() app.use(logger()) - - - app.onError((err, c) => { console.error(err); // Log the error for debugging const errorMessage = { @@ -36,22 +26,15 @@ app.onError((err, c) => { }); // specify path app.use('*', cors()) - - - - -app.all('/odyssey', (c) => { - //Layout(odyssey()) - return c.html(Layout(odyssey())) -}) - app.all('/llama-tools', (c) => { - //Layout(odyssey()) - return c.html(Layout(grid())) + return c.html( fs.readFileSync('./src/llama-tools/llama-tools.html', 'utf8')) +}) +app.all('/odyssey*', (c) => { + const is_html = odyssey() + return c.html(utils.Layout(is_html)) }) app.all('/iframe/*', (c) => { - //Layout(odyssey()) let basename = c.req.path.split('/').pop() console.log('basename', basename) let html = '' @@ -70,50 +53,11 @@ app.all('/iframe/*', (c) => { } return c.html(html) }) -//after 1k signups - lower price to course by 10% by 1k till $5 for life. -//only need 20k per year - (20k / 100) = (goal: 200per year) - rest -> reinveest to hardware -//1 buy per day = all beings (awaken + flourish) -//1000 users is 1000/20 = 50 years of free service. - -app.all('/_/TeleGuidance.tsx', async (c) => { - console.log('htmx render ', c.req.path) - - const html = fs.readFileSync('./src/odysssey/TeleGuidance.tsx', 'utf8') - return c.html(html) -}) - -app.all('/_/DynamicHow.tsx', async (c) => { - console.log('htmx render ', c.req.path) - - const html = fs.readFileSync('./src/odysssey/DynamicHow.tsx', 'utf8') - return c.html(html) -}) app.all('/', async (c) => { - return c.html(`
-

hono index

- - - - - - -
-
  • add magic iframe -- htmx + some observable links --- grid %s -
  • auto refresh like vite -
  • add livekit screenshare - holman -
  • -
    `) -}) - -app.all('/livekit_screenshare', async (c) => { - console.log('livekit_screenshare') - const html = fs.readFileSync('./src/livekit_screenshare.html', 'utf8') - return c.html(html) + return c.html(fs.readFileSync('./src/llama-tools/blag.html', 'utf8')) }) - app.all('/views/*', async (c) => { console.log(c.req.path) @@ -127,30 +71,6 @@ console.log('app', 'hono', Date.now()) app.fire() export default app -const Layout = (content: any) => html` - - - - - - - - Hono + htmx - - - - - -` - - -//app.get('/blag', (c) => c.json({'Pretty Blog API': 1})); -//app.get('/blag-archive', (c) => c.json({'Pretty Blog API': 1})); - - //app.get('/api/magic_llama', (c) => c.json({'Pretty Blog API': 1})); //app.get('/api/measure_magic_llama', (c) => c.json({'Pretty Blog API': 1})) @@ -207,4 +127,8 @@ async function connect_to_livekit(options: { identity: string }) { app.fire(); // -- obs_react_notebook_component -- 10 stars - make -//3d css react tw \ No newline at end of file +//3d css react tw + + + +// john dinu - queueing theory diff --git a/web-ui/my-app/src/llama-tools.jsx b/web-ui/my-app/src/llama-tools.jsx deleted file mode 100644 index b9a1679a..00000000 --- a/web-ui/my-app/src/llama-tools.jsx +++ /dev/null @@ -1,85 +0,0 @@ -export default function Example() { - return ( -
    -
    -

    Deploy faster

    -

    - LLama Tools -

    -
    -
    -
    - {/* */} - + + +
    +
    + + + + +
    +
    +
    + +
    +

    + + Launch: Robotics Odyssey - + Dedicated to making worrydream and alan kay's dream real. + + + + Llama Tools + + + + + +

    +
    + + +
    +

    Robotics Sensors

    + +
    + + + + +
    +

    Get new essays sent to you

    +

    + Subscribe to receive updates on Robotic Hardware, Published twice weekly. +

    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + diff --git a/web-ui/my-app/src/llama-tools/llama-tools.html b/web-ui/my-app/src/llama-tools/llama-tools.html new file mode 100644 index 00000000..daee2046 --- /dev/null +++ b/web-ui/my-app/src/llama-tools/llama-tools.html @@ -0,0 +1,67 @@ + + + + + + + + Hono + htmx + + +
    +

    LLama Tools

    +
    +
    + + + +
    + +
    +
    + +
    +

    livekit audio

    +

    livekit audio

    +
    +
    +
    + + +
    +
    + +
    +

    livekit screenshare

    +
    +
    +
    + + +
    +
    + + +
    +

    view all

    +
    +
    +
    + + +
    +
    +
    + + +

    replay analyzer - day9

    + +
    +
    +
    +
    +
    +
    +
    + + diff --git a/web-ui/my-app/src/Box.tsx b/web-ui/my-app/src/odysssey/Box.tsx similarity index 100% rename from web-ui/my-app/src/Box.tsx rename to web-ui/my-app/src/odysssey/Box.tsx diff --git a/web-ui/my-app/src/odysssey/DynamicHow.tsx b/web-ui/my-app/src/odysssey/DynamicHow.tsx index 60bc07a3..4e048e34 100644 --- a/web-ui/my-app/src/odysssey/DynamicHow.tsx +++ b/web-ui/my-app/src/odysssey/DynamicHow.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import TwitchPlaysPokemonPanel from '../../views/TwitchPlaysPokemonPanel'; +import TwitchPlaysPokemonPanel from '../TwitchPlaysPokemonPanel'; //import notebook from "@roboticsuniversity/alan_how"; //import notebook2 from "@roboticsuniversity/dynamicland";//"@roboticsuniversity/voxels-diffusion-policy-3d"; // analyze seinfeild - cant be constant comedy - some boring parts -- watch youtube -with vonnegut annotaion - tvroeps is a datum diff --git a/web-ui/my-app/views/Footer.tsx b/web-ui/my-app/src/odysssey/Footer.tsx similarity index 64% rename from web-ui/my-app/views/Footer.tsx rename to web-ui/my-app/src/odysssey/Footer.tsx index b442a788..2fa66f83 100644 --- a/web-ui/my-app/views/Footer.tsx +++ b/web-ui/my-app/src/odysssey/Footer.tsx @@ -18,114 +18,75 @@ import React from "react"; // const Docker_logo = `m664.01,223.35c-16.55-11.14-60.03-15.89-91.64-7.38-1.7-31.49-17.94-58.03-47.65-81.17l-10.99-7.38-7.33,11.07c-14.4,21.86-20.47,51-18.33,77.49,1.7,16.32,7.37,34.66,18.33,47.97-41.15,23.87-79.07,18.45-247.03,18.45H.06c-.76,37.93,5.34,110.88,51.73,170.27,5.12,6.56,10.74,12.91,16.84,19.02,37.72,37.77,94.71,65.47,179.93,65.54,130,.12,241.39-70.16,309.15-240.07,22.3.37,81.15,3.99,109.95-51.66.7-.94,7.33-14.76,7.33-14.76l-10.98-7.38Zm-494.72-39.14h-72.92v72.92h72.92v-72.92Zm94.21,0h-72.92v72.92h72.92v-72.92Zm94.21,0h-72.92v72.92h72.92v-72.92Zm94.21,0h-72.92v72.92h72.92v-72.92Zm-376.82,0H2.16v72.92h72.92v-72.92Zm94.21-92.11h-72.92v72.92h72.92v-72.92Zm94.21,0h-72.92v72.92h72.92v-72.92Zm94.21,0h-72.92v72.92h72.92v-72.92ZM357.7,0h-72.92v72.92h72.92V0Z"> +

    45 Hours of Free Content to learn how to build your own Robot

    + {/*

    Self Driving Pet Cat

    */} +
    +
    +
    + +
    + $25 buy once +
    +
    +
    + +
    + $141 for pi-saur +
    +
    +
    + + +
    + $300 for nanosaur.ai by Rafello Bonghaleii +
    + +
    + {/* */} +
    + ); +} + const navigation = { solutions: [ - // { name: 'Marketing', href: '#' }, - // { name: 'Analytics', href: '#' }, - // { name: 'Commerce', href: '#' }, - // { name: 'Insights', href: '#' }, + ], support: [ - // { name: 'Pricing', href: '#' }, - // { name: 'Documentation', href: '#' }, - // { name: 'Guides', href: '#' }, - // { name: 'API Status', href: '#' }, + + ], company: [ - // { name: 'About', href: '#' }, - // { name: 'Blog', href: '#' }, - // { name: 'Jobs', href: '#' }, - // { name: 'Press', href: '#' }, - // { name: 'Partners', href: '#' }, + ], legal: [ - // { name: 'Claim', href: '#' }, - // { name: 'Privacy', href: '#' }, - // { name: 'Terms', href: '#' }, + ], social: [ - { - name: "HuggingFace", //ML https://huggingface.co/lerobot/diffusion_pusht --- diagram -> scrolls across time -> sliders for every environment parameter like BV said - href: "https://huggingface.co/awahab92", - icon: (props) => ( - - - - ), - }, - { - name: "Docker", //infra - href: "https://hub.docker.com/u/shelbernstein", - icon: (props) => ( - - - - ), - }, - { - name: "Instagram", - href: "https://instagram.com/roboticsodyssey", - icon: (props) => ( - - - - ), - }, - { - name: "twitter", - href: "https://x.com/roboticsodyssey", - icon: (props) => ( - - - - ), - }, - { name: "hackaday", //hardware - main thing to contribute to href: "https://hackaday.io/roboticsodyssey", icon: (props) => ( <> - πŸŒŒπŸŒŒπŸŒˆπŸŒˆπŸ§™πŸΌβ€β™‚οΈπŸ§™πŸΌβ€β™‚οΈπŸ§™πŸΌβ€β™€οΈπŸ§™πŸ»πŸ€–πŸ€–πŸ¦–πŸ¦–πŸ¦• + πŸŒˆπŸ§™πŸ»πŸ€–πŸ¦–πŸŒˆ - // - // - // + ), }, - - { - name: "GitHub", - href: "https://github.com/botparty", + name: "twitter", + href: "https://x.com/roboticsodyssey", icon: (props) => ( - + ), }, + { name: "YouTube", //50% hardware -50% ML href: "https://www.youtube.com/@Robotics-Odyssey", @@ -142,109 +103,56 @@ const navigation = { ], }; +function Docker_pricing() { + //console -> homepage + return (
    +

    + $25 1 time fee for 95 hours of Video + 172 Notebooks +

    +

    + or $141 for a nanosaur.ai (raspberry pi instead of jetson nano for now) +

    +
    + + +
    + +
    +
    +
    ) +} + export default function Example() { return (