/** @typedef {'intro' | 'news' | 'joke' | 'poem'} TkmindLoadingTipCategory */ /** @type {Array<{ category: TkmindLoadingTipCategory, text: string }>} */ export const TKMIND_LOADING_TIPS = [ { category: 'intro', text: 'TKMind 智趣:把聊天变成可交付的页面、问卷与分析。' }, { category: 'intro', text: '智趣正在帮你落盘 MindSpace 页面,稍等片刻就好。' }, { category: 'intro', text: 'TKMind 会把对话里的想法,变成能分享的链接。' }, { category: 'intro', text: '页面、问卷、Excel 分析——智趣一条指令就能开工。' }, { category: 'intro', text: 'MindSpace 是你的创作工作台,TKMind 是懂你的搭档。' }, { category: 'news', text: '今日小贴士:先让智趣出草稿,再微调细节,效率翻倍。' }, { category: 'news', text: '热点观察:越来越多团队用 AI 助手做「可点击」的交付物。' }, { category: 'news', text: '趋势速览:问卷 + Page Data 可以直接沉淀到数据库。' }, { category: 'news', text: '轻新闻:一杯咖啡的时间,页面可能就写好了。' }, { category: 'joke', text: '程序员笑话:Bug 不是消失,只是换了个地方躲猫猫。' }, { category: 'joke', text: '冷笑话:为什么页面加载慢?因为它在认真排版。' }, { category: 'joke', text: '今日一笑:产品经理说「就改一行」,智趣默默打开了十个文件。' }, { category: 'joke', text: '段子时间:代码写得好,头发剩多少?' }, { category: 'poem', text: '「采菊东篱下,悠然见南山。」——陶渊明' }, { category: 'poem', text: '「欲把西湖比西子,淡妆浓抹总相宜。」——苏轼' }, { category: 'poem', text: '「海上生明月,天涯共此时。」——张九龄' }, { category: 'poem', text: '「春风得意马蹄疾,一日看尽长安花。」——孟郊' }, { category: 'poem', text: '「行到水穷处,坐看云起时。」——王维' }, ]; /** * @param {{ seed?: string | number, exclude?: string[] }} [options] * @returns {{ category: TkmindLoadingTipCategory, text: string }} */ export function pickTkmindLoadingTip(options = {}) { const exclude = new Set((options.exclude ?? []).map((item) => String(item ?? '').trim()).filter(Boolean)); const pool = TKMIND_LOADING_TIPS.filter((item) => !exclude.has(item.text)); const candidates = pool.length > 0 ? pool : TKMIND_LOADING_TIPS; const seed = String(options.seed ?? `${Date.now()}-${Math.random()}`); let hash = 0; for (let index = 0; index < seed.length; index += 1) { hash = ((hash << 5) - hash + seed.charCodeAt(index)) | 0; } const picked = candidates[Math.abs(hash) % candidates.length]; return picked ?? candidates[0]; }