光湖灯塔v40.0 · 语言驱动3D翻转操作系统 + 码字工作台 + COS双桶 + 智能模型分流

Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/5fc8d967-00c4-4b70-9d49-bd775684c43b

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-02 12:07:12 +00:00 committed by GitHub
parent 36a92de467
commit 6df459247c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1074 additions and 2 deletions

1018
docs/index.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -212,12 +212,13 @@ async function checkConnection() {
}
/**
* 保存用户记忆到核心桶
* 保存用户记忆到核心桶团队内测用户 COS
*/
async function saveUserMemory(userId, memoryData) {
const key = `users/${userId}/memory.json`;
const wrapped = {
user_id: userId,
user_tier: 'team', // team = 内测团队 / public = 普通用户(后期单独存储)
updated_at: new Date().toISOString(),
version: 1,
memories: memoryData
@ -233,7 +234,32 @@ async function loadUserMemory(userId) {
const key = `users/${userId}/memory.json`;
return await readCore(key);
} catch {
return { user_id: userId, memories: [], version: 0 };
return { user_id: userId, user_tier: 'team', memories: [], version: 0 };
}
}
/**
* 保存用户作品到核心桶团队用户
*/
async function saveUserWorks(userId, worksData) {
const key = `users/${userId}/works.json`;
return writeCore(key, {
user_id: userId,
user_tier: 'team',
updated_at: new Date().toISOString(),
works: worksData
});
}
/**
* 读取用户作品
*/
async function loadUserWorks(userId) {
try {
const key = `users/${userId}/works.json`;
return await readCore(key);
} catch {
return { user_id: userId, works: [] };
}
}
@ -267,6 +293,8 @@ module.exports = {
checkConnection,
saveUserMemory,
loadUserMemory,
saveUserWorks,
loadUserWorks,
getConfig,
COS_CONFIG
};

View File

@ -323,6 +323,32 @@ app.get('/api/cos/config', (_req, res) => {
}
});
// ─── 用户作品同步(团队内测用户 → COS ───
app.post('/api/cos/sync-works', async (req, res) => {
if (!cosBridge) return res.status(503).json({ error: true, message: 'COS模块未加载' });
try {
const { userId, works } = req.body;
if (!userId || !works) return res.status(400).json({ error: true, message: '缺少userId或works' });
await cosBridge.saveUserWorks(userId, works);
res.json({ success: true, message: '作品已同步到COS', userId });
} catch (err) {
res.status(500).json({ error: true, message: err.message });
}
});
// ─── 用户作品加载(团队内测用户 ← COS ───
app.get('/api/cos/load-works', async (req, res) => {
if (!cosBridge) return res.status(503).json({ error: true, message: 'COS模块未加载' });
try {
const userId = req.query.userId;
if (!userId) return res.status(400).json({ error: true, message: '缺少userId' });
const data = await cosBridge.loadUserWorks(userId);
res.json({ success: true, ...data });
} catch (err) {
res.json({ success: true, user_id: req.query.userId, works: [] });
}
});
// ═══════════════════════════════════════════════════════════
// 智能模型分流 · Smart Model Router API
// ═══════════════════════════════════════════════════════════