智能助手网
标签聚合 type

/tag/type

linux.do · 2026-04-18 22:49:01+08:00 · tech

{"detail":[{"type":"missing","loc":["body","tools",0,"input_schema"],"msg":"Field required","input":{"type":"web_search_20250305","name":"web_search","max_uses":8}}]} 有什么配置或者什么操作可以重定向这个工具或者有什么解决办法吗。 我用的是 GitHub - ding113/claude-code-hub: 一个现代化的 Claude Code & Codex API 代理服务,提供智能负载均衡、用户管理和使用统计功能。 · GitHub 1 个帖子 - 1 位参与者 阅读完整话题

linux.do · 2026-04-17 23:39:21+08:00 · tech

在此记录一个在开发自测环节中遇到的问题: 先上代码(已脱敏) type TestData struct { Data []byte `json:"data"` } func TestTryEncryptoClient(t *testing.T) { jsonStr := "{\"Data\":\"4GFwsR9XFRkyb/9Hn14zNpQRFE4V/f1hLIDlnff6LLPR/EvRmSW6ma6PHZiamB4mDeynjRYfVsfipg==\"}" message := &TestData{} err := json.Unmarshal([]byte(jsonStr), message) if err != nil { panic(err) } result := message.Data t.Logf("%v", result) t.Log(string(result)) sprintf := fmt.Sprintf("%s", result) t.Log(sprintf) t.Logf("bad base64: %s", result) t.Log("test done") } 输出内容(goland)控制台 [224 97 112 177 31 87 21 25 50 111 255 71 159 94 51 54 148 17 20 78 21 253 253 97 44 128 229 157 247 250 44 179 209 252 75 209 153 37 186 153 174 143 29 152 154 152 30 38 13 236 167 141 22 31 86 199 226 166] 짍V��� 짍V��� 짍V��� xxx_test.go:193: test done 现象描述: 此段代码会造成如下代码片段未能输出 t.Logf("bad base64: %s", result) ,并且如果是多协程测试条件下,很可能会造成控制台卡住(无法输出后续内容) 原因分析: 在此过程中,我们错误使用了%s来匹配 []byte 类型的数据,虽然golang在编译或者goland在运行前检查中不会报错/warning,但是在最终输出的时候,由于 byte[] 中包含了不能被控制台解析的控制字符,所以会造成最终输出内容的错误(也可以叫做编码不匹配),并且由于大部分编码都会兼容ASCII编码,在上述输出中会有byte为22的控制字符-> ASCII中描述为暂停等待同步字符,所以在多线程/协程测试中会导致控制台卡住等待同步完成 解决方案: 使用string现式包裹 []byte 即可 sprintf := fmt.Sprintf("%s", string(result)) 总结: 下次当遇到控制台卡住无输出的时候,记得检查是不是%s遇上了 []byte 类型的数据(常见某些加密流中的测试,用于观察加密后的字符输出) 1 个帖子 - 1 位参与者 阅读完整话题

hnrss.org · 2026-04-17 17:12:23+08:00 · tech

Hi HN, I've had to pull data from Discourse forums a few times now, and always had to keep dealing with raw requests.get(), rate-limiting and navigating the returned JSON. Our ecosystem is in Python so I looked if there was already a solution, I found pydiscourse ( https://github.com/pydiscourse/pydiscourse ), but it requires setting up an API key (a hassle) and only returns raw dicts. There were good solutions in other languages (like discourse2 in TypeScript) but yeah that wasn't in Python. This is useful if you don't want to set up an API key, only care about retrieving data (not interacting with the platform) and want something in Python. Also has some basic rate-limiting built in! Example usage: from discourse_reader import DiscourseClient client = DiscourseClient("https://meta.discourse.org") topic = client.topics.get(12345) print(topic.posts) print(topic.accepted_answer.cooked) for topic in client.topics.latest(limit=100): print(f"{topic.views:>6} views {topic.title}") The Pydantic models are set with extra="allow", so if you use this to hit forums with plugins that have extra fields those won't be dropped. Comments URL: https://news.ycombinator.com/item?id=47803959 Points: 1 # Comments: 0

