File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #! /bin/bash
1+ #! /usr/ bin/env bash
22# Build script for LocalGPT egui web UI
33#
44# This script compiles the server crate to WASM and generates the necessary
Original file line number Diff line number Diff line change @@ -65,7 +65,9 @@ impl eframe::App for WebApp {
6565 }
6666
6767 if let Some ( ref id) = self . session_id {
68- ui. label ( format ! ( "Session: {}..." , & id[ ..8 . min( id. len( ) ) ] ) ) ;
68+ // Safe truncation that respects UTF-8 character boundaries
69+ let truncated: String = id. chars ( ) . take ( 8 ) . collect ( ) ;
70+ ui. label ( format ! ( "Session: {}..." , truncated) ) ;
6971 }
7072 } ) ;
7173 } ) ;
@@ -105,7 +107,10 @@ impl eframe::App for WebApp {
105107 . hint_text ( "Type a message..." ) ,
106108 ) ;
107109
108- if ui. button ( "Send" ) . clicked ( ) || ( input_response. has_focus ( ) && ui. input ( |i| i. key_pressed ( egui:: Key :: Enter ) && !i. modifiers . shift ) ) {
110+ let enter_without_shift = input_response. has_focus ( )
111+ && ui. input ( |i| i. key_pressed ( egui:: Key :: Enter ) && !i. modifiers . shift ) ;
112+
113+ if ui. button ( "Send" ) . clicked ( ) || enter_without_shift {
109114 self . send_message ( ) ;
110115 input_response. request_focus ( ) ;
111116 }
You can’t perform that action at this time.
0 commit comments