334
334
</ v-container >
335
335
< div class ="input-area ">
336
336
< v-sheet elevation ="0 " class ="input-panel d-flex align-end px-1 ">
337
- < v-speed-dial location =" bottom right " transition ="expand-transition " offset ="50 ">
337
+ < v-speed-dial transition ="expand-transition " offset ="10 ">
338
338
< template v-slot:activator ="{ props: activatorProps } ">
339
- < v-fab v-bind ="activatorProps " size ="small " icon ="mdi-cog " absolute
340
- class ="input-icon "> </ v-fab >
339
+ < v-btn v-bind ="activatorProps " size ="small " icon ="mdi-cog " absolute
340
+ class ="input-icon "> </ v-btn >
341
341
</ template >
342
342
< v-btn key ="4 " variant ="elevated " @click ="settingStore.initDialog " icon ="mdi-api "
343
343
v-tooltip:end ="$t('$vuetify.dataIterator.i.title') ">
@@ -920,6 +920,11 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
920
920
</ v-avatar >
921
921
< tuui-chat-card :index ="group.index " :messages ="messages " :show-content ="true ">
922
922
< template v-slot:default ="{ showcontent } ">
923
+ < v-card-text v-if ="group.message.reasoning_content " class ="md-preview pt-1 ">
924
+ < v-textarea class ="conversation-area text-disabled font-italic " variant ="plain "
925
+ density ='compact ' auto-grow hide-details rows ="1 " readonly
926
+ v-model ="group.message.reasoning_content "> </ v-textarea >
927
+ </ v-card-text >
923
928
< v-card-text v-if ="showcontent " class ="md-preview pt-1 ">
924
929
< v-textarea class ="conversation-area " variant ="plain " density ='compact ' auto-grow
925
930
hide-details rows ="1 " readonly v-model ="group.message.content "> </ v-textarea >
@@ -965,6 +970,9 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
965
970
</ v-card-text >
966
971
</ v-card >
967
972
< v-card class ="mt-1 " variant ="flat " v-if ="item.role == 'assistant' ">
973
+ < v-card-text v-if ="item.reasoning_content " class ="font-weight-bold ">
974
+ {{ item.reasoning_content }}
975
+ </ v-card-text >
968
976
< v-card-text v-if ="item.content " class ="font-weight-bold ">
969
977
{{ item.content }}
970
978
</ v-card-text >
@@ -2013,18 +2021,21 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
2013
2021
const languageStore = useLanguageStore ( ) ;
2014
2022
2015
2023
const createCompletion = async ( rawconversation ) => {
2016
-
2017
- // const conversation = rawconversation.reduce((newConversation, item) => {
2018
- // if (item.role === "user" && item.content[0].type === "image_url") {
2019
- // // Image is too large, only latest query could be kept
2020
- // newConversation = [item];
2021
- // }
2022
- // else {
2023
- // newConversation.push(item);
2024
- // }
2025
- // return newConversation;
2026
- // }, []);
2027
- const conversation = rawconversation
2024
+ const conversation = rawconversation . reduce ( ( newConversation , item ) => {
2025
+ if ( item . role === "assistant" ) {
2026
+ const { reasoning_content, ...rest } = item ;
2027
+ newConversation . push ( rest ) ;
2028
+ }
2029
+ // (item.role === "user" && item.content[0].type === "image_url") {
2030
+ // // Image is too large, only latest query could be kept
2031
+ // newConversation = [item];
2032
+ // }
2033
+ else {
2034
+ newConversation . push ( item ) ;
2035
+ }
2036
+ return newConversation ;
2037
+ } , [ ] ) ;
2038
+ // const conversation = rawconversation
2028
2039
try {
2029
2040
messageStore . generating = true
2030
2041
// Create a completion (axios is not used here because it does not support streaming)
@@ -2091,14 +2102,15 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
2091
2102
// Add the bot message
2092
2103
messageStore . conversation . push ( {
2093
2104
content : "" ,
2105
+ reasoning_content : "" ,
2094
2106
tool_calls : [ ] ,
2095
2107
role : "assistant" ,
2096
2108
} ) ;
2097
2109
2098
2110
let buffer = ''
2099
2111
2100
2112
// Read the stream
2101
- await read ( reader , messageStore . conversation [ messageStore . conversation . length - 1 ] , buffer , chatbotStore . stream ) ;
2113
+ await read ( reader , messageStore . conversation . at ( - 1 ) , buffer , chatbotStore . stream ) ;
2102
2114
} catch ( error ) {
2103
2115
snackbarStore . showErrorMessage ( error . message ) ;
2104
2116
} finally {
@@ -2202,6 +2214,8 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
2202
2214
target . content += choice
2203
2215
} else if ( typeof choice . content === 'string' ) {
2204
2216
target . content += choice . content
2217
+ } else if ( typeof choice . reasoning_content === 'string' ) {
2218
+ target . reasoning_content += choice . reasoning_content
2205
2219
}
2206
2220
parseTool ( choice . tool_calls , target )
2207
2221
}
@@ -2229,7 +2243,7 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
2229
2243
}
2230
2244
} ;
2231
2245
2232
- watch ( computed ( ( ) => messageStore . conversation [ messageStore . conversation . length - 1 ] ?. content ) ,
2246
+ watch ( computed ( ( ) => messageStore . conversation . at ( - 1 ) ?. content ) ,
2233
2247
( newValue , oldValue ) => {
2234
2248
if ( newValue !== oldValue ) {
2235
2249
asyncScrollToBottom ( ) ;
@@ -2646,4 +2660,4 @@ <h5 class="font-weight-bold mb-4">MCP</h5>
2646
2660
</ script >
2647
2661
</ body >
2648
2662
2649
- </ html >
2663
+ </ html >
0 commit comments