#!/bin/sh set -eu data_dir=/var/lib/supermemory sentinel="$data_dir/.smoke-google-gemini-embedding-2-1024.ok" base_url="${SUPERMEMORY_URL:-http://127.0.0.1:6767}" container_tag="${SUPERMEMORY_CONTAINER_TAG:-hermes_supermemory_lab}" if [ -f "$sentinel" ]; then printf '%s\n' '{"smoke":"already-passed"}' exit 0 fi api_key=$(cat "$data_dir/api-key") auth_header="Authorization: Bearer $api_key" marker="supermemory-poc-google-embedding-2-$(date +%s)" plan="$data_dir/embedding-plan.json" for _ in $(seq 1 30); do [ -f "$plan" ] && break sleep 1 done grep -q 'openai' "$plan" grep -q 'google/gemini-embedding-2' "$plan" grep -q '1024' "$plan" curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"content\":\"$marker:中文跨文档检索测试;海棠计划的下一步是核对原始报告。\",\"containerTag\":\"$container_tag\",\"customId\":\"$marker\",\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ "$base_url/v3/documents" >/tmp/add.json found=false for _ in $(seq 1 90); do curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"q\":\"海棠计划下一步是什么?\",\"containerTag\":\"$container_tag\",\"searchMode\":\"hybrid\",\"limit\":5}" \ "$base_url/v4/search" >/tmp/search.json if grep -q '核对原始报告' /tmp/search.json && grep -q 'poc-smoke' /tmp/search.json; then found=true break fi sleep 2 done [ "$found" = true ] curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"containerTag\":\"$container_tag\",\"q\":\"海棠计划\"}" \ "$base_url/v4/profile" >/tmp/profile.json grep -q '"profile"' /tmp/profile.json curl --fail --silent --show-error --max-time 60 \ -H "$auth_header" \ -H 'Content-Type: application/json' \ --data "{\"conversationId\":\"$marker\",\"containerTags\":[\"$container_tag\"],\"messages\":[{\"role\":\"user\",\"content\":\"这只是隔离测试。\"},{\"role\":\"assistant\",\"content\":\"不会作为正式事实。\"}],\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ "$base_url/v4/conversations" >/tmp/conversation.json touch "$sentinel" printf '%s\n' '{"embedding_plan":"openai/google/gemini-embedding-2/1024","llm":"gemini-3.5-flash-lite","chinese_hybrid_search":"ok","metadata_traceability":"ok","profile":"ok","conversation_ingest":"accepted"}'