/* Claude Chat - Simple conversation with Claude Generates a quote for the day, then opens an interactive chat. Requires $ANTHROPIC_API_KEY in your environment Run: duso examples/init/claude/claude.du More info on the claude module: duso -doc claude */ claude = require("claude") ansi = require("ansi") md = require("markdown") print() print(md.ansi(""" # 💭 Claude Chat Get inspired with a daily quote, then chat with Claude. Type `exit` to quit. """)) print() // generate a quote for the day write(ansi.success('✨ Quote: ')) busy("thinking of something inspiring...") quote = claude.prompt(""" Generate a brief, inspiring quote for the day (1-2 sentences). Make it thoughtful and uplifting. """) write(md.ansi(quote)) print() print() // Set up chat session session = claude.session({ system = """ You are Claude, a helpful and thoughtful AI assistant. Be friendly, conversational, and genuinely interested in helping. Keep responses concise unless asked for more detail. """, temperature = 0.8 }) write(ansi.success('Claude: ')) busy("thinking of a warm greeting...") intro = session.prompt("Greet the user warmly and ask what they'd like to talk about. Keep it brief (1-2 sentences).") write(md.ansi(intro)) print() // Chat loop while true do user_input = input(ansi.warning('You: ')) if lower(user_input) == "exit" then print(ansi.success('👋 Goodbye!')) break end print() if user_input != "" then write(ansi.success('Claude: ')) busy("thinking...") response = session.prompt(user_input) write(md.ansi(response)) print() end end