#!/usr/bin/env node
/**
* Pro ビルド前に embedding_model/ に model_quantized.onnx と vocab.txt があるか確認する。
* 無い場合は取得元を表示して exit 1。
*/
import { existsSync } from 'fs';
import { join } from 'path';
import { fileURLToPath } from 'url';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const root = join(__dirname, '..');
const dir = join(root, 'embedding_model');
const onnx = join(dir, 'model_quantized.onnx');
const vocab = join(dir, 'vocab.txt');
if (existsSync(onnx) && existsSync(vocab)) {
console.log('[ensure-embedding-model] OK: embedding_model/ に model_quantized.onnx と vocab.txt があります。');
process.exit(0);
}
console.error('[ensure-embedding-model] Pro ビルドには embedding_model/ に次のファイルが必要です:');
console.error(' - model_quantized.onnx');
console.error(' - vocab.txt');
console.error('');
console.error('取得元: https://gitbucket.tmworks.club/dtmoyaji/sentence-bert-base-ja-mean-tokens-v2-int8');
console.error(' リポジトリ: https://gitbucket.tmworks.club/git/dtmoyaji/sentence-bert-base-ja-mean-tokens-v2-int8.git');
console.error(' リリースの ZIP または target/ 一式をダウンロードし、embedding_model/ に配置してください。');
console.error(' 詳細は embedding_model/README.md および README.md を参照してください。');
process.exit(1);