mirror of
https://github.com/syntrex-lab/gomcp.git
synced 2026-04-26 21:06:21 +02:00
- Rename Go module: sentinel-community/gomcp -> syntrex/gomcp (50+ files) - Rename npm package: sentinel-dashboard -> syntrex-dashboard - Update Cargo.toml repository URL to syntrex/syntrex - Update all doc references from DmitrL-dev/AISecurity to syntrex - Add root Makefile (build-all, test-all, lint-all, clean-all) - Add MIT LICENSE - Add .editorconfig (Go/Rust/TS/C cross-language) - Add .github/workflows/ci.yml (Go + Rust + Dashboard) - Add dashboard next.config.ts and .env.example - Clean ARCHITECTURE.md: remove brain/immune/strike/micro-swarm, fix 61->67 engines
26 lines
767 B
Go
26 lines
767 B
Go
//go:build onnx
|
|
|
|
package onnx
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/syntrex/gomcp/internal/domain/vectorstore"
|
|
)
|
|
|
|
// NewEmbedderWithFallback attempts to create an ONNX embedder.
|
|
// If ONNX Runtime or model is not available, falls back to FTS5Embedder.
|
|
// Always returns a working Embedder — never nil.
|
|
func NewEmbedderWithFallback(rlmDir string) vectorstore.Embedder {
|
|
// Try ONNX first.
|
|
onnxEmb, err := NewEmbedder(Config{RlmDir: rlmDir})
|
|
if err == nil {
|
|
log.Printf("Oracle: ONNX embedder active (%s, dim=%d) [ORACLE: FULL]",
|
|
onnxEmb.Name(), onnxEmb.Dimension())
|
|
return onnxEmb
|
|
}
|
|
|
|
// ONNX unavailable — degrade gracefully.
|
|
log.Printf("Oracle: ONNX unavailable (%v) — falling back to FTS5 [ORACLE: DEGRADED]", err)
|
|
return vectorstore.NewFTS5Embedder()
|
|
}
|