120 lines
2.8 KiB
Plaintext
120 lines
2.8 KiB
Plaintext
unit fAI;
|
|
|
|
interface
|
|
|
|
uses
|
|
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
|
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
|
FMX.Edit, FMX.Controls.Presentation;
|
|
|
|
type
|
|
TfrAI = class(TFrame)
|
|
btnGetAIDef: TButton;
|
|
edtAIP2: TEdit;
|
|
edtAIP1: TEdit;
|
|
edtGPTPrefix: TEdit;
|
|
Label45: TLabel;
|
|
Label47: TLabel;
|
|
GroupBox1: TGroupBox;
|
|
rbGC: TRadioButton;
|
|
RBCustom: TRadioButton;
|
|
rbDS: TRadioButton;
|
|
rbCG: TRadioButton;
|
|
edtAIP3: TEdit;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
cbOllama: TCheckBox;
|
|
GroupBox2: TGroupBox;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
edtKandiKey: TEdit;
|
|
edtKandiSecret: TEdit;
|
|
procedure RBCustomChange(Sender: TObject);
|
|
procedure btnGetAIDefClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.fmx}
|
|
|
|
uses uGeneral;
|
|
|
|
procedure TfrAI.btnGetAIDefClick(Sender: TObject);
|
|
begin
|
|
rbGC.IsChecked := true;
|
|
if appconst.AI_GigaChat_ClientID <> '' then
|
|
edtAIP1.text := appconst.AI_GigaChat_ClientID;
|
|
if appconst.AI_GigaChat_AC <> '' then
|
|
edtAIP2.text := appconst.AI_GigaChat_AC;
|
|
|
|
DB.WriteSetting('edtAIP1', edtAIP1.text);
|
|
DB.WriteSetting('edtAIP2', edtAIP2.text);
|
|
end;
|
|
|
|
procedure TfrAI.RBCustomChange(Sender: TObject);
|
|
var
|
|
aiIndex: Integer;
|
|
begin
|
|
aiIndex := -1;
|
|
if TRadioButton(Sender).IsChecked then
|
|
aiIndex := strtoint(TRadioButton(Sender).Hint);
|
|
if aiIndex = -1 then
|
|
exit;
|
|
case aiIndex of
|
|
0:
|
|
begin
|
|
Label45.text := 'ClientID';
|
|
Label47.text := 'Autorization Code';
|
|
Label1.Visible := false;
|
|
edtAIP2.Visible := true;
|
|
edtAIP2.Password := true;
|
|
edtAIP3.Visible := false;
|
|
cbOllama.IsChecked:=false;
|
|
cbOllama.Visible:=false;
|
|
end;
|
|
1:
|
|
begin
|
|
Label45.text := 'API Token';
|
|
Label47.text := '';
|
|
Label1.Visible := false;
|
|
edtAIP2.Visible := false;
|
|
edtAIP2.Password := false;
|
|
edtAIP3.Visible := false;
|
|
cbOllama.IsChecked:=false;
|
|
cbOllama.Visible:=false;
|
|
end;
|
|
2:
|
|
begin
|
|
Label45.text := 'API Token';
|
|
Label47.text := '';
|
|
Label1.Visible := false;
|
|
edtAIP2.Visible := false;
|
|
edtAIP2.Password := false;
|
|
edtAIP3.Visible := false;
|
|
cbOllama.IsChecked:=false;
|
|
cbOllama.Visible:=false;
|
|
end;
|
|
3:
|
|
begin
|
|
Label45.text := 'API Token';
|
|
Label47.text := 'URL';
|
|
Label1.Visible := true;
|
|
edtAIP2.Visible := true;
|
|
edtAIP2.Password := false;
|
|
edtAIP3.Visible := true;
|
|
cbOllama.IsChecked:=false;
|
|
cbOllama.Visible:=true;
|
|
end;
|
|
end;
|
|
DB.WriteSetting('aiIndex', inttostr(aiIndex));
|
|
end;
|
|
|
|
|
|
|
|
end.
|