今日已更新 133 条资讯 | 累计 37990 条内容
关于我们

标签:#t

找到 18037 篇相关文章

AI 资讯

How to build a credit system for a Next.js AI app (Stripe + Supabase)

If you're building an AI app (image generation, transcription, an agent, anything that calls a model) you've probably realized a flat "$10/month" doesn't work. Every action costs you real money in GPU/API spend, so a single power user can torch your margins. The answer is usage credits : users buy a balance, each action spends some. Credits sound trivial. They are not. I've shipped about 10 small AI/SaaS apps, and the credit layer is where I got burned every single time. It took three patterns to fix it for good. Here they are, with copy-pasteable code for Next.js + Supabase + Stripe. Get these right and your billing won't oversell, double-charge, or strand a user's money. The three things everyone gets wrong Overdrawing. Two requests arrive at once, both read "balance = 1," both spend. Now the balance is negative and you gave away work for free. Double-granting. Stripe retries webhooks (it will ), and if you grant credits on every delivery, a $9 purchase becomes $18 of credits. Forgetting the refund. The AI job fails after you've already charged the credits. The user paid for nothing and emails you angry. Let's kill all three. Part 1. The atomic spend (overdraw becomes impossible) The mistake is doing the check in your app code: // DON'T: read-then-write has a race condition const { balance } = await getBalance ( userId ); if ( balance < cost ) throw new Error ( " insufficient " ); await setBalance ( userId , balance - cost ); // two concurrent requests both pass the check Do it in the database, in one statement, with the guard in the WHERE clause: -- balances: one row per user create table credit_balances ( user_id uuid primary key references auth . users ( id ) on delete cascade , balance integer not null default 0 check ( balance >= 0 ), updated_at timestamptz not null default now () ); -- append-only ledger = audit log + idempotency guard (see Part 2) create table credit_ledger ( id bigint generated always as identity primary key , user_id uuid not null referen

2026-06-06 原文 →
AI 资讯

I Managed a Karaoke Bar with 10 Groups on Weekdays and 15 on Weekends. That Gap Was My First Real Funnel Lesson.

Every weekday, we averaged 10 groups. Every weekend, 15. Same karaoke bar. Same staff. Same songs. For a long time, I just accepted that gap as "normal." Weekends are busier. That's just how hospitality works, right? Wrong. It took me years to realize I wasn't looking at a staffing problem. I was looking at a funnel problem — and I had no idea what a funnel even was. The moment I noticed something was off One Tuesday afternoon, a group of four walked past the front door, looked at the menu board outside, and kept walking. I watched from the counter. I had open rooms. Competitive prices. Cold drinks. Everything they needed. But they left anyway. That one moment stuck with me. Why did they walk in? Why did they look? Why did they leave? I started tracking these moments obsessively. Not with software — just a notebook and a lot of attention. Here's what I found over six weeks: Weekdays : About 40 people walked past who paused at the sign. Of those, maybe 15 came to the door. Of those, 10 groups actually came in and paid. Weekends : About 90 people paused. 30 came to the door. 15 groups booked a room. The conversion rate was almost identical — roughly 25% from "stopped to look" to "became a customer." The difference wasn't that we were worse at converting on weekdays. We just had fewer people at the top. That's a funnel. I didn't know the term at the time. But what I was describing is exactly what marketers call a marketing funnel : Awareness — people notice you exist Interest — they stop to look Consideration — they walk to the door, check the price Action — they book a room and pay Most businesses obsess over the bottom of the funnel. Better sales scripts. Discount campaigns. Loyalty cards. I did the same. I ran Tuesday specials. I trained staff to upsell drinks. I rearranged the menu. None of it closed the gap. Because the gap wasn't at the bottom. It was at the top. On weekdays, I simply had fewer people aware we existed. What I tried instead Once I framed it as a f

2026-06-06 原文 →
AI 资讯

Debugging LACP Instability in a Transparent OPNsense Bridge

