diff --git a/mcp-server/index.ts b/mcp-server/index.ts index 5a42884..e25eb7f 100644 --- a/mcp-server/index.ts +++ b/mcp-server/index.ts @@ -488,6 +488,31 @@ async function main() { sources: hybrid.sources?.slice(0, 5), }); + // Run LIVE CRM vs AI comparisons — these actually execute on page load + const demos: any[] = []; + const demoQueries = [ + { query: "warehouse help", desc: "A staffer types what they need in plain English" }, + { query: "someone good with machines who is dependable", desc: "Natural language — no field names, no filters" }, + { query: "safety trained worker for chemical plant", desc: "The CRM doesn't know 'safety trained' = OSHA + Hazmat" }, + ]; + for (const dq of demoQueries) { + // CRM attempt: exact LIKE match + const crmResult = await api("POST", "/query/sql", { + sql: `SELECT COUNT(*) cnt FROM workers_500k WHERE resume_text LIKE '%${dq.query}%'` + }); + const crmCount = crmResult?.rows?.[0]?.cnt ?? 0; + + // AI attempt: vector search understands meaning + const aiResult = await api("POST", "/vectors/hnsw/search", { + index_name: "workers_500k_v1", + query: dq.query, + top_k: 3, + }); + const aiHits = aiResult?.results || []; + + demos.push({ ...dq, crmCount, aiHits }); + } + const g = vram?.gpu || {}; const ts = new Date().toLocaleString(); const testRows = tests.map((t: any) => { @@ -661,33 +686,62 @@ tr:hover{background:#111827}
-

02 What AI + Vectors Do — understand MEANING, not just keywords

-

- The AI reads every worker profile, understands the content, and converts it into a 768-dimension mathematical representation. - When you search, it finds workers whose meaning matches — even if the words are completely different. +

See the difference — live, right now

+

+ These searches just ran on ${totalRows.toLocaleString()} real worker profiles when you loaded this page. + Left: what your CRM finds. Right: what AI finds. Same search, same data.

-
-
-
CRM Keyword Search
-
"warehouse work" → 0 results
-
Can't find it because no profile says "warehouse work" literally
-
-
-
AI Vector Search
-
"warehouse work" → ${hybrid.vector_reranked} verified matches
-
AI understands: Forklift Operator + Loader + Shipping Clerk = warehouse work
-
-
-
- ${hybrid.sql_matches?.toLocaleString()} structural matches - → AI ranked by relevance - ${hybrid.vector_reranked} best results - in ${tests[tests.length-1]?.ms}ms + ${demos.map((d: any, i: number) => { + const aiNames = d.aiHits.map((h: any) => { + const name = h.chunk_text?.split("—")[0]?.trim() || h.doc_id; + const role = h.chunk_text?.match(/— (.+?) in/)?.[1] || ""; + const city = h.chunk_text?.match(/in (.+?)\./)?.[1] || ""; + return { name, role, city, score: h.score }; + }); + + return ` +
+
${d.desc}
+
+ "${d.query}" +
+
+
+
Your CRM (keyword match)
+
${d.crmCount}
+
results — scanned every profile for the exact phrase
+
+
+
AI Vector Search (understands meaning)
+
${d.aiHits.length}
+
matches — found workers whose skills MEAN the same thing
+ ${aiNames.map((w: any) => ` +
+ ${w.name} + — ${w.role}${w.city ? ` in ${w.city}` : ""} +
+ `).join("")} +
+
+
`; + }).join("")} +
+ +
+

Now combine both: SQL precision + AI understanding

+

+ The hybrid search runs a SQL filter (role, state, reliability) AND vector ranking together. + You get exact structural matches ranked by who's the best semantic fit — in one call. +

+
+ ${hybrid.sql_matches?.toLocaleString()} workers match your filters + → AI ranked the top ${hybrid.vector_reranked} + ${tests[tests.length-1]?.ms}ms
${workerRows}
IDNameProfileAI ScoreVerified
-

Every result verified against the database — the AI can't hallucinate workers that don't exist.

+

Every result verified against the actual database. The AI cannot hallucinate workers that don't exist.