File tree Expand file tree Collapse file tree
examples/nextjs/components/langbase Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export default function GenerateTextExample() {
7373
7474 { ! loading && completion && (
7575 < p className = "mt-4" >
76- < strong > Completion :</ strong > { completion }
76+ < strong > Generated completion :</ strong > { completion }
7777 </ p >
7878 ) }
7979 </ div >
Original file line number Diff line number Diff line change 22
33import { Button } from '@/components/ui/button' ;
44import { Input } from '@/components/ui/input' ;
5+ import { fromReadableStream } from 'langbase' ;
56import { useState } from 'react' ;
6- // import {fromReadableStream} from 'langbase';
7- import { fromReadableStream } from '../../../../packages/langbase/src/lib/browser/stream' ;
7+ // import {fromReadableStream} from '../../../../packages/langbase/src/lib/browser/stream';
88
99export default function StreamTextExample ( ) {
1010 const [ prompt , setPrompt ] = useState ( '' ) ;
@@ -27,11 +27,9 @@ export default function StreamTextExample() {
2727
2828 if ( response . body ) {
2929 const stream = fromReadableStream ( response . body ) ;
30- console . log ( '✨ ~ stream:' , stream ) ;
3130
3231 // Method #1 to get all of the chunk.
3332 for await ( const chunk of stream ) {
34- console . log ( '✨ ~ chunk:' , chunk ) ;
3533 const content = chunk ?. choices [ 0 ] ?. delta ?. content ;
3634 content && setCompletion ( prev => prev + content ) ;
3735 }
You can’t perform that action at this time.
0 commit comments