Skip to content

Commit

Permalink
docs: Update README.md (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored Dec 23, 2024
1 parent b02b505 commit 6573d49
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ const messages = [
];

const App = () => (
<div>
<>
<Bubble.List items={messages} />
<Sender />
</div>
</>
);

export default App;
Expand Down Expand Up @@ -142,11 +142,8 @@ const Component: React.FC = () => {
},
onUpdate: (chunk) => {
console.log('sse object', chunk);

const data = JSON.parse(chunk.data);

content += data?.choices[0].delta.content;

onUpdate(content);
},
},
Expand All @@ -157,7 +154,7 @@ const Component: React.FC = () => {
},
});

function onRequest(message: string) {
const onSubmit = (message: string) => {
agent.request(
{ message },
{
Expand All @@ -166,9 +163,9 @@ const Component: React.FC = () => {
onError: () => {},
},
);
}
};

return <Sender onSubmit={onRequest} />;
return <Sender onSubmit={onSubmit} />;
};
```

Expand Down Expand Up @@ -214,7 +211,6 @@ const Demo: React.FC = () => {

for await (const chunk of stream) {
content += chunk.choices[0]?.delta?.content || '';

onUpdate(content);
}

Expand All @@ -240,10 +236,10 @@ const Demo: React.FC = () => {
}));

return (
<div>
<>
<Bubble.List items={items} />
<Sender onSubmit={onRequest} />
</div>
</>
);
};

Expand Down

0 comments on commit 6573d49

Please sign in to comment.