diff --git a/Forms/UChatGPTQFrame.dfm b/Forms/UChatGPTQFrame.dfm index 447a909..50521db 100644 --- a/Forms/UChatGPTQFrame.dfm +++ b/Forms/UChatGPTQFrame.dfm @@ -532,7 +532,6 @@ object Fram_Question: TFram_Question FieldName = 'HID' Origin = 'HID' ProviderFlags = [pfInWhere, pfInKey] - ReadOnly = True end object FDQryHistoryQuestion: TWideMemoField Alignment = taCenter diff --git a/Forms/UChatGPTQuestion.dfm b/Forms/UChatGPTQuestion.dfm index 3aeb25b..538c256 100644 --- a/Forms/UChatGPTQuestion.dfm +++ b/Forms/UChatGPTQuestion.dfm @@ -38,10 +38,12 @@ object FrmChatGPT: TFrmChatGPT inherited pnlMain: TPanel Width = 413 Height = 421 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 409 ExplicitHeight = 420 inherited pnlTop: TPanel Width = 411 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 407 inherited btnHelp: TSpeedButton Left = 386 @@ -51,6 +53,7 @@ object FrmChatGPT: TFrmChatGPT inherited pnlCenter: TPanel Width = 411 Height = 375 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 407 ExplicitHeight = 374 inherited splitter: TSplitter @@ -60,6 +63,7 @@ object FrmChatGPT: TFrmChatGPT inherited pnlAnswer: TPanel Width = 411 Height = 258 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 407 ExplicitHeight = 257 inherited pgcAnswers: TPageControl @@ -73,17 +77,33 @@ object FrmChatGPT: TFrmChatGPT inherited mmoAnswer: TMemo Width = 401 Height = 228 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 397 ExplicitHeight = 227 end end + inherited tsWriteSonicAnswer: TTabSheet + inherited mmoWriteSonicAnswer: TMemo + StyleElements = [seFont, seClient, seBorder] + end + end + inherited tsYouChat: TTabSheet + inherited mmoYouChatAnswer: TMemo + StyleElements = [seFont, seClient, seBorder] + end + end end end inherited pnlQuestion: TPanel Width = 411 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 407 + inherited Lbl_Question: TLabel + StyleElements = [seFont, seClient, seBorder] + end inherited mmoQuestion: TMemo Width = 411 + StyleElements = [seFont, seClient, seBorder] ExplicitWidth = 407 end end @@ -94,26 +114,50 @@ object FrmChatGPT: TFrmChatGPT inherited splClassView: TSplitter ExplicitWidth = 421 end + inherited pnlClasses: TPanel + StyleElements = [seFont, seClient, seBorder] + end + inherited pnlPredefinedCmdAnswer: TPanel + StyleElements = [seFont, seClient, seBorder] + inherited mmoClassViewDetail: TMemo + StyleElements = [seFont, seClient, seBorder] + end + inherited mmoClassViewResult: TMemo + StyleElements = [seFont, seClient, seBorder] + end + end end inherited tsHistory: TTabSheet inherited splHistory: TSplitter ExplicitWidth = 421 end + inherited pnlHistoryTop: TPanel + StyleElements = [seFont, seClient, seBorder] + inherited pnlSearchHistory: TPanel + StyleElements = [seFont, seClient, seBorder] + inherited Edt_Search: TEdit + StyleElements = [seFont, seClient, seBorder] + end + end + end + inherited pnlHistoryBottom: TPanel + StyleElements = [seFont, seClient, seBorder] + inherited mmoHistoryDetail: TMemo + StyleElements = [seFont, seClient, seBorder] + end + end end end inherited pnlBottom: TPanel Top = 451 Width = 421 - ExplicitTop = 450 - ExplicitWidth = 417 + StyleElements = [seFont, seClient, seBorder] + ExplicitTop = 451 + ExplicitWidth = 421 inherited chk_AutoCopy: TCheckBox Left = 261 ExplicitLeft = 257 end - inherited ActivityIndicator1: TActivityIndicator - ExplicitWidth = 24 - ExplicitHeight = 24 - end end end end diff --git a/Forms/UChatGPTSetting.dfm b/Forms/UChatGPTSetting.dfm index 45e18ee..5e90a83 100644 --- a/Forms/UChatGPTSetting.dfm +++ b/Forms/UChatGPTSetting.dfm @@ -25,8 +25,6 @@ object Frm_Setting: TFrm_Setting Align = alClient TabOrder = 0 OnChange = pgcSettingChange - ExplicitWidth = 437 - ExplicitHeight = 533 object tsMainSetting: TTabSheet Caption = 'Main Setting' object pnlMain: TPanel @@ -36,8 +34,6 @@ object Frm_Setting: TFrm_Setting Height = 515 Align = alClient TabOrder = 0 - ExplicitWidth = 429 - ExplicitHeight = 503 object grp_OpenAI: TGroupBox Left = 1 Top = 1 @@ -46,7 +42,6 @@ object Frm_Setting: TFrm_Setting Align = alTop Caption = 'OpenAI preferences' TabOrder = 0 - ExplicitWidth = 427 object pnlOpenAI: TPanel AlignWithMargins = True Left = 5 @@ -56,7 +51,6 @@ object Frm_Setting: TFrm_Setting Align = alClient BevelOuter = bvLowered TabOrder = 0 - ExplicitWidth = 417 object lbl_1: TLabel Left = 30 Top = 18 @@ -146,7 +140,8 @@ object Frm_Setting: TFrm_Setting 'gpt-3.5-turbo' 'gpt-3.5-turbo-16k' 'gpt-4' - 'gpt-4-32k') + 'gpt-4-turbo' + 'gpt-4-turbo-preview') end object lbEdt_Timeout: TLabeledEdit Left = 126 @@ -194,8 +189,6 @@ object Frm_Setting: TFrm_Setting Height = 353 Align = alClient TabOrder = 1 - ExplicitWidth = 427 - ExplicitHeight = 341 object grp_History: TGroupBox Left = 1 Top = 1 @@ -204,7 +197,6 @@ object Frm_Setting: TFrm_Setting Align = alTop Caption = 'History' TabOrder = 0 - ExplicitWidth = 425 object pnlHistory: TPanel AlignWithMargins = True Left = 5 @@ -214,7 +206,6 @@ object Frm_Setting: TFrm_Setting Align = alClient BevelOuter = bvLowered TabOrder = 0 - ExplicitWidth = 415 DesignSize = ( 423 71) @@ -236,7 +227,6 @@ object Frm_Setting: TFrm_Setting ParentBiDiMode = False TabOrder = 0 OnClick = chk_HistoryClick - ExplicitWidth = 52 end object lbEdt_History: TLabeledEdit Left = 79 @@ -285,7 +275,6 @@ object Frm_Setting: TFrm_Setting Align = alTop Caption = 'Proxy Setting' TabOrder = 1 - ExplicitWidth = 425 object pnlProxy: TPanel AlignWithMargins = True Left = 5 @@ -295,7 +284,6 @@ object Frm_Setting: TFrm_Setting Align = alClient BevelOuter = bvLowered TabOrder = 0 - ExplicitWidth = 415 object lbEdt_ProxyHost: TLabeledEdit Left = 71 Top = 11 @@ -368,7 +356,6 @@ object Frm_Setting: TFrm_Setting Align = alTop Caption = 'IDE && Other' TabOrder = 2 - ExplicitWidth = 425 object pnlIDE: TPanel AlignWithMargins = True Left = 5 @@ -378,7 +365,6 @@ object Frm_Setting: TFrm_Setting Align = alClient BevelOuter = bvLowered TabOrder = 0 - ExplicitWidth = 415 object lbl_6: TLabel Left = 271 Top = 17 @@ -627,32 +613,28 @@ object Frm_Setting: TFrm_Setting Align = alBottom BevelOuter = bvLowered TabOrder = 1 - ExplicitTop = 533 - ExplicitWidth = 437 DesignSize = ( 445 46) object Btn_Default: TButton - Left = 244 - Top = 10 + Left = 260 + Top = 9 Width = 89 Height = 28 Anchors = [akRight, akBottom] Caption = 'Load Defaults' TabOrder = 0 OnClick = Btn_DefaultClick - ExplicitLeft = 236 end object Btn_Save: TButton - Left = 335 - Top = 10 + Left = 351 + Top = 9 Width = 89 Height = 28 Anchors = [akRight, akBottom] Caption = 'Save && Close' TabOrder = 1 OnClick = Btn_SaveClick - ExplicitLeft = 327 end end end diff --git a/UChatGptMain.pas b/UChatGptMain.pas index 0abfa7d..12234e9 100644 --- a/UChatGptMain.pas +++ b/UChatGptMain.pas @@ -633,6 +633,11 @@ procedure TChatGptMenuWizard.RenewUI(AForm: TCustomForm); Btn_Clipboard.Anchors := [TAnchorKind.akTop, TAnchorKind.akLeft]; Btn_Clear.Anchors := [TAnchorKind.akTop, TAnchorKind.akLeft]; end; + + if TSingletonSettingObj.Instance.IsOffline then + tsChatGPTAnswer.Caption := 'Ollama(Offline)' + else + tsChatGPTAnswer.Caption := 'OpenAI(ChatGPT)'; end; Cs.Leave; end; @@ -1138,8 +1143,15 @@ procedure TChatGPTDockForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TS procedure TChatGPTDockForm.FormShow(Sender: TObject); begin Cs.Enter; + + if TSingletonSettingObj.Instance.IsOffline then + Fram_Question.tsChatGPTAnswer.Caption := 'Ollama(Offline)' + else + Fram_Question.tsChatGPTAnswer.Caption := 'OpenAI(ChatGPT)'; + Fram_Question.tsWriteSonicAnswer.TabVisible := (CompilerVersion >= 32) and (TSingletonSettingObj.Instance.EnableWriteSonic); Fram_Question.tsYouChat.TabVisible := (CompilerVersion >= 32) and (TSingletonSettingObj.Instance.EnableYouChat); + Cs.Leave; end; diff --git a/Utils/UConsts.pas b/Utils/UConsts.pas index 50dced4..0f4f494 100644 --- a/Utils/UConsts.pas +++ b/Utils/UConsts.pas @@ -11,6 +11,7 @@ interface WM_YOUCHAT_UPDATE_MESSAGE = WM_USER + 5877; DefaultChatGPTURL = 'https://api.openai.com/v1/chat/completions'; + DefaultChatGPTURL_Offline = 'http://localhost:11434/api/generate'; DefaultModel = 'gpt-3.5-turbo'; DefaultMaxToken = 2048; DefaultTemperature = 0;