- SignalDesk2 hr ago
Original Summary
[小玩具] LINUX DO Algorithm 开发调优 // ==UserScript== // @name LINUX DO Algorithm // @namespace http://tampermonkey.net/ // @version 0.9 // @description 融合 X 算法和 DeepSeek AI 的智能推荐系统,提供个性化主题推荐 // @author SMNET // @… 基于神墨佬的小玩具改了一版,接入了jev打分 // ==UserScript== // @name LINUX DO Algorithm + Jev // @namespace http://tampermonkey.net/ // @version 1.4.1 // @description 热度与个性化推荐:独立配置画像模型、Jev 渠道、评分模型和权重 // @author SMNET / Tibbar // @match https://linux.do/ // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_registerMenuCommand // @connect openrouter.ai // @connect api.typesafe.ai // @connect // ==/UserScript== (function() { 'use strict'; const SETTINGS_KEY = 'linux_do_algorithm_settings_v2'; const LEGACY_SETTINGS_KEY = 'linux_do_algorithm_settings_v1'; const DEFAULT_SETTINGS = { scoreEngine: 'jev', jevProvider: 'typesafe', jevApiKey: '', jevModel: 'jev-latest', profileMode: 'summary', profileApiKey: '', profileApiUrl: 'https://api.deepseek.com/v1/chat/completions', profileModel: 'deepseek-chat', scoreApiKey: '', scoreApiUrl: 'https://api.deepseek.com/v1/chat/completions', scoreModel: 'deepseek-chat', customProfile: '', autoScoreAllLists: false, heatWeight: 45, interestWeight: 55, minDisplayScore: 20 }; function loadSettings() { const saved = GM_getValue(SETTINGS_KEY, null); if (saved) return { ...DEFAULT_SETTINGS, ...saved }; const legacy = GM_getValue(LEGACY_SETTINGS_KEY, null); if (!legacy) return { ...DEFAULT_SETTINGS }; return { ...DEFAULT_SETTINGS, scoreEngine: legacy.provider === 'deepseek' ? 'chat' : 'jev', jevProvider: 'openrouter', jevApiKey: legacy.openRouterApiKey || '', jevModel: String(legacy.jevModel || 'jev-latest').replace(/^~?typesafe\//, ''), profileMode: legacy.chatApiKey ? 'llm' : 'summary', profileApiKey: legacy.chatApiKey || '', profileApiUrl: legacy.chatApiUrl || DEFAULT_SETTINGS.profileApiUrl, profileModel: legacy.chatModel || DEFAULT_SETTINGS.profileModel, scoreApiKey: legacy.chatApiKey || '', scoreApiUrl: legacy.chatApiUrl || DEFAULT_SETTINGS.scoreApiUrl, scoreModel: legacy.chatModel || DEFAULT_SETTINGS.scoreModel, customProfile: legacy.customProfile || '', heatWeight: legacy.heatWeight ?? 45, interestWeight: legacy.interestWeight ?? 55, minDisplayScore: legacy.minDisplayScore ?? 20 }; } let settings = loadSettings(); // ========== 算法配置参数 ========== const CONFIG = { WEIGHT_LIKES: 0.5, WEIGHT_REPLIES: 13.5, WEIGHT_VIEWS: 0.015, PINNED_BOOST: 2.0, TIME_DECAY_FACTOR: 1.5, TIME_DECAY_OFFSET: 2, MAX_SCORE: 100, PROFILE_CACHE_TTL: 86400000, TOPIC_SCORE_CACHE_TTL: 3600000, MAX_TOPICS_PER_BATCH: 30, MAX_LIKED_TITLES: 15, MAX_REPLIED_TITLES: 10, MAX_CREATED_TITLES: 5, API_RETRY_COUNT: 2, API_RETRY_DELAY: 1000, PROFILE_CATEGORIES: ['技术兴趣', '内容偏好', '互动习惯', '专业领域', '阅读深度'], }; let isRecommendMode = false; let isPageScoreMode = false; let scoreMap = {}; let allTopicsData = {}; let sortTimeout = null; let autoScoreTimeout = null; let userProfile = ''; let isLoading = false; let isProcessingNewTopics = false; // ========== CSS 样式 ========== GM_addStyle(` .nav-pills > li > a, .nav-pills > li.ember-view > a, .navigation-container .nav-pills > li > a { border-bottom: 3px solid transparent !important; transition: all 0.2s ease; } body.recommend-mode-active .nav-pills > li:not(#nav-item-recommend) > a, body.recommend-mode-active .nav-pills > li.ember-view:not(#nav-item-recommend) > a, body.recommend-mode-active .navigation-container .nav-pills > li:not(#nav-item-recommend) > a { color: var(--primary-medium) !important; border-bottom-color: transparent !important; } .nav-pills li#nav-item-recommend.active > a, body.recommend-mode-active .nav-pills li#nav-item-recommend > a { color: var(--tertiary) !important; border-bottom: 3px solid var(--tertiary) !important; font-weight: 600; } .nav-pills li#nav-item-recommend > a:hover { color: var(--tertiary) !important; opacity: 0.8; } .recommend-loading-container { width: 100%; padding: 60px 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 300px; } .recommend-loading-text { color: var(--primary-medium); font-size: 15px; margin-bottom: 24px; text-align: center; } .recommend-spinner { width: 36px; height: 36px; border: 3px solid var(--primary-low); border-top: 3px solid var(--primary-medium); border-radius: 50%; animation: spin 0.8s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .manus-score-badge { font-size: 0.75em; color: var(--tertiary); margin-left: 8px; padding: 2px 6px; background: var(--tertiary-very-low); border-radius: 4px; font-weight: 500; transition: all 0.3s ease; } .manus-score-badge.calculating { color: var(--primary-medium); background: var(--primary-very-low); animation: pulse 1.5s ease-in-out infinite; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } .manus-score-loading { font-size: 0.75em; color: var(--primary-medium); margin-left: 8px; } .recommend-full-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--secondary); z-index: 100; min-height: 500px; } .recommend-loading-row { position: relative; z-index: 101; } .lda-settings-backdrop { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, 0.55); } .lda-settings-panel { width: min(680px, 100%); max-height: 90vh; overflow: auto; padding: 24px; border-radius: 12px; color: var(--primary); background: var(--secondary); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3); } .lda-settings-panel h2 { margin: 0 0 18px; } .lda-settings-panel label { display: block; margin: 14px 0 6px; font-weight: 600; } .lda-settings-panel input, .lda-settings-panel select, .lda-settings-panel textarea { box-sizing: border-box; width: 100%; padding: 9px 10px; border: 1px solid var(--primary-low-mid); border-radius: 6px; color: var(--primary); background: var(--secondar
- 情报分类:技术学习与提效
- 分类依据:内容涉及技术、AI、软件工具或工程实践
- 信息来源:服务器 / LINUX DO - 最新话题
- 发布时间:2026/9/22 15:02:53
- No replies yet