This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listMsg = countMsg > 0 ? | |
(msg.me.map((item, key) => <div className='chat_bot_content-msg'><h2 className='chat_bot-msg'>Moi :</h2><p className='chat_bot-msg' key={item.key}>{item}</p> | |
<h2 className='chat_bot-msg'>Bot :</h2> {msg.bot[key]}</div>)) | |
: (<p></p>) | |
return ( | |
<div> | |
<h1 className='title'>Chat Bot</h1> | |
<div className="chat_bot" id="chat_bot"> | |
<div className='chat_bot_content-msg' id='chat_bot_content-msg'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import postMessage from '../server/postMessage.js'; | |
... | |
async function handleClick(e) { | |
e.preventDefault(); | |
setCountMsg(countMsg + 1); | |
const response = await postMessage(newMsg); | |
setMsg({ 'me': msg.me.concat(newMsg), 'bot': msg.bot.concat(response.content[0].text) }) | |
setNewMsg(''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"proxy": "https://api.anthropic.com", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async function postMessage(message) { | |
try { | |
const response = await fetch('/v1/messages', { | |
method: 'POST', | |
headers: { | |
'x-api-key': process.env.REACT_APP_API_KEY, | |
"anthropic-version": "2023-06-01", | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Anthropic from '@anthropic-ai/sdk'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install @anthropic-ai/sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REACT_APP_API_KEY="your-api-key" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
color-mix(in lch, peru 40%, lightgoldenrod) | |
color-mix(in srgb, #34c9eb 20%, white) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oklch(40.1% 0.123 21.57) | |
oklch(59.69% 0.156 49.77) | |
oklch(59.69% 0.156 49.77 / .5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:nth-child(2 of .highlight) |
NewerOlder