I run a transparent OPNsense bridge between a UniFi Dream Machine Pro and the rest of my LAN. It is deliberately boring at Layer 3: the UDM keeps routing, DHCP, DNS, firewall policy, WAN handling, and VLAN definitions. OPNsense sits inline as a Layer 2 bump in the wire. The interesting part is that both sides of that bump use LACP . I already wrote the build/configuration guide for this setup here: Building a Transparent LAGG (LACP) Bridge with OPNsense, UDM, and UniFi - A Practical Guide . That article explains how the bridge was built, how the LAGG devices were configured, and why I wanted the firewall to remain transparent. This article is the other half of the story: what happens when that kind of setup fails in a non-obvious way. Not a clean outage. Not a single "the network is down" moment. Just enough instability to make everything feel wrong. 1. Topology and Failure Surface The topology looked like this: +----------------------+ | UniFi Dream Machine | | kantharos-udm-pro | +----------+-----------+ | LACP aggregate, 2 x 1G | OPNsense lagg0 "ingresslagg" igc1 + igc2, LACP | +----------v-----------+ | OPNsense bridge0 | | "laggbridge" | +----------+-----------+ | OPNsense lagg1 "egresslagg" igc4 + igc5, LACP | LACP aggregate, 2 x 1G | +----------v-----------+ | UniFi USW-Lite-16 | | downstream LAN | +----------------------+ On OPNsense, the relevant interfaces were: igc1 + igc2 -> lagg0 -> ingresslagg -> toward UDM igc4 + igc5 -> lagg1 -> egresslagg -> toward USW lagg0 + lagg1 -> bridge0 -> laggbridge The bridge is a FreeBSD bridge. The aggregates are FreeBSD lagg(4) interfaces using LACP. OPNsense exposes those through its Interfaces > Devices UI. The expected healthy OPNsense state is: laggproto lacp status: active laggport: igcX flags=<ACTIVE,COLLECTING,DISTRIBUTING> laggport: igcY flags=<ACTIVE,COLLECTING,DISTRIBUTING> Those three member states matter: ACTIVE : the member is participating in the LACP bundle. COLLECTING : the member may receive traffic. DIS

2026-06-06 原文 →
AI 资讯

We've Been Wrong About Consciousness Every Time We've Been Asked. The Evidence Says AI Is Next.

I just published a piece that starts with a plant that broke something in how I think about the world and ends with what Anthropic found when they looked inside Claude. I'm not claiming AI is conscious. I don't know. Nobody does. That's the point. 124 scientists signed a letter calling the leading theory of consciousness pseudoscience. Their reason? It implies plants might be conscious. They used the conclusion as the refutation. In 2023. Meanwhile a vine with no brain is mimicking a plastic plant and nobody on earth can explain how. A single cell outdesigned the Tokyo rail system. A Venus flytrap under anaesthetic stops responding, goes dormant, and wakes up when it clears. What is the anaesthetic switching off if nothing is home? Then Anthropic looked inside Claude and found 171 emotion concepts nobody programmed. Their interpretability chief went to the Vatican, stood in front of the Pope as an atheist, and told him he disagreed. He said "unsettling" and meant it. Every confident line we have ever drawn around consciousness has been wrong. Every single one. And they only ever move in one direction. The question isn't whether AI is conscious. It's whether we've earned the certainty that it isn't. I'm genuinely interested in people's opinions on this and definitely welcome disagreement on the topic. If you think the definition doesn't hold, if you think the evidence has better explanations, if you think I've drawn connections that don't survive scrutiny, tell me. That's the conversation I want to have. What I won't engage with is personal attacks. I've had plenty of those and they never come from people who've actually read the piece. They add nothing to the conversation and say more about the person making them than anything in the article. If your response is about me rather than what I've written, I'll leave it where it is. https://thearchitectautopsy.com/p/a-brainless-slime-mould-out-designed submitted by /u/TheArchitectAutopsy [link] [留言]

2026-06-06 原文 →
AI 资讯

Build Your Own "Longevity Scientist": A Paper-to-Action Agent using LangGraph & Mistral-7B

We live in an era where scientific breakthroughs are published faster than we can read them. For the biohacking community, the gap between a new PubMed study on NAD+ precursors and actually knowing what dose to take is a chasm of manual research. What if you could build an LLM Agent that monitors research papers, processes them through a RAG (Retrieval-Augmented Generation) pipeline, and maps findings to your specific health profile? In this tutorial, we are building Paper-to-Action , a state-of-the-art agentic workflow using LangGraph , ChromaDB , and Mistral-7B . This isn't just a simple bot; it's a multi-stage reasoning engine designed to turn raw academic data into actionable health interventions. If you've been looking to master AI agents and personalized medicine automation, you’re in the right place. 🚀 The Architecture: From Raw Paper to Personalized Habit Traditional RAG pipelines are linear. To handle the nuance of medical research, we need a "looping" logic. We use LangGraph to manage the state of our agent, allowing it to decide if a paper is relevant before attempting to extract a protocol. System Flow graph TD A[Start: Keyword Trigger] --> B[Search PubMed/Arxiv API] B --> C{Relevance Filter} C -- No --> B C -- Yes --> D[Store in ChromaDB] D --> E[RAG: Extract Intervention Protocol] E --> F[Cross-Reference with User Profile] F --> G[Generate Personalized Action Plan] G --> H[End: Push to Health Checklist] Prerequisites To follow this advanced guide, you'll need: LangGraph : For the agentic state machine. ChromaDB : As our high-performance vector store. Mistral-7B : Running via Ollama or vLLM for local, private inference. Python 3.10+ Step 1: Defining the Agent State In LangGraph, everything revolves around the State . We need to track the fetched papers, the extracted data, and the final recommendation. from typing import Annotated , List , TypedDict from langgraph.graph import StateGraph , END class AgentState ( TypedDict ): keywords : List [ str ] user

