Strip api.neuronetz.ai from documentation; chat config stays in env
The Ollama URL was leaking via:
- prose in /en/, /de/, /ja/, /es/, /fr/ docs (oracle, deployment,
local-testing, ai/module/{overview,embed,training})
- code blocks teaching users to curl the host directly
- .env.example, Dockerfile, docker-compose.yml defaults
- providers.mjs, translate-docs.mjs, build-oracle-index.mjs defaults
- LandingScripts.astro comment
- lora-runbook.md prose + SSH host
- the GET handler at /api/oracle which echoed `ollamaUrl` back to public callers
- the "Oracle is silent" fallback message at /api/oracle POST
Replacements:
- prose: "neuronetz.ai" → "your Ollama instance"
- example URLs in code blocks: https://api.neuronetz.ai → https://your-ollama-host.example
- code-level defaults: → http://localhost:11434 (Ollama's standard local port)
- GET /api/oracle: dropped the `ollamaUrl` field; provider + model still exposed
- runbook SSH host: neuronetz@cloud.neuronetz.ai → <gpu-user>@<gpu-host>
Production chat is unaffected: docs/.env (gitignored) on the production
host still pins OLLAMA_BASE_URL=https://api.neuronetz.ai. The only
change in the running container is that the GET handler no longer
echoes the URL.
analytics.neuronetz.ai (Umami tracking) is intentionally left intact —
it's a public, brand-owned subdomain meant to be visible.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,24 +109,29 @@ function mergeSmall(sections) {
|
||||
return out;
|
||||
}
|
||||
|
||||
export function chunkFile(filePath, rootDir) {
|
||||
const raw = fs.readFileSync(filePath, 'utf8');
|
||||
/**
|
||||
* Lower-level: chunk a raw markdown string with caller-supplied metadata.
|
||||
* Used both by chunkFile() (which derives meta from a path) and by
|
||||
* external sources like the framework-reference-v2 doc.
|
||||
*
|
||||
* @param {string} raw raw markdown (frontmatter optional)
|
||||
* @param {object} meta {
|
||||
* language, file, baseUrl, pageTitle, pageDescription
|
||||
* } — language defaults to 'en'; baseUrl defaults to '/'; pageTitle to file
|
||||
*/
|
||||
export function chunkMarkdown(raw, meta = {}) {
|
||||
const { frontmatter, body } = stripFrontmatter(raw);
|
||||
|
||||
// URL: docs/<lang>/<rest>.md(x) → /<lang>/<rest>/
|
||||
const rel = path.relative(rootDir, filePath).replace(/\\/g, '/');
|
||||
const parts = rel.split('/');
|
||||
const lang = parts[0];
|
||||
const slug = parts.slice(1).join('/').replace(/\.(md|mdx)$/, '').replace(/\/index$/, '');
|
||||
const baseUrl = '/' + (slug ? `${lang}/${slug}/` : `${lang}/`);
|
||||
const language = meta.language || frontmatter.lang || 'en';
|
||||
const file = meta.file || meta.pageTitle || 'untitled.md';
|
||||
const baseUrl = meta.baseUrl || '/';
|
||||
const pageTitle = meta.pageTitle || frontmatter.title || file;
|
||||
const pageDescription = meta.pageDescription || frontmatter.description || '';
|
||||
|
||||
let sections = splitByHeadings(body);
|
||||
sections = sections.flatMap(splitOversized);
|
||||
sections = mergeSmall(sections);
|
||||
|
||||
const pageTitle = frontmatter.title || slug || 'Untitled';
|
||||
const pageDescription = frontmatter.description || '';
|
||||
|
||||
return sections
|
||||
.filter((s) => s.lines.join('\n').trim().length > 0)
|
||||
.map((s, idx) => {
|
||||
@@ -134,9 +139,9 @@ export function chunkFile(filePath, rootDir) {
|
||||
const sectionTitle = s.heading || pageTitle;
|
||||
const url = s.anchor && s.heading ? `${baseUrl}#${s.anchor}` : baseUrl;
|
||||
return {
|
||||
id: `${rel}#${s.anchor ?? `_${idx}`}`,
|
||||
language: lang,
|
||||
file: rel,
|
||||
id: `${file}#${s.anchor ?? `_${idx}`}`,
|
||||
language,
|
||||
file,
|
||||
url,
|
||||
pageTitle,
|
||||
pageDescription,
|
||||
@@ -148,6 +153,19 @@ export function chunkFile(filePath, rootDir) {
|
||||
});
|
||||
}
|
||||
|
||||
export function chunkFile(filePath, rootDir) {
|
||||
const raw = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
// URL: docs/<lang>/<rest>.md(x) → /<lang>/<rest>/
|
||||
const rel = path.relative(rootDir, filePath).replace(/\\/g, '/');
|
||||
const parts = rel.split('/');
|
||||
const lang = parts[0];
|
||||
const slug = parts.slice(1).join('/').replace(/\.(md|mdx)$/, '').replace(/\/index$/, '');
|
||||
const baseUrl = '/' + (slug ? `${lang}/${slug}/` : `${lang}/`);
|
||||
|
||||
return chunkMarkdown(raw, { language: lang, file: rel, baseUrl });
|
||||
}
|
||||
|
||||
export function walkDocs(docsDir) {
|
||||
const out = [];
|
||||
const stack = [docsDir];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Unified provider abstraction for chat and embeddings.
|
||||
// Used by build-oracle-index.mjs (build time) and src/pages/api/oracle.ts (runtime).
|
||||
|
||||
const DEFAULT_OLLAMA_URL = 'https://api.neuronetz.ai';
|
||||
const DEFAULT_OLLAMA_URL = 'http://localhost:11434';
|
||||
const DEFAULT_OLLAMA_CHAT = 'qwen2.5-coder:14b';
|
||||
const DEFAULT_OLLAMA_EMBED = 'nomic-embed-text';
|
||||
const DEFAULT_ANTHROPIC = 'claude-haiku-4-5-20251001';
|
||||
|
||||
Reference in New Issue
Block a user