Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5456d97
commit 06648c2
Showing
6 changed files
with
352 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
-$A8 | ||
-$B- | ||
-$C+ | ||
-$D+ | ||
-$E- | ||
-$F- | ||
-$G+ | ||
-$H+ | ||
-$I+ | ||
-$J- | ||
-$K- | ||
-$L+ | ||
-$M- | ||
-$N+ | ||
-$O+ | ||
-$P+ | ||
-$Q- | ||
-$R- | ||
-$S- | ||
-$T- | ||
-$U- | ||
-$V+ | ||
-$W- | ||
-$X+ | ||
-$YD | ||
-$Z1 | ||
-cg | ||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | ||
-H+ | ||
-W+ | ||
-M | ||
-$M16384,1048576 | ||
-K$00400000 | ||
-N"dcu" | ||
-LE"c:\delphi7\Projects\Bpl" | ||
-LN"c:\delphi7\Projects\Bpl" | ||
-DJSONDOC_STOREINDENTING | ||
-w-UNSAFE_TYPE | ||
-w-UNSAFE_CODE | ||
-w-UNSAFE_CAST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
[FileVersion] | ||
Version=7.0 | ||
[Compiler] | ||
A=8 | ||
B=0 | ||
C=1 | ||
D=1 | ||
E=0 | ||
F=0 | ||
G=1 | ||
H=1 | ||
I=1 | ||
J=0 | ||
K=0 | ||
L=1 | ||
M=0 | ||
N=1 | ||
O=1 | ||
P=1 | ||
Q=0 | ||
R=0 | ||
S=0 | ||
T=0 | ||
U=0 | ||
V=1 | ||
W=0 | ||
X=1 | ||
Y=1 | ||
Z=1 | ||
ShowHints=1 | ||
ShowWarnings=1 | ||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | ||
NamespacePrefix= | ||
SymbolDeprecated=1 | ||
SymbolLibrary=1 | ||
SymbolPlatform=1 | ||
UnitLibrary=1 | ||
UnitPlatform=1 | ||
UnitDeprecated=1 | ||
HResultCompat=1 | ||
HidingMember=1 | ||
HiddenVirtual=1 | ||
Garbage=1 | ||
BoundsError=1 | ||
ZeroNilCompat=1 | ||
StringConstTruncated=1 | ||
ForLoopVarVarPar=1 | ||
TypedConstVarPar=1 | ||
AsgToTypedConst=1 | ||
CaseLabelRange=1 | ||
ForVariable=1 | ||
ConstructingAbstract=1 | ||
ComparisonFalse=1 | ||
ComparisonTrue=1 | ||
ComparingSignedUnsigned=1 | ||
CombiningSignedUnsigned=1 | ||
UnsupportedConstruct=1 | ||
FileOpen=1 | ||
FileOpenUnitSrc=1 | ||
BadGlobalSymbol=1 | ||
DuplicateConstructorDestructor=1 | ||
InvalidDirective=1 | ||
PackageNoLink=1 | ||
PackageThreadVar=1 | ||
ImplicitImport=1 | ||
HPPEMITIgnored=1 | ||
NoRetVal=1 | ||
UseBeforeDef=1 | ||
ForLoopVarUndef=1 | ||
UnitNameMismatch=1 | ||
NoCFGFileFound=1 | ||
MessageDirective=1 | ||
ImplicitVariants=1 | ||
UnicodeToLocale=1 | ||
LocaleToUnicode=1 | ||
ImagebaseMultiple=1 | ||
SuspiciousTypecast=1 | ||
PrivatePropAccessor=1 | ||
UnsafeType=0 | ||
UnsafeCode=0 | ||
UnsafeCast=0 | ||
[Linker] | ||
MapFile=0 | ||
OutputObjs=0 | ||
ConsoleApp=1 | ||
DebugInfo=0 | ||
RemoteSymbols=0 | ||
MinStackSize=16384 | ||
MaxStackSize=1048576 | ||
ImageBase=4194304 | ||
ExeDescription= | ||
[Directories] | ||
OutputDir= | ||
UnitOutputDir=dcu | ||
PackageDLLOutputDir= | ||
PackageDCPOutputDir= | ||
SearchPath= | ||
Packages=vcl;rtl;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;vclx;dbrtl;soaprtl;dsnap;VclSmp;dbexpress;vcldb;dbxcds;adortl;ibxpress;vclactnband;bdertl;vclshlctrls;dclOfficeXP;RoComponents;DCEF_D7;GR32_D7 | ||
Conditionals=JSONDOC_STOREINDENTING | ||
DebugSourceDirs= | ||
UsePackages=0 | ||
[Parameters] | ||
RunParams= | ||
HostApplication= | ||
Launcher= | ||
UseLauncher=0 | ||
DebugCWD= | ||
[Version Info] | ||
IncludeVerInfo=0 | ||
AutoIncBuild=0 | ||
MajorVer=1 | ||
MinorVer=0 | ||
Release=0 | ||
Build=0 | ||
Debug=0 | ||
PreRelease=0 | ||
Special=0 | ||
Private=0 | ||
DLL=0 | ||
Locale=2067 | ||
CodePage=1252 | ||
[Version Info Keys] | ||
CompanyName= | ||
FileDescription= | ||
FileVersion=1.0.0.0 | ||
InternalName= | ||
LegalCopyright= | ||
LegalTrademarks= | ||
OriginalFilename= | ||
ProductName= | ||
ProductVersion=1.0.0.0 | ||
Comments= | ||
[HistoryLists\hlConditionals] | ||
Count=1 | ||
Item0=JSONDOC_STOREINDENTING | ||
[HistoryLists\hlUnitAliases] | ||
Count=1 | ||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | ||
[HistoryLists\hlSearchPath] | ||
Count=5 | ||
Item0=sdk;..\public;FastMM | ||
Item1=sdk;..\public;FastMM4 | ||
Item2=sdk;..\public | ||
Item3=C:\Program Files\Indy9 | ||
Item4=..\..\public | ||
[HistoryLists\hlUnitOutputDirectory] | ||
Count=2 | ||
Item0=dcu | ||
Item1=..\dcu | ||
[HistoryLists\hlOutputDirectorry] | ||
Count=5 | ||
Item0=setup\xxmGeckoDev\platform\WINNT\components | ||
Item1=..\bin | ||
Item2=C:\Program Files\Mozilla Firefox\components | ||
Item3=C:\Inetpub\xxm | ||
Item4=..\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
program bottest; | ||
|
||
uses | ||
Forms, | ||
bottest1 in 'bottest1.pas' {frmBotTest}, | ||
jsonDoc in '..\jsonDoc.pas', | ||
chatbot in '..\chatbot.pas'; | ||
|
||
{$R *.res} | ||
|
||
begin | ||
Application.Initialize; | ||
Application.CreateForm(TfrmBotTest, frmBotTest); | ||
Application.Run; | ||
end. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
object frmBotTest: TfrmBotTest | ||
Left = 192 | ||
Top = 125 | ||
Width = 433 | ||
Height = 384 | ||
BorderWidth = 4 | ||
Caption = 'BotTest' | ||
Color = clBtnFace | ||
Font.Charset = DEFAULT_CHARSET | ||
Font.Color = clWindowText | ||
Font.Height = -16 | ||
Font.Name = 'Georgia' | ||
Font.Style = [] | ||
OldCreateOrder = False | ||
Position = poDefaultPosOnly | ||
OnShow = FormShow | ||
PixelsPerInch = 96 | ||
TextHeight = 18 | ||
object Splitter1: TSplitter | ||
Left = 0 | ||
Top = 172 | ||
Width = 409 | ||
Height = 4 | ||
Cursor = crVSplit | ||
Align = alBottom | ||
end | ||
object txtConversation: TMemo | ||
Left = 0 | ||
Top = 176 | ||
Width = 409 | ||
Height = 130 | ||
Align = alBottom | ||
ReadOnly = True | ||
ScrollBars = ssVertical | ||
TabOrder = 1 | ||
end | ||
object txtState: TMemo | ||
Left = 0 | ||
Top = 0 | ||
Width = 409 | ||
Height = 172 | ||
Align = alClient | ||
Lines.Strings = ( | ||
'{}') | ||
ScrollBars = ssBoth | ||
TabOrder = 2 | ||
WordWrap = False | ||
end | ||
object txtInput: TMemo | ||
Left = 0 | ||
Top = 306 | ||
Width = 409 | ||
Height = 31 | ||
Align = alBottom | ||
TabOrder = 0 | ||
WordWrap = False | ||
OnKeyPress = txtInputKeyPress | ||
end | ||
object OpenDialog1: TOpenDialog | ||
DefaultExt = 'txt' | ||
Filter = 'ChatBot script (*.txt)|*.txt|All files (*.*)|*.*' | ||
InitialDir = '.' | ||
Title = 'Load ChatBot Script' | ||
Left = 16 | ||
Top = 16 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
unit bottest1; | ||
|
||
interface | ||
|
||
uses | ||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | ||
Dialogs, StdCtrls, ExtCtrls; | ||
|
||
type | ||
TfrmBotTest = class(TForm) | ||
txtConversation: TMemo; | ||
txtState: TMemo; | ||
OpenDialog1: TOpenDialog; | ||
Splitter1: TSplitter; | ||
txtInput: TMemo; | ||
procedure txtInputKeyPress(Sender: TObject; var Key: Char); | ||
procedure FormShow(Sender: TObject); | ||
private | ||
FScriptFilePath:string; | ||
end; | ||
|
||
var | ||
frmBotTest: TfrmBotTest; | ||
|
||
implementation | ||
|
||
uses | ||
jsonDoc, chatbot; | ||
|
||
{$R *.dfm} | ||
|
||
procedure TfrmBotTest.FormShow(Sender: TObject); | ||
begin | ||
if ParamCount=0 then | ||
if OpenDialog1.Execute then | ||
FScriptFilePath:=OpenDialog1.FileName | ||
else | ||
Application.Terminate | ||
else | ||
FScriptFilePath:=ParamStr(1); | ||
end; | ||
|
||
procedure TfrmBotTest.txtInputKeyPress(Sender: TObject; var Key: Char); | ||
var | ||
s:string; | ||
d:IJSONDocument; | ||
bot:TChatBot; | ||
begin | ||
if Key=#13 then | ||
begin | ||
Key:=#0; | ||
s:=txtInput.Text; | ||
txtInput.Text:=''; | ||
|
||
d:=JSON.Parse(txtState.Text); | ||
|
||
bot:=TChatBot.Create; | ||
try | ||
bot.LoadFromFile(FScriptFilePath); | ||
|
||
txtConversation.Lines.Add('< '+s); | ||
txtConversation.Lines.Add('> '+bot.GetNextResponse(s,d)); | ||
txtConversation.Perform(EM_SCROLLCARET,0,0); | ||
txtConversation.Perform(EM_LINESCROLL,0,txtConversation.Lines.Count); | ||
|
||
txtState.Text:=d.ToString; | ||
finally | ||
bot.Free; | ||
end; | ||
|
||
end; | ||
end; | ||
|
||
end. |