File tree 3 files changed +14
-2
lines changed
3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,10 @@ <h3 class="text-lg font-bold mb-6">Settings</h3>
261
261
< span v-if ="msg.content === null " class ="loading loading-dots loading-md "> </ span >
262
262
<!-- render message as markdown -->
263
263
< div v-else dir ="auto ">
264
+ < details v-if ="msg.role === 'assistant' && msg.cot " class ="collapse bg-base-200 " :open ="isGenerating ">
265
+ < summary class ="collapse-title "> Reasoning</ summary >
266
+ < vue-markdown :source ="msg.cot " dir ="auto " class ="collapse-content "> </ vue-markdown >
267
+ </ details >
264
268
< vue-markdown :source ="msg.content "> </ vue-markdown >
265
269
</ div >
266
270
<!-- render timings if enabled -->
Original file line number Diff line number Diff line change @@ -468,14 +468,22 @@ const mainApp = createApp({
468
468
for await ( const chunk of chunks ) {
469
469
const stop = chunk . stop ;
470
470
const addedContent = chunk . choices [ 0 ] . delta . content ;
471
- const lastContent = this . pendingMsg . content || '' ;
471
+ const lastContent = this . pendingMsg . fullContent || '' ;
472
472
if ( addedContent ) {
473
473
this . pendingMsg = {
474
474
id : this . pendingMsg . id ,
475
475
role : 'assistant' ,
476
- content : lastContent + addedContent ,
476
+ fullContent : lastContent + addedContent ,
477
477
} ;
478
478
}
479
+ const regex = / < t h i n k > ( .* ?) ? (? = ( < \/ t h i n k > ) | $ ) / gis;
480
+ const matches = [ ] ;
481
+ let match ;
482
+ while ( ( match = regex . exec ( this . pendingMsg . fullContent ) ) !== null ) {
483
+ matches . push ( match [ 1 ] ) ;
484
+ }
485
+ this . pendingMsg . content = this . pendingMsg . fullContent . replace ( / < t h i n k > .* ?( < \/ t h i n k > | $ ) / gis, '' ) ;
486
+ this . pendingMsg . cot = matches . join ( '<br/>' ) ;
479
487
const timings = chunk . timings ;
480
488
if ( timings && this . config . showTokensPerSecond ) {
481
489
// only extract what's really needed, to save some space
You can’t perform that action at this time.
0 commit comments