Skip to content

Commit

Permalink
Models are updated based on the OpenAI's documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliDehbansiahkarbon committed Apr 20, 2024
1 parent d6539cc commit 36f25f2
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 31 deletions.
1 change: 0 additions & 1 deletion Forms/UChatGPTQFrame.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ object Fram_Question: TFram_Question
FieldName = 'HID'
Origin = 'HID'
ProviderFlags = [pfInWhere, pfInKey]
ReadOnly = True
end
object FDQryHistoryQuestion: TWideMemoField
Alignment = taCenter
Expand Down
56 changes: 50 additions & 6 deletions Forms/UChatGPTQuestion.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
30 changes: 6 additions & 24 deletions Forms/UChatGPTSetting.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -204,7 +197,6 @@ object Frm_Setting: TFrm_Setting
Align = alTop
Caption = 'History'
TabOrder = 0
ExplicitWidth = 425
object pnlHistory: TPanel
AlignWithMargins = True
Left = 5
Expand All @@ -214,7 +206,6 @@ object Frm_Setting: TFrm_Setting
Align = alClient
BevelOuter = bvLowered
TabOrder = 0
ExplicitWidth = 415
DesignSize = (
423
71)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions UChatGptMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions Utils/UConsts.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 36f25f2

Please sign in to comment.