linux.do · 2026-04-16 04:56:27+08:00 · tech

第一反应:快,好tm快 洗车问题 天气卡片 html <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>iOS 18 Style Weather Cards</title> <script src="https://cdn.tailwindcss.com"></script> <style> @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap'); body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #000; overflow: hidden; /* Prevent scroll on the main body */ } /* iOS 18 Glassmorphism Utilities */ .glass-panel { background: rgba(30, 30, 30, 0.6); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4); } .glass-card { background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.15); border-top: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3); transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease; } .glass-card:hover { transform: scale(1.03) translateY(-5px); box-shadow: 0 20px 40px 0 rgba(0, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.3); z-index: 10; } /* Custom Scrollbar for horizontal container */ .hide-scroll::-webkit-scrollbar { display: none; } .hide-scroll { -ms-overflow-style: none; scrollbar-width: none; } /* Weather Animations */ /* Sun */ @keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @keyframes pulse-glow { 0%, 100% { opacity: 0.8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.1); } } .sun-rays { animation: spin-slow 12s linear infinite; } .sun-core { animation: pulse-glow 3s ease-in-out infinite; } /* Wind */ @keyframes wind-flow { 0% { transform: translateX(-120%) opacity(0); } 50% { opacity: 0.6; } 100% { transform: translateX(120%); opacity(0); } } .wind-line { position: absolute; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); border-radius: 999px; } /* Rain */ @keyframes rain-fall { 0% { transform: translateY(-20px) translateX(0px); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translateY(120px) translateX(-10px); opacity: 0; } } .rain-drop { position: absolute; width: 2px; background: rgba(255, 255, 255, 0.6); border-radius: 2px; opacity: 0; } /* Snow */ @keyframes snow-fall { 0% { transform: translateY(-20px) translateX(0px) rotate(0deg); opacity: 0; } 20% { opacity: 0.8; } 100% { transform: translateY(140px) translateX(20px) rotate(180deg); opacity: 0; } } .snow-flake { position: absolute; background: white; border-radius: 50%; opacity: 0; filter: blur(1px); } /* Clouds */ @keyframes float-cloud { 0%, 100% { transform: translateX(0px); } 50% { transform: translateX(10px); } } .cloud-drift { animation: float-cloud 6s ease-in-out infinite; } /* Text Utilities */ .text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.3); } /* Background Gradient Animation */ .bg-gradient-anim { background: linear-gradient(-45deg, #0f172a, #1e1b4b, #312e81, #0f172a); background-size: 400% 400%; animation: gradientBG 15s ease infinite; } @keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } } /* Card Specific Gradients */ .card-sunny { background: linear-gradient(180deg, rgba(253, 184, 19, 0.25) 0%, rgba(245, 158, 11, 0.1) 100%); } .card-windy { background: linear-gradient(180deg, rgba(148, 163, 184, 0.25) 0%, rgba(71, 85, 105, 0.1) 100%); } .card-rainy { background: linear-gradient(180deg, rgba(30, 58, 138, 0.35) 0%, rgba(15, 23, 42, 0.2) 100%); } .card-snowy { background: linear-gradient(180deg, rgba(56, 189, 248, 0.2) 0%, rgba(14, 165, 233, 0.1) 100%); } </style> </head> <body class="h-screen w-screen text-white flex flex-col items-center justify-center bg-gradient-anim relative"> <!-- Background Ambient Orbs --> <div class="absolute top-[-10%] left-[-10%] w-[500px] h-[500px] bg-purple-600 rounded-full mix-blend-screen filter blur-[120px] opacity-40 animate-pulse"></div> <div class="absolute bottom-[-10%] right-[-10%] w-[600px] h-[600px] bg-blue-600 rounded-full mix-blend-screen filter blur-[120px] opacity-40 animate-pulse" style="animation-duration: 8s;"></div> <!-- Main Container --> <main class="relative z-10 w-full max-w-7xl px-6 flex flex-col items-center"> <!-- Header --> <header class="mb-12 text-center space-y-2"> <h1 class="text-4xl md:text-5xl font-bold tracking-tight text-transparent bg-clip-text bg-gradient-to-r from-white to-white/60">Weather</h1> <p class="text-white/50 text-lg font-medium tracking-wide">FORECAST OVERVIEW</p> </header> <!-- Cards Container (Horizontal Scroll on mobile, Grid on desktop) --> <div class="w-full overflow-x-auto hide-scroll pb-12 px-4"> <div class="flex md:grid md:grid-cols-4 gap-6 min-w-[1000px] md:min-w-0 mx-auto"> <!-- Card 1: Sunny --> <article class="glass-card glass-card-interactive card-sunny relative h-[420px] w-[240px] rounded-[32px] p-6 flex flex-col justify-between overflow-hidden group cursor-pointer select-none"> <!-- Top Info --> <div class="z-20"> <p class="text-white/70 font-semibold text-sm uppercase tracking-wider">Monday</p> <h2 class="text-3xl font-bold text-shadow mt-1">Sunny</h2> </div> <!-- Visual: Sun --> <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-40 h-40 z-10 pointer-events-none"> <!-- Rays --> <svg class="sun-rays w-full h-full text-yellow-400 opacity-60" viewBox="0 0 100 100" fill="none"> <circle cx="50" cy="50" r="20" fill="currentColor" fill-opacity="0.2" /> <path stroke="currentColor" stroke-width="4" stroke-linecap="round" d="M50 15V5M50 95V85M85 50H95M5 50H15M75.35 24.65L82.43 17.57M17.57 82.43L24.65 75.35M75.35 75.35L82.43 82.43M17.57 17.57L24.65 24.65" /> </svg> <!-- Core --> <div class="sun-core absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-16 h-16 bg-gradient-to-br from-yellow-300 to-orange-500 rounded-full blur-sm shadow-[0_0_40px_rgba(251,191,36,0.6)]"></div> </div> <!-- Bottom Info --> <div class="z-20 mt-auto"> <div class="flex items-end gap-2"> <span class="text-6xl font-light tracking-tighter">28°</span> </div> <div class="mt-4 space-y-2"> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>UV Index</span> <span class="font-semibold">High</span> </div> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Humidity</span> <span class="font-semibold">32%</span> </div> </div> </div> </article> <!-- Card 2: Windy --> <article class="glass-card glass-card-interactive card-windy relative h-[420px] w-[240px] rounded-[32px] p-6 flex flex-col justify-between overflow-hidden group cursor-pointer select-none"> <!-- Top Info --> <div class="z-20"> <p class="text-white/70 font-semibold text-sm uppercase tracking-wider">Tuesday</p> <h2 class="text-3xl font-bold text-shadow mt-1">Windy</h2> </div> <!-- Visual: Wind --> <div class="absolute top-1/3 left-0 w-full h-32 z-10 pointer-events-none overflow-hidden" id="wind-container"> <!-- Wind lines injected by JS --> </div> <!-- Cloud --> <div class="absolute top-[35%] left-1/2 transform -translate-x-1/2 w-24 h-12 bg-white/20 rounded-full blur-xl cloud-drift z-0"></div> <svg class="absolute top-[35%] left-1/2 transform -translate-x-1/2 w-20 h-12 text-white/40 cloud-drift z-0" fill="currentColor" viewBox="0 0 24 24"><path d="M18.5 12A5.5 5.5 0 0 0 13 6.5c-.26 0-.51.02-.76.06A4.5 4.5 0 0 0 4 10.5 4.5 4.5 0 0 0 8.5 15h10a3.5 3.5 0 0 0 0-7z"/></svg> <!-- Bottom Info --> <div class="z-20 mt-auto"> <div class="flex items-end gap-2"> <span class="text-6xl font-light tracking-tighter">19°</span> </div> <div class="mt-4 space-y-2"> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Wind</span> <span class="font-semibold">24 km/h</span> </div> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Direction</span> <span class="font-semibold">NW</span> </div> </div> </div> </article> <!-- Card 3: Heavy Rain --> <article class="glass-card glass-card-interactive card-rainy relative h-[420px] w-[240px] rounded-[32px] p-6 flex flex-col justify-between overflow-hidden group cursor-pointer select-none"> <!-- Top Info --> <div class="z-20"> <p class="text-white/70 font-semibold text-sm uppercase tracking-wider">Wednesday</p> <h2 class="text-3xl font-bold text-shadow mt-1">Storm</h2> </div> <!-- Visual: Rain & Cloud --> <div class="absolute top-[25%] left-0 w-full h-48 z-10 pointer-events-none overflow-hidden" id="rain-container"> <!-- Rain drops injected by JS --> </div> <!-- Dark Cloud --> <div class="absolute top-[22%] left-1/2 transform -translate-x-1/2 w-32 h-16 bg-slate-800/60 rounded-full blur-xl z-0"></div> <svg class="absolute top-[20%] left-1/2 transform -translate-x-1/2 w-28 h-16 text-slate-400/50 z-0" fill="currentColor" viewBox="0 0 24 24"><path d="M18.5 12A5.5 5.5 0 0 0 13 6.5c-.26 0-.51.02-.76.06A4.5 4.5 0 0 0 4 10.5 4.5 4.5 0 0 0 8.5 15h10a3.5 3.5 0 0 0 0-7z"/></svg> <!-- Bottom Info --> <div class="z-20 mt-auto"> <div class="flex items-end gap-2"> <span class="text-6xl font-light tracking-tighter">14°</span> </div> <div class="mt-4 space-y-2"> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Precip</span> <span class="font-semibold">90%</span> </div> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Pressure</span> <span class="font-semibold">998 hPa</span> </div> </div> </div> </article> <!-- Card 4: Blizzard --> <article class="glass-card glass-card-interactive card-snowy relative h-[420px] w-[240px] rounded-[32px] p-6 flex flex-col justify-between overflow-hidden group cursor-pointer select-none"> <!-- Top Info --> <div class="z-20"> <p class="text-white/70 font-semibold text-sm uppercase tracking-wider">Thursday</p> <h2 class="text-3xl font-bold text-shadow mt-1">Blizzard</h2> </div> <!-- Visual: Snow --> <div class="absolute top-[25%] left-0 w-full h-48 z-10 pointer-events-none overflow-hidden" id="snow-container"> <!-- Snow flakes injected by JS --> </div> <!-- Snow Cloud --> <div class="absolute top-[22%] left-1/2 transform -translate-x-1/2 w-32 h-16 bg-white/20 rounded-full blur-xl z-0"></div> <svg class="absolute top-[20%] left-1/2 transform -translate-x-1/2 w-28 h-16 text-white/60 z-0" fill="currentColor" viewBox="0 0 24 24"><path d="M18.5 12A5.5 5.5 0 0 0 13 6.5c-.26 0-.51.02-.76.06A4.5 4.5 0 0 0 4 10.5 4.5 4.5 0 0 0 8.5 15h10a3.5 3.5 0 0 0 0-7z"/></svg> <!-- Bottom Info --> <div class="z-20 mt-auto"> <div class="flex items-end gap-2"> <span class="text-6xl font-light tracking-tighter">-4°</span> </div> <div class="mt-4 space-y-2"> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Visibility</span> <span class="font-semibold">0.5 km</span> </div> <div class="flex justify-between text-sm text-white/80 border-b border-white/10 pb-1"> <span>Wind Chill</span> <span class="font-semibold">-12°</span> </div> </div> </div> </article> </div> </div> </main> <script> document.addEventListener('DOMContentLoaded', () => { // --- 1. Wind Animation Generator --- const windContainer = document.getElementById('wind-container'); const createWind = () => { const line = document.createElement('div'); line.classList.add('wind-line'); // Randomize properties const width = Math.random() * 60 + 40; // 40px to 100px const top = Math.random() * 100; const height = Math.random() * 2 + 1; const duration = Math.random() * 1 + 0.8; const delay = Math.random() * 2; line.style.width = `${width}px`; line.style.top = `${top}%`; line.style.height = `${height}px`; line.style.left = '-100px'; line.style.animation = `wind-flow ${duration}s linear ${delay}s infinite`; windContainer.appendChild(line); }; for(let i = 0; i < 15; i++) createWind(); // --- 2. Rain Animation Generator --- const rainContainer = document.getElementById('rain-container'); const createRain = () => { const drop = document.createElement('div'); drop.classList.add('rain-drop'); const left = Math.random() * 100; const height = Math.random() * 20 + 10; const duration = Math.random() * 0.5 + 0.4; const delay = Math.random() * 2; drop.style.left = `${left}%`; drop.style.height = `${height}px`; drop.style.animation = `rain-fall ${duration}s linear ${delay}s infinite`; rainContainer.appendChild(drop); }; for(let i = 0; i < 40; i++) createRain(); // --- 3. Snow Animation Generator --- const snowContainer = document.getElementById('snow-container'); const createSnow = () => { const flake = document.createElement('div'); flake.classList.add('snow-flake'); const left = Math.random() * 100; const size = Math.random() * 4 + 2; const duration = Math.random() * 2 + 1.5; const delay = Math.random() * 3; flake.style.left = `${left}%`; flake.style.width = `${size}px`; flake.style.height = `${size}px`; flake.style.animation = `snow-fall ${duration}s linear ${delay}s infinite`; snowContainer.appendChild(flake); }; for(let i = 0; i < 30; i++) createSnow(); // --- 4. 3D Tilt Effect (Mouse Interaction) --- // Adds a subtle 3D tilt to cards when mouse moves over them const cards = document.querySelectorAll('.glass-card-interactive'); cards.forEach(card => { card.addEventListener('mousemove', (e) => { const rect = card.getBoundingClientRect(); const x = e.clientX - rect.left; const y = e.clientY - rect.top; const centerX = rect.width / 2; const centerY = rect.height / 2; const rotateX = ((y - centerY) / centerY) * -5; // Max 5deg rotation const rotateY = ((x - centerX) / centerX) * 5; card.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(1.03)`; }); card.addEventListener('mouseleave', () => { card.style.transform = 'perspective(1000px) rotateX(0) rotateY(0) scale(1)'; }); }); }); </script> </body> </html> 拉煤问题 2 个帖子 - 2 位参与者 阅读完整话题

hnrss.org · 2026-04-14 23:30:20+08:00 · tech

Hi HN, For the last ~15 years I've worked on embedding web browsers into Java and .NET desktop apps (JxBrowser, DotNetBrowser). Over time, I watched many teams move from embedding web views into native apps, to building full desktop apps with frameworks like Electron and Tauri. Both are useful, but in practice I kept running into several problems. With Electron, beyond the larger app footprint, I often ran into: - lack of type-safe IPC - no source code protection - weak support for the modern web stack Tauri solves some problems (like app size), but introduces others: - different WebViews across platforms → inconsistent behavior - requires Rust + JS instead of a single stack So we built MōBrowser, a framework for building desktop apps with TypeScript, Node.js, and Chromium. Some of the things we focused on: - typed IPC using Protobuf + code generation (RPC-style communication instead of string channels) - consistent rendering and behavior across different platforms - Node.js runtime - built-in packaging, updates, and scaffolding - source code protection - small delta auto-updates The goal is to let web developers ship desktop apps with a web stack they already know and fewer cross-platform surprises. I'd especially love feedback from people who have built production apps with Electron or Tauri. Happy to answer any questions. Comments URL: https://news.ycombinator.com/item?id=47766955 Points: 2 # Comments: 0