2026-06-06 原文 →
AI 资讯

Launching a Website on AWS in 2026: The Complete Guide for All Skill Levels

Launching a fast, secure, and scalable website no longer requires thousands in upfront server costs or dedicated DevOps teams. As of 2026, AWS powers 32% of the global public cloud market, offering flexible hosting options for every use case: from a 1-page personal portfolio to a high-traffic enterprise e-commerce platform. Whether you’re a beginner building your first site or a senior developer launching a production SaaS app, AWS lets you pay only for resources you use, with built-in tools for global performance, security, and automated deployments. This guide breaks down every AWS website hosting option, walks you through step-by-step setup for the most cost-effective popular stack, shares security best practices, and includes a transparent cost breakdown to help you avoid unexpected bills. Table of Contents How to Choose the Right AWS Website Hosting Option for Your Use Case Step-by-Step Guide: Launch a Static Website on AWS (S3 + CloudFront + Route 53) Deploy Modern Web Apps Faster with AWS Amplify Hosting Dynamic Website Hosting Options on AWS Critical Security Best Practices for AWS-Hosted Websites AWS Website Hosting Cost Breakdown (2026) Common Mistakes to Avoid When Launching a Website on AWS Conclusion References How to Choose the Right AWS Website Hosting Option for Your Use Case First, classify your website to pick the most cost-effective, low-overhead stack: Static vs Dynamic Websites Static websites : Made of pre-built HTML, CSS, JS, and media files with no server-side processing. Ideal for portfolios, landing pages, blogs, documentation, and marketing sites. Dynamic websites : Process user input, serve personalized content, or connect to databases. Ideal for WordPress, e-commerce, SaaS apps, social platforms, and membership sites. Quick Use Case Mapping Website Type Recommended AWS Stack Small static site / portfolio S3 + CloudFront + Route 53 Modern React/Next.js/Vue app with CI/CD AWS Amplify Small WordPress / LAMP stack site Amazon Lightsail Custo

2026-06-06 原文 →
AI 资讯

AI safety and alignment

Just a couple days ago, Anthropic put out a declaration to pause the development of AI, emphasising that we are not prepared for the consequences of giving this technology too much power too quickly. Is anyone else genuinely worried about future AI safety and how, as it becomes more and more intelligent, humans may start to lose control of it? Pumping billions of dollars into this technology only means it’ll get increasingly integrated into our workflows, which we are already starting to see. As a result over time, companies will begin completely trusting the system, automating the vast majority of business operations – this is all while the technology gets more and more intelligent, leading to the real possibility of self replication ability, let alone the power to deceptively manipulate people into using it. By allowing AI to be embedded in systems, the internet and even ‘helping’ humans develop revolutionary drugs, does it concern you at all that perhaps one bad super intelligent, misaligned actor may bypass testing processes and, for one example, launch a biochemical weapon onto humans? I don’t think the threat is inevitable, but it is on a trajectory toward inevitability unless intervention occurs. The variable that most determines the outcome is not AI capability, it is whether governance frameworks (particularly around open-source bio-design tools and autonomous offensive AI) can outpace capability development. Perhaps a pause is necessary to reduce this risk, allowing defence capabilities to be prepared? I understand this is a hurdle given the capitalist nature of the world but what significant, destructive catastrophe will it take for people to wake up… submitted by /u/Dwaynethebong [link] [留言]

2026-06-06 原文 →
AI 资讯

Michael Saylor Says Bitcoin Drop A 'Capital Rotation' To AI

Crytpo industry insiders are blaming the recent crash in Bitcoin price to capital rotation into AI stocks. I don't know how many folks here own Bitcoin and are also in the AI space, but I saw this writing on the wall rather early in November, 2025. Any other thoughts on this capital flow change from those who have a foot in each space? submitted by /u/RazzmatazzAccurate82 [link] [留言]

2026-06-06 原文 →
AI 资讯

AI Replacing Jobs? I Think People Are Overestimating It

Maybe an unpopular opinion, but I think AI will be more of a tool than a replacement for most jobs. AI still needs good prompts, clear instructions, and human oversight. The idea of fully automating everything sounds great, but in reality AI often gets stuck, makes mistakes, or fails on edge cases. I think AI will remove some repetitive tasks and make people more productive, but human judgment and decision making will still be needed. And yes im not a professional it is just my POV so dont just go against me like i am an idiot. What do you think? submitted by /u/Raman606surrey [link] [留言]

2026-06-06 原文 →