|
|
@@ -9,6 +9,11 @@
|
|
|
* 但底层不是生产写路径 —— 这是为了「抽屉能点,但不会动线上数据」。
|
|
|
* 4. 提供 resetSample() 一键还原,演示前可清场。
|
|
|
*/
|
|
|
+import { createHttp } from '../utils/http.js';
|
|
|
+
|
|
|
+// 种子是静态文件,但同样走 services 的统一网络出口(视图层不 fetch、services 不直连 fetch)
|
|
|
+const seedHttp = createHttp({ base: '', appId: 'kf-sample' });
|
|
|
+
|
|
|
const SEED_URL = new URL('../../data/preview-seed.json', import.meta.url).href;
|
|
|
const LS_KEY = 'kf-sample::mutations::v1';
|
|
|
export const SAMPLE_DATASET_VERSION = 'ksf.innovation-preview-seed.v1';
|
|
|
@@ -24,9 +29,7 @@ export function getCurrentModel() { return currentModel; }
|
|
|
/** 读种子(浏览器端缓存;失败抛错,不兜底造数据) */
|
|
|
export async function loadSeed() {
|
|
|
if (seedCache) return seedCache;
|
|
|
- const res = await fetch(SEED_URL, { cache: 'no-cache' });
|
|
|
- if (!res.ok) throw new Error(`种子读取失败 HTTP ${res.status}`);
|
|
|
- seedCache = await res.json();
|
|
|
+ seedCache = await seedHttp.get(SEED_URL);
|
|
|
return seedCache;
|
|
|
}
|
|
|
|