From 3879f053dccd19b582186f2acd541c1f6d2de09c Mon Sep 17 00:00:00 2001 From: Sam Rolfe Date: Sat, 16 May 2026 17:16:54 +1000 Subject: [PATCH] sam-4screen-desktop 2026-5-16:17:16:54 --- .obsidian/workspace.json | 16 +- {100 inbox => .trash}/Untitled 1.md | 0 .../Untitled 2.md => .trash/Untitled 2 2.md | 0 100 inbox/Untitled.md => .trash/Untitled 2.md | 0 100 inbox/1778914902-WMFA.md | 11 -- 300 areas/350 AI/1778914902-WMFA.md | 153 ++++++++++++++++++ 6 files changed, 161 insertions(+), 19 deletions(-) rename {100 inbox => .trash}/Untitled 1.md (100%) rename 100 inbox/Untitled 2.md => .trash/Untitled 2 2.md (100%) rename 100 inbox/Untitled.md => .trash/Untitled 2.md (100%) delete mode 100644 100 inbox/1778914902-WMFA.md create mode 100644 300 areas/350 AI/1778914902-WMFA.md diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index af5ef75..f5c0942 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,12 +13,12 @@ "state": { "type": "markdown", "state": { - "file": "300 areas/350 AI/Pi Agent Extensions & Skills.md", + "file": "300 areas/350 AI/1778914902-WMFA.md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "Pi Agent Extensions & Skills" + "title": "1778914902-WMFA" } } ] @@ -195,16 +195,17 @@ "templater-obsidian:Templater": false } }, - "active": "845a8e3995ad4a8a", + "active": "7066c9273c6fb936", "lastOpenFiles": [ - "100 inbox/1778914902-WMFA.md", "000 daily/1778841999-CBOE.md", - "inbox/1778841999-CBOE.md", + "100 inbox/1778493481-VJZL.md", + "300 areas/350 AI/1778914902-WMFA.md", + "300 areas/350 AI/Pi Agent Extensions & Skills.md", "100 inbox/Untitled 2.md", "100 inbox/Untitled 1.md", - "300 areas/350 AI/Pi Agent Extensions & Skills.md", "100 inbox/Untitled.md", - "100 inbox/1778493481-VJZL.md", + "100 inbox/1778914902-WMFA.md~", + "inbox/1778841999-CBOE.md", "inbox/1778841999-CBOE.md~", "100 inbox/1778533395-ZAPX.md", "100 inbox/1778535439-NWLI.md", @@ -226,7 +227,6 @@ "200 projects/260 Build Create Make", "200 projects/250 IOT", "200 projects/240 Web Sites", - "300 areas/395 Food", "300 areas/390 Dev Ops Computers.md", "300 areas/350 AI.md", "templates/ai_dev_ops.md", diff --git a/100 inbox/Untitled 1.md b/.trash/Untitled 1.md similarity index 100% rename from 100 inbox/Untitled 1.md rename to .trash/Untitled 1.md diff --git a/100 inbox/Untitled 2.md b/.trash/Untitled 2 2.md similarity index 100% rename from 100 inbox/Untitled 2.md rename to .trash/Untitled 2 2.md diff --git a/100 inbox/Untitled.md b/.trash/Untitled 2.md similarity index 100% rename from 100 inbox/Untitled.md rename to .trash/Untitled 2.md diff --git a/100 inbox/1778914902-WMFA.md b/100 inbox/1778914902-WMFA.md deleted file mode 100644 index 4b2446e..0000000 --- a/100 inbox/1778914902-WMFA.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -created: 2026-05-16 17:01 -modified: 2026-05-16 17:01 -type: note -tags: [] -aliases: [] -id: 1778914902-WMFA ---- -# [[1778914902-WMFA]] - - diff --git a/300 areas/350 AI/1778914902-WMFA.md b/300 areas/350 AI/1778914902-WMFA.md new file mode 100644 index 0000000..b9a37a0 --- /dev/null +++ b/300 areas/350 AI/1778914902-WMFA.md @@ -0,0 +1,153 @@ +--- +created: 2026-05-16 17:02 +modified: 2026-05-16 17:02 +type: note +tags: + - ai dev-ops website iframe +aliases: [] +id: 1778914902-WMFA +--- +# [[1778914902-WMFA]] + +# Local Hybrid Vector + Graph RAG Setup via Caddy & Docker + +This document outlines the architecture and configuration files required to run a single, unified local RAG system (Vector search for static files + Graph search for Obsidian notes) served inside an iframe across three separate context-specific showcase websites (`devops.local`, `coding.local`, `ai.local`). + +--- + +## 1. Network Routing (`Caddyfile`) + +This configuration uses a `Caddyfile` snippets to proxy your backend container while securely handling cross-origin iframe security rules (`Content-Security-Policy`). + +```caddy +# Core AI RAG Application Backend +ai.local { + reverse_proxy localhost:8000 + + header { + # Restrict iframe rendering specifically to your 3 interest domains + Content-Security-Policy "frame-ancestors 'self' https://devops.local https://coding.local https://ai-site.local" + + # Standard security hardening + X-Content-Type-Options "nosniff" + Referrer-Policy "strict-origin-when-cross-origin" + } +} + +# Example Configuration Blocks for Frontend Sites +devops.local { + root * /var/www/devops_site + file_server +} + +coding.local { + root * /var/www/coding_site + file_server +} + +ai-site.local { + root * /var/www/ai_site + file_server +} +``` + +--- + +## 2. Infrastructure Layer (`docker-compose.yml`) + +The app runs out of a localized, slimmed-down Python environment container. Underlying vector files and Graph databases are explicitly mounted as **read-only** (`:ro`) to guarantee stability against prompt manipulation. + +```yaml +version: '3.8' + +services: + unified-ai-rag: + image: python:3.11-slim + container_name: local_ai_rag + working_dir: /app + volumes: + # Mount application scripts + - ./app:/app + # Mount databases and notes securely as READ-ONLY + - ./db/semantic_rag:/app/db/semantic_rag:ro + - ./db/obsidian_graph.gpickle:/app/db/obsidian_graph.gpickle:ro + ports: + - "8000:8000" + environment: + - OPENAI_API_KEY=your_openai_api_key_here + - ANTHROPIC_API_KEY=your_anthropic_api_key_here + command: ["pip", "install", "-r", "requirements.txt", "&&", "chainlit", "run", "app.py", "--port", "8000"] + restart: unless-stopped +``` + +--- + +## 3. Web UI Application & Context Controller (`app.py`) + +This Chainlit-driven script reads incoming referrers or basic text prompts to shift its personality depending on which website the recruiter came from. + +```python +import chainlit as cl +import networkx as nx +from chromadb import PersistentClient + +# 1. Initialization hooks for Vector and Graph layers (Read-Only) +def load_databases(): + vector_client = PersistentClient(path="/app/db/semantic_rag") + vector_layer = vector_client.get_collection(name="resume_and_docs") + graph_layer = nx.read_gpickle("/app/db/obsidian_graph.gpickle") + return vector_layer, graph_layer + +vector_db, graph_db = load_databases() + +@cl.on_chat_start +async def start(): + # Detect the site referring the frame to adjust persona + http_headers = cl.user_session.get("http_headers", {}) + referer = http_headers.get("referer", "") + + system_prompt = "You are a helpful AI assistant reviewing my portfolio data." + welcome_msg = "Hello! Ask me any questions about my profile or experience." + + if "devops.local" in referer: + system_prompt = "Persona: DevOps Engineer. Focus heavily on infrastructure, IoT architecture, CI/CD, and server logs." + welcome_msg = "Welcome Recruiter! Ask me anything about my DevOps automation and IoT infrastructure." + elif "coding.local" in referer: + system_prompt = "Persona: Software Engineer. Emphasize backend code, software design patterns, and clean programming methodologies." + welcome_msg = "Hello! Let's talk about my development portfolio and technical code paradigms." + elif "ai-site.local" in referer: + system_prompt = "Persona: AI/RAG Specialist. Discuss custom embedding techniques, semantic lookups, and graph networks." + welcome_msg = "Greetings! Feel free to pick my brain about graph-based indexing and large language models." + + cl.user_session.set("system_prompt", system_prompt) + await cl.Message(content=welcome_msg).send() + +@cl.on_message +async def main(message: cl.Message): + query = message.content + sys_prompt = cl.user_session.get("system_prompt") + + # Executing the dual pass strategy + # (Extract semantic chunks + pull Obsidian link neighbors from the graph) + # Synthesize outputs down through the LLM context window here... + + response_text = f"Processed query using profile persona contextualized framework rules." + await cl.Message(content=response_text).send() +``` + +--- + +## 4. Frontend Integration (`iframe`) + +Embed this string block directly inside your target HTML sites: + +```html + +``` + + +