Добавил интеграции с ОБС

This commit is contained in:
PC1\PTyTb
2025-08-07 21:58:46 +03:00
parent a4cbf1c709
commit 193e4cb2fa
14 changed files with 534 additions and 229 deletions
+69 -95
View File
@@ -8,7 +8,7 @@ uses
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.TabControl,
FMX.Controls.Presentation, FMX.StdCtrls, System.ImageList, FMX.ImgList,
FMX.Styles, ShellAPI, StrUtils,
fSettings, fAI, fNotify, fAutoActions, FMX.ListBox, fLog, uRecords,
fSettings, fAI, fNotify, fAutoActions, FMX.ListBox, fLog, uRecords,
System.IOUtils, fCommands, uDataBase, FMX.Edit, FMX.Colors, FMX.SpinBox,
windows, System.Skia, FMX.Skia, uCreateChat, uCreateNotify, fOBS;
@@ -57,11 +57,9 @@ type
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure frChatOBS1btnCreateChatClick(Sender: TObject);
procedure frOBS1btnCreateOBSNotifyClick(Sender: TObject);
procedure frOBS1btnCreateOBSKandinskyClick(Sender: TObject);
procedure frSettings1btnDAStartClick(Sender: TObject);
procedure frCommands1btnRandAddClick(Sender: TObject);
procedure frOBS1btnDeleteeChatClick(Sender: TObject);
private
{ Private declarations }
procedure ReadDB();
@@ -136,57 +134,34 @@ begin
db := TSettingsDatabase.Create(myConst.DBPath);
ReadDB;
frCommands1.frsgSounds.ObjectRecord:=frCommands1.listSounds;
frCommands1.frsgSounds.TableName:='listSounds';
frCommands1.frsgSounds.ObjectRecord := frCommands1.listSounds;
frCommands1.frsgSounds.TableName := 'listSounds';
frCommands1.frsgSounds.UpdateGrid;
frCommands1.frsgFiles.ObjectRecord:=frCommands1.listFiles;
frCommands1.frsgFiles.TableName:='listFiles';
frCommands1.frsgFiles.ObjectRecord := frCommands1.listFiles;
frCommands1.frsgFiles.TableName := 'listFiles';
frCommands1.frsgFiles.UpdateGrid;
frCommands1.frsgNeiro.ObjectRecord:=frCommands1.listNeiro;
frCommands1.frsgNeiro.TableName:='listNeiro';
frCommands1.frsgNeiro.ObjectRecord := frCommands1.listNeiro;
frCommands1.frsgNeiro.TableName := 'listNeiro';
frCommands1.frsgNeiro.UpdateGrid;
for Path in TDirectory.GetFiles(myConst.stlPath) do
cbTheme.Items.Add(ExtractFileName(Path));
cbTheme.ItemIndex := strtoint(db.ReadSetting('cbTheme', '-1'));
end;
procedure TTTW_Bot.frChatOBS1btnCreateChatClick(Sender: TObject);
begin
fCreateChat.Show;
end;
procedure TTTW_Bot.frCommands1btnRandAddClick(Sender: TObject);
begin
frCommands1.btnRandAddClick(Sender);
end;
procedure TTTW_Bot.frOBS1btnCreateOBSKandinskyClick(Sender: TObject);
var dport:integer;
I: Integer;
procedure TTTW_Bot.frOBS1btnDeleteeChatClick(Sender: TObject);
begin
dport:=8080;
for I := 0 to frOBS1.sgWebChats.RowCount-1 do
begin
if strtoint(frOBS1.sgWebChats.Cells[0,i]) >= dport then
dport:=strtoint(frOBS1.sgWebChats.Cells[0,i])+1;
end;
frOBS1.sgWebChats.RowCount:=frOBS1.sgWebChats.RowCount+1;
frOBS1.sgWebChats.Cells[0,frOBS1.sgWebChats.RowCount-1]:=inttostr(dport);
frOBS1.sgWebChats.Cells[1,frOBS1.sgWebChats.RowCount-1]:='Kandinsky';
frOBS1.sgWebChats.Cells[2,frOBS1.sgWebChats.RowCount-1]:='http://127.0.0.1:'+inttostr(dport);
frOBS1.btnDeleteeChatClick(Sender);
end;
procedure TTTW_Bot.frOBS1btnCreateOBSNotifyClick(Sender: TObject);
begin
fCreateNotify.Show;
end;
procedure TTTW_Bot.frSettings1btnDAStartClick(Sender: TObject);
begin
frSettings1.btnDAStartClick(Sender);
@@ -269,18 +244,19 @@ var
// Çàãðóçêà äàííûõ â ãðèäû êîìàíä
procedure LoadGridsData;
begin
DB.LoadRecordArray<TRandomCounters>('RandomCounters', frCommands1.RandomCounters);
DB.LoadRecordArray<TListCommands>('listSounds', frCommands1.listSounds);
DB.LoadRecordArray<TListCommands>('listFiles', frCommands1.listFiles);
DB.LoadRecordArray<TListCommands>('listNeiro', frCommands1.listNeiro);
DB.LoadRecordArray<TListCommands>('listCommands', frCommands1.listCommands);
db.LoadRecordArray<TRandomCounters>('RandomCounters',
frCommands1.RandomCounters);
db.LoadRecordArray<TListCommands>('listSounds', frCommands1.listSounds);
db.LoadRecordArray<TListCommands>('listFiles', frCommands1.listFiles);
db.LoadRecordArray<TListCommands>('listNeiro', frCommands1.listNeiro);
db.LoadRecordArray<TListCommands>('listCommands', frCommands1.listCommands);
frCommands1.UpdateGridFromArray;
db.LoadRecordArray<TOBSChat>('listChats', frOBS1.listChats);
db.LoadRecordArray<TOBSNotify>('listNotify', frOBS1.listNotify);
db.LoadRecordArray<TOBSKandinsky>('listKandinsky', frOBS1.listKandinsky);
frOBS1.UpdateGridFromArray;
frCommands1.UpdateGridFromArray;
{ db.LoadGridFromTable('sgRandomInt', frCommands1.sgRandomInt);
db.LoadGridFromTable('sgCommands', frCommands1.sgCommands);
db.LoadGridFromTable('sgSAFiles', frCommands1.sgSAFiles);
db.LoadGridFromTable('sgTFiles', frCommands1.sgTFiles);
db.LoadGridFromTable('sgAIGen', frCommands1.sgAIGen); }
end;
// Çàãðóçêà ñïèñêà ãðóïï
@@ -371,55 +347,56 @@ var
ii: Integer;
// Íàñòðîéêè GigaChat
procedure SetupGigaChatSettings;
begin
frAI1.rbGC.IsChecked := True;
frAI1.Label45.text := 'ClientID';
frAI1.Label47.text := 'Autorization Code';
frAI1.Label1.Visible := False;
frAI1.edtAIP2.Visible := True;
frAI1.edtAIP2.Password := True;
frAI1.edtAIP3.Visible := False;
frAI1.cbOllama.Visible := False;
end;
procedure SetupGigaChatSettings;
begin
frAI1.rbGC.IsChecked := True;
frAI1.Label45.text := 'ClientID';
frAI1.Label47.text := 'Autorization Code';
frAI1.Label1.Visible := False;
frAI1.edtAIP2.Visible := True;
frAI1.edtAIP2.Password := True;
frAI1.edtAIP3.Visible := False;
frAI1.cbOllama.Visible := False;
end;
// Íàñòðîéêè DeepSeek
procedure SetupDeepSeekSettings;
begin
frAI1.rbDS.IsChecked := True;
frAI1.Label45.text := 'API Token';
frAI1.Label47.text := '';
frAI1.Label1.Visible := False;
frAI1.edtAIP2.Visible := False;
frAI1.edtAIP3.Visible := False;
frAI1.cbOllama.Visible := False;
end;
// Íàñòðîéêè DeepSeek
procedure SetupDeepSeekSettings;
begin
frAI1.rbDS.IsChecked := True;
frAI1.Label45.text := 'API Token';
frAI1.Label47.text := '';
frAI1.Label1.Visible := False;
frAI1.edtAIP2.Visible := False;
frAI1.edtAIP3.Visible := False;
frAI1.cbOllama.Visible := False;
end;
// Íàñòðîéêè ChatGPT
procedure SetupChatGPTSettings;
begin
frAI1.rbCG.IsChecked := True;
frAI1.Label45.text := 'API Token';
frAI1.Label47.text := '';
frAI1.Label1.Visible := False;
frAI1.edtAIP2.Visible := False;
frAI1.edtAIP3.Visible := False;
frAI1.cbOllama.Visible := False;
end;
// Íàñòðîéêè ChatGPT
procedure SetupChatGPTSettings;
begin
frAI1.rbCG.IsChecked := True;
frAI1.Label45.text := 'API Token';
frAI1.Label47.text := '';
frAI1.Label1.Visible := False;
frAI1.edtAIP2.Visible := False;
frAI1.edtAIP3.Visible := False;
frAI1.cbOllama.Visible := False;
end;
// Íàñòðîéêè êàñòîìíîãî ÈÈ
procedure SetupCustomAISettings;
begin
frAI1.RBCustom.IsChecked := True;
frAI1.Label45.text := 'API Token';
frAI1.Label47.text := 'URL';
frAI1.Label1.Visible := True;
frAI1.edtAIP2.Visible := True;
frAI1.edtAIP2.Password := False;
frAI1.edtAIP3.Visible := True;
frAI1.cbOllama.Visible := True;
frAI1.cbOllama.IsChecked := db.ReadSetting(frAI1.cbOllama.Name) = '1';
end;
// Íàñòðîéêè êàñòîìíîãî ÈÈ
procedure SetupCustomAISettings;
begin
frAI1.RBCustom.IsChecked := True;
frAI1.Label45.text := 'API Token';
frAI1.Label47.text := 'URL';
frAI1.Label1.Visible := True;
frAI1.edtAIP2.Visible := True;
frAI1.edtAIP2.Password := False;
frAI1.edtAIP3.Visible := True;
frAI1.cbOllama.Visible := True;
frAI1.cbOllama.IsChecked := db.ReadSetting(frAI1.cbOllama.Name) = '1';
end;
begin
for I := 0 to frAI1.ComponentCount - 1 do
begin
@@ -445,8 +422,6 @@ var
frSettings1.init;
end;
// Çàãðóçêà ãðèäîâ àâòîìàòè÷åñêèõ äåéñòâèé
procedure LoadAutoActionsGrids;
begin
@@ -461,7 +436,6 @@ begin
LoadGroupNames;
LoadEncryptedConfig;
LoadNotifySettings;
LoadAISettings;
LoadAutoActionsGrids;