File tree Expand file tree Collapse file tree 5 files changed +52
-4
lines changed
Expand file tree Collapse file tree 5 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ button.selected {
9797# chat-info-panel {
9898 max-height : var (--main-area-height ) !important ;
9999 overflow : auto !important ;
100- transition : all 0.5 s ;
100+ transition : all 0.4 s ;
101101}
102102
103103body .dark # chat-info-panel figure > img {
@@ -109,12 +109,12 @@ body.dark #chat-info-panel figure>img{
109109 flex-wrap : unset;
110110 overflow-y : scroll !important ;
111111 position : sticky;
112- min-width : min (305px , 100% ) !important ;
113112 column-gap : 2px !important ;
114113 scrollbar-width : none;
115114 /* Firefox */
116115 -ms-overflow-style : none;
117116 /* Internet Explorer 10+ */
117+ transition : all 0.3s ;
118118}
119119
120120# conv-settings-panel ::-webkit-scrollbar {
@@ -204,6 +204,13 @@ mark {
204204 right : 15px ;
205205}
206206
207+ # chat-expand-button {
208+ position : absolute;
209+ top : 6px ;
210+ right : -10px ;
211+ z-index : 10 ;
212+ }
213+
207214# use-mindmap-checkbox {
208215 position : absolute;
209216 width : 110px ;
Original file line number Diff line number Diff line change @@ -16,6 +16,29 @@ function run() {
1616 let chat_info_panel = document . getElementById ( "info-expand" ) ;
1717 chat_info_panel . insertBefore ( info_expand_button , chat_info_panel . childNodes [ 2 ] ) ;
1818
19+ // move toggle-side-bar button
20+ let chat_expand_button = document . getElementById ( "chat-expand-button" ) ;
21+ let chat_column = document . getElementById ( "main-chat-bot" ) ;
22+ let conv_column = document . getElementById ( "conv-settings-panel" ) ;
23+
24+ let default_conv_column_min_width = "min(300px, 100%)" ;
25+ conv_column . style . minWidth = default_conv_column_min_width
26+
27+ globalThis . toggleChatColumn = ( ( ) => {
28+ /* get flex-grow value of chat_column */
29+ let flex_grow = conv_column . style . flexGrow ;
30+ console . log ( "chat col" , flex_grow ) ;
31+ if ( flex_grow == '0' ) {
32+ conv_column . style . flexGrow = '1' ;
33+ conv_column . style . minWidth = default_conv_column_min_width ;
34+ } else {
35+ conv_column . style . flexGrow = '0' ;
36+ conv_column . style . minWidth = "0px" ;
37+ }
38+ } ) ;
39+
40+ chat_column . insertBefore ( chat_expand_button , chat_column . firstChild ) ;
41+
1942 // move use mind-map checkbox
2043 let mindmap_checkbox = document . getElementById ( "use-mindmap-checkbox" ) ;
2144 let chat_setting_panel = document . getElementById ( "chat-settings-expand" ) ;
Original file line number Diff line number Diff line change 88from ktem .app import BasePage
99from ktem .components import reasonings
1010from ktem .db .models import Conversation , engine
11- from ktem .index .file .ui import File , chat_input_focus_js
11+ from ktem .index .file .ui import File
1212from ktem .reasoning .prompt_optimization .suggest_conversation_name import (
1313 SuggestConvNamePipeline ,
1414)
3131DEFAULT_SETTING = "(default)"
3232INFO_PANEL_SCALES = {True : 8 , False : 4 }
3333
34+ chat_input_focus_js = """
35+ function() {
36+ let chatInput = document.querySelector("#chat-input textarea");
37+ chatInput.focus();
38+ }
39+ """
3440
3541pdfview_js = """
3642function() {
@@ -403,6 +409,9 @@ def on_register_events(self):
403409 inputs = self ._info_panel_expanded ,
404410 outputs = [self .info_column , self ._info_panel_expanded ],
405411 )
412+ self .chat_control .btn_chat_expand .click (
413+ fn = None , inputs = None , js = "function() {toggleChatColumn();}"
414+ )
406415
407416 self .chat_panel .chatbot .like (
408417 fn = self .is_liked ,
Original file line number Diff line number Diff line change @@ -48,9 +48,17 @@ def on_building_ui(self):
4848 elem_classes = ["no-background" , "body-text-color" ],
4949 elem_id = "toggle-dark-button" ,
5050 )
51+ self .btn_chat_expand = gr .Button (
52+ value = "" ,
53+ icon = f"{ ASSETS_DIR } /expand.svg" ,
54+ scale = 1 ,
55+ size = "sm" ,
56+ elem_classes = ["no-background" , "body-text-color" ],
57+ elem_id = "chat-expand-button" ,
58+ )
5159 self .btn_info_expand = gr .Button (
5260 value = "" ,
53- icon = f"{ ASSETS_DIR } /sidebar .svg" ,
61+ icon = f"{ ASSETS_DIR } /expand .svg" ,
5462 min_width = 2 ,
5563 scale = 1 ,
5664 size = "sm" ,
You can’t perform that action at this time.
0 commit comments