HansBug commited on
Commit
2c2e788
1 Parent(s): 5ed2b28

dev(hansbug): init code

Browse files
.gitignore ADDED
@@ -0,0 +1,1225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ ### Example user template template
3
+ ### Example user template
4
+
5
+ # IntelliJ project files
6
+ .idea
7
+ *.iml
8
+ out
9
+ gen
10
+ ### CVS template
11
+ /CVS/*
12
+ **/CVS/*
13
+ .cvsignore
14
+ */.cvsignore
15
+
16
+ ### C++ template
17
+ # Prerequisites
18
+ *.d
19
+
20
+ # Compiled Object files
21
+ *.slo
22
+ *.lo
23
+ *.o
24
+ *.obj
25
+
26
+ # Precompiled Headers
27
+ *.gch
28
+ *.pch
29
+
30
+ # Compiled Dynamic libraries
31
+ *.so
32
+ *.dylib
33
+ *.dll
34
+
35
+ # Fortran module files
36
+ *.mod
37
+ *.smod
38
+
39
+ # Compiled Static libraries
40
+ *.lai
41
+ *.la
42
+ *.a
43
+ *.lib
44
+
45
+ # Executables
46
+ *.exe
47
+ *.out
48
+ *.app
49
+
50
+ ### CUDA template
51
+ *.i
52
+ *.ii
53
+ *.gpu
54
+ *.ptx
55
+ *.cubin
56
+ *.fatbin
57
+
58
+ ### SVN template
59
+ .svn/
60
+
61
+ ### Images template
62
+ # JPEG
63
+ *.jpe
64
+ *.jif
65
+ *.jfif
66
+ *.jfi
67
+
68
+ # JPEG 2000
69
+ *.jp2
70
+ *.j2k
71
+ *.jpf
72
+ *.jpx
73
+ *.jpm
74
+ *.mj2
75
+
76
+ # JPEG XR
77
+ *.jxr
78
+ *.hdp
79
+ *.wdp
80
+
81
+ # Graphics Interchange Format
82
+ *.gif
83
+
84
+ # RAW
85
+ *.raw
86
+
87
+ # Web P
88
+ *.webp
89
+
90
+ # Portable Network Graphics
91
+ #*.png
92
+
93
+ # Animated Portable Network Graphics
94
+ *.apng
95
+
96
+ # Multiple-image Network Graphics
97
+ *.mng
98
+
99
+ # Tagged Image File Format
100
+ *.tiff
101
+ *.tif
102
+
103
+ # Scalable Vector Graphics
104
+ *.svg
105
+ *.svgz
106
+
107
+ # Portable Document Format
108
+ *.pdf
109
+
110
+ # X BitMap
111
+ *.xbm
112
+
113
+ # BMP
114
+ *.bmp
115
+ *.dib
116
+
117
+ # ICO
118
+ *.ico
119
+
120
+ # 3D Images
121
+ *.3dm
122
+ *.max
123
+
124
+ ### Eclipse template
125
+ .metadata
126
+ bin/
127
+ tmp/
128
+ *.tmp
129
+ *.bak
130
+ *.swp
131
+ *~.nib
132
+ local.properties
133
+ .settings/
134
+ .loadpath
135
+ .recommenders
136
+
137
+ # External tool builders
138
+ .externalToolBuilders/
139
+
140
+ # Locally stored "Eclipse launch configurations"
141
+ *.launch
142
+
143
+ # PyDev specific (Python IDE for Eclipse)
144
+ *.pydevproject
145
+
146
+ # CDT-specific (C/C++ Development Tooling)
147
+ .cproject
148
+
149
+ # CDT- autotools
150
+ .autotools
151
+
152
+ # Java annotation processor (APT)
153
+ .factorypath
154
+
155
+ # PDT-specific (PHP Development Tools)
156
+ .buildpath
157
+
158
+ # sbteclipse plugin
159
+ .target
160
+
161
+ # Tern plugin
162
+ .tern-project
163
+
164
+ # TeXlipse plugin
165
+ .texlipse
166
+
167
+ # STS (Spring Tool Suite)
168
+ .springBeans
169
+
170
+ # Code Recommenders
171
+ .recommenders/
172
+
173
+ # Annotation Processing
174
+ .apt_generated/
175
+ .apt_generated_test/
176
+
177
+ # Scala IDE specific (Scala & Java development for Eclipse)
178
+ .cache-main
179
+ .scala_dependencies
180
+ .worksheet
181
+
182
+ # Uncomment this line if you wish to ignore the project description file.
183
+ # Typically, this file would be tracked if it contains build/dependency configurations:
184
+ #.project
185
+
186
+ ### Diff template
187
+ *.patch
188
+ *.diff
189
+
190
+ ### macOS template
191
+ # General
192
+ .DS_Store
193
+ .AppleDouble
194
+ .LSOverride
195
+
196
+ # Icon must end with two \r
197
+ Icon
198
+
199
+ # Thumbnails
200
+ ._*
201
+
202
+ # Files that might appear in the root of a volume
203
+ .DocumentRevisions-V100
204
+ .fseventsd
205
+ .Spotlight-V100
206
+ .TemporaryItems
207
+ .Trashes
208
+ .VolumeIcon.icns
209
+ .com.apple.timemachine.donotpresent
210
+
211
+ # Directories potentially created on remote AFP share
212
+ .AppleDB
213
+ .AppleDesktop
214
+ Network Trash Folder
215
+ Temporary Items
216
+ .apdisk
217
+
218
+ ### CMake template
219
+ CMakeLists.txt.user
220
+ CMakeCache.txt
221
+ CMakeFiles
222
+ CMakeScripts
223
+ Testing
224
+ cmake_install.cmake
225
+ install_manifest.txt
226
+ compile_commands.json
227
+ CTestTestfile.cmake
228
+ _deps
229
+
230
+ ### Linux template
231
+ *~
232
+
233
+ # temporary files which can be created if a process still has a handle open of a deleted file
234
+ .fuse_hidden*
235
+
236
+ # KDE directory preferences
237
+ .directory
238
+
239
+ # Linux trash folder which might appear on any partition or disk
240
+ .Trash-*
241
+
242
+ # .nfs files are created when an open file is removed but is still being accessed
243
+ .nfs*
244
+
245
+ ### MicrosoftOffice template
246
+ *.tmp
247
+
248
+ # Word temporary
249
+ ~$*.doc*
250
+
251
+ # Word Auto Backup File
252
+ Backup of *.doc*
253
+
254
+ # Excel temporary
255
+ ~$*.xls*
256
+
257
+ # Excel Backup File
258
+ *.xlk
259
+
260
+ # PowerPoint temporary
261
+ ~$*.ppt*
262
+
263
+ # Visio autosave temporary files
264
+ *.~vsd*
265
+
266
+ ### VisualStudio template
267
+ ## Ignore Visual Studio temporary files, build results, and
268
+ ## files generated by popular Visual Studio add-ons.
269
+ ##
270
+ ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
271
+
272
+ # User-specific files
273
+ *.rsuser
274
+ *.suo
275
+ *.user
276
+ *.userosscache
277
+ *.sln.docstates
278
+
279
+ # User-specific files (MonoDevelop/Xamarin Studio)
280
+ *.userprefs
281
+
282
+ # Mono auto generated files
283
+ mono_crash.*
284
+
285
+ # Build results
286
+ [Dd]ebug/
287
+ [Dd]ebugPublic/
288
+ [Rr]elease/
289
+ [Rr]eleases/
290
+ x64/
291
+ x86/
292
+ [Ww][Ii][Nn]32/
293
+ [Aa][Rr][Mm]/
294
+ [Aa][Rr][Mm]64/
295
+ bld/
296
+ [Bb]in/
297
+ [Oo]bj/
298
+ [Ll]og/
299
+ [Ll]ogs/
300
+
301
+ # Visual Studio 2015/2017 cache/options directory
302
+ .vs/
303
+ # Uncomment if you have tasks that create the project's static files in wwwroot
304
+ #wwwroot/
305
+
306
+ # Visual Studio 2017 auto generated files
307
+ Generated\ Files/
308
+
309
+ # MSTest test Results
310
+ [Tt]est[Rr]esult*/
311
+ [Bb]uild[Ll]og.*
312
+
313
+ # NUnit
314
+ *.VisualState.xml
315
+ TestResult.xml
316
+ nunit-*.xml
317
+
318
+ # Build Results of an ATL Project
319
+ [Dd]ebugPS/
320
+ [Rr]eleasePS/
321
+ dlldata.c
322
+
323
+ # Benchmark Results
324
+ BenchmarkDotNet.Artifacts/
325
+
326
+ # .NET Core
327
+ project.lock.json
328
+ project.fragment.lock.json
329
+ artifacts/
330
+
331
+ # ASP.NET Scaffolding
332
+ ScaffoldingReadMe.txt
333
+
334
+ # StyleCop
335
+ StyleCopReport.xml
336
+
337
+ # Files built by Visual Studio
338
+ *_i.c
339
+ *_p.c
340
+ *_h.h
341
+ *.ilk
342
+ *.meta
343
+ *.obj
344
+ *.iobj
345
+ *.pch
346
+ *.pdb
347
+ *.ipdb
348
+ *.pgc
349
+ *.pgd
350
+ *.rsp
351
+ *.sbr
352
+ *.tlb
353
+ *.tli
354
+ *.tlh
355
+ *.tmp
356
+ *.tmp_proj
357
+ *_wpftmp.csproj
358
+ *.log
359
+ *.vspscc
360
+ *.vssscc
361
+ .builds
362
+ *.pidb
363
+ *.svclog
364
+ *.scc
365
+
366
+ # Chutzpah Test files
367
+ _Chutzpah*
368
+
369
+ # Visual C++ cache files
370
+ ipch/
371
+ *.aps
372
+ *.ncb
373
+ *.opendb
374
+ *.opensdf
375
+ *.sdf
376
+ *.cachefile
377
+ *.VC.db
378
+ *.VC.VC.opendb
379
+
380
+ # Visual Studio profiler
381
+ *.psess
382
+ *.vsp
383
+ *.vspx
384
+ *.sap
385
+
386
+ # Visual Studio Trace Files
387
+ *.e2e
388
+
389
+ # TFS 2012 Local Workspace
390
+ $tf/
391
+
392
+ # Guidance Automation Toolkit
393
+ *.gpState
394
+
395
+ # ReSharper is a .NET coding add-in
396
+ _ReSharper*/
397
+ *.[Rr]e[Ss]harper
398
+ *.DotSettings.user
399
+
400
+ # TeamCity is a build add-in
401
+ _TeamCity*
402
+
403
+ # DotCover is a Code Coverage Tool
404
+ *.dotCover
405
+
406
+ # AxoCover is a Code Coverage Tool
407
+ .axoCover/*
408
+ !.axoCover/settings.json
409
+
410
+ # Coverlet is a free, cross platform Code Coverage Tool
411
+ coverage*.json
412
+ coverage*.xml
413
+ coverage*.info
414
+
415
+ # Visual Studio code coverage results
416
+ *.coverage
417
+ *.coveragexml
418
+
419
+ # NCrunch
420
+ _NCrunch_*
421
+ .*crunch*.local.xml
422
+ nCrunchTemp_*
423
+
424
+ # MightyMoose
425
+ *.mm.*
426
+ AutoTest.Net/
427
+
428
+ # Web workbench (sass)
429
+ .sass-cache/
430
+
431
+ # Installshield output folder
432
+ [Ee]xpress/
433
+
434
+ # DocProject is a documentation generator add-in
435
+ DocProject/buildhelp/
436
+ DocProject/Help/*.HxT
437
+ DocProject/Help/*.HxC
438
+ DocProject/Help/*.hhc
439
+ DocProject/Help/*.hhk
440
+ DocProject/Help/*.hhp
441
+ DocProject/Help/Html2
442
+ DocProject/Help/html
443
+
444
+ # Click-Once directory
445
+ publish/
446
+
447
+ # Publish Web Output
448
+ *.[Pp]ublish.xml
449
+ *.azurePubxml
450
+ # Note: Comment the next line if you want to checkin your web deploy settings,
451
+ # but database connection strings (with potential passwords) will be unencrypted
452
+ *.pubxml
453
+ *.publishproj
454
+
455
+ # Microsoft Azure Web App publish settings. Comment the next line if you want to
456
+ # checkin your Azure Web App publish settings, but sensitive information contained
457
+ # in these scripts will be unencrypted
458
+ PublishScripts/
459
+
460
+ # NuGet Packages
461
+ *.nupkg
462
+ # NuGet Symbol Packages
463
+ *.snupkg
464
+ # The packages folder can be ignored because of Package Restore
465
+ **/[Pp]ackages/*
466
+ # except build/, which is used as an MSBuild target.
467
+ !**/[Pp]ackages/build/
468
+ # Uncomment if necessary however generally it will be regenerated when needed
469
+ #!**/[Pp]ackages/repositories.config
470
+ # NuGet v3's project.json files produces more ignorable files
471
+ *.nuget.props
472
+ *.nuget.targets
473
+
474
+ # Microsoft Azure Build Output
475
+ csx/
476
+ *.build.csdef
477
+
478
+ # Microsoft Azure Emulator
479
+ ecf/
480
+ rcf/
481
+
482
+ # Windows Store app package directories and files
483
+ AppPackages/
484
+ BundleArtifacts/
485
+ Package.StoreAssociation.xml
486
+ _pkginfo.txt
487
+ *.appx
488
+ *.appxbundle
489
+ *.appxupload
490
+
491
+ # Visual Studio cache files
492
+ # files ending in .cache can be ignored
493
+ *.[Cc]ache
494
+ # but keep track of directories ending in .cache
495
+ !?*.[Cc]ache/
496
+
497
+ # Others
498
+ ClientBin/
499
+ ~$*
500
+ *~
501
+ *.dbmdl
502
+ *.dbproj.schemaview
503
+ *.jfm
504
+ *.pfx
505
+ *.publishsettings
506
+ orleans.codegen.cs
507
+
508
+ # Including strong name files can present a security risk
509
+ # (https://github.com/github/gitignore/pull/2483#issue-259490424)
510
+ #*.snk
511
+
512
+ # Since there are multiple workflows, uncomment next line to ignore bower_components
513
+ # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
514
+ #bower_components/
515
+
516
+ # RIA/Silverlight projects
517
+ Generated_Code/
518
+
519
+ # Backup & report files from converting an old project file
520
+ # to a newer Visual Studio version. Backup files are not needed,
521
+ # because we have git ;-)
522
+ _UpgradeReport_Files/
523
+ Backup*/
524
+ UpgradeLog*.XML
525
+ UpgradeLog*.htm
526
+ ServiceFabricBackup/
527
+ *.rptproj.bak
528
+
529
+ # SQL Server files
530
+ *.mdf
531
+ *.ldf
532
+ *.ndf
533
+
534
+ # Business Intelligence projects
535
+ *.rdl.data
536
+ *.bim.layout
537
+ *.bim_*.settings
538
+ *.rptproj.rsuser
539
+ *- [Bb]ackup.rdl
540
+ *- [Bb]ackup ([0-9]).rdl
541
+ *- [Bb]ackup ([0-9][0-9]).rdl
542
+
543
+ # Microsoft Fakes
544
+ FakesAssemblies/
545
+
546
+ # GhostDoc plugin setting file
547
+ *.GhostDoc.xml
548
+
549
+ # Node.js Tools for Visual Studio
550
+ .ntvs_analysis.dat
551
+ node_modules/
552
+
553
+ # Visual Studio 6 build log
554
+ *.plg
555
+
556
+ # Visual Studio 6 workspace options file
557
+ *.opt
558
+
559
+ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
560
+ *.vbw
561
+
562
+ # Visual Studio LightSwitch build output
563
+ **/*.HTMLClient/GeneratedArtifacts
564
+ **/*.DesktopClient/GeneratedArtifacts
565
+ **/*.DesktopClient/ModelManifest.xml
566
+ **/*.Server/GeneratedArtifacts
567
+ **/*.Server/ModelManifest.xml
568
+ _Pvt_Extensions
569
+
570
+ # Paket dependency manager
571
+ .paket/paket.exe
572
+ paket-files/
573
+
574
+ # FAKE - F# Make
575
+ .fake/
576
+
577
+ # CodeRush personal settings
578
+ .cr/personal
579
+
580
+ # Python Tools for Visual Studio (PTVS)
581
+ __pycache__/
582
+ *.pyc
583
+
584
+ # Cake - Uncomment if you are using it
585
+ # tools/**
586
+ # !tools/packages.config
587
+
588
+ # Tabs Studio
589
+ *.tss
590
+
591
+ # Telerik's JustMock configuration file
592
+ *.jmconfig
593
+
594
+ # BizTalk build output
595
+ *.btp.cs
596
+ *.btm.cs
597
+ *.odx.cs
598
+ *.xsd.cs
599
+
600
+ # OpenCover UI analysis results
601
+ OpenCover/
602
+
603
+ # Azure Stream Analytics local run output
604
+ ASALocalRun/
605
+
606
+ # MSBuild Binary and Structured Log
607
+ *.binlog
608
+
609
+ # NVidia Nsight GPU debugger configuration file
610
+ *.nvuser
611
+
612
+ # MFractors (Xamarin productivity tool) working folder
613
+ .mfractor/
614
+
615
+ # Local History for Visual Studio
616
+ .localhistory/
617
+
618
+ # BeatPulse healthcheck temp database
619
+ healthchecksdb
620
+
621
+ # Backup folder for Package Reference Convert tool in Visual Studio 2017
622
+ MigrationBackup/
623
+
624
+ # Ionide (cross platform F# VS Code tools) working folder
625
+ .ionide/
626
+
627
+ # Fody - auto-generated XML schema
628
+ FodyWeavers.xsd
629
+
630
+ ### Vim template
631
+ # Swap
632
+ [._]*.s[a-v][a-z]
633
+ !*.svg # comment out if you don't need vector files
634
+ [._]*.sw[a-p]
635
+ [._]s[a-rt-v][a-z]
636
+ [._]ss[a-gi-z]
637
+ [._]sw[a-p]
638
+
639
+ # Session
640
+ Session.vim
641
+ Sessionx.vim
642
+
643
+ # Temporary
644
+ .netrwhist
645
+ *~
646
+ # Auto-generated tag files
647
+ tags
648
+ # Persistent undo
649
+ [._]*.un~
650
+
651
+ ### Backup template
652
+ *.bak
653
+ *.gho
654
+ *.ori
655
+ *.orig
656
+ *.tmp
657
+
658
+ ### SublimeText template
659
+ # Cache files for Sublime Text
660
+ *.tmlanguage.cache
661
+ *.tmPreferences.cache
662
+ *.stTheme.cache
663
+
664
+ # Workspace files are user-specific
665
+ *.sublime-workspace
666
+
667
+ # Project files should be checked into the repository, unless a significant
668
+ # proportion of contributors will probably not be using Sublime Text
669
+ # *.sublime-project
670
+
671
+ # SFTP configuration file
672
+ sftp-config.json
673
+ sftp-config-alt*.json
674
+
675
+ # Package control specific files
676
+ Package Control.last-run
677
+ Package Control.ca-list
678
+ Package Control.ca-bundle
679
+ Package Control.system-ca-bundle
680
+ Package Control.cache/
681
+ Package Control.ca-certs/
682
+ Package Control.merged-ca-bundle
683
+ Package Control.user-ca-bundle
684
+ oscrypto-ca-bundle.crt
685
+ bh_unicode_properties.cache
686
+
687
+ # Sublime-github package stores a github token in this file
688
+ # https://packagecontrol.io/packages/sublime-github
689
+ GitHub.sublime-settings
690
+
691
+ ### C template
692
+ # Prerequisites
693
+ *.d
694
+
695
+ # Object files
696
+ *.o
697
+ *.ko
698
+ *.obj
699
+ *.elf
700
+
701
+ # Linker output
702
+ *.ilk
703
+ *.map
704
+ *.exp
705
+
706
+ # Precompiled Headers
707
+ *.gch
708
+ *.pch
709
+
710
+ # Libraries
711
+ *.lib
712
+ *.a
713
+ *.la
714
+ *.lo
715
+
716
+ # Shared objects (inc. Windows DLLs)
717
+ *.dll
718
+ *.so
719
+ *.so.*
720
+ *.dylib
721
+
722
+ # Executables
723
+ *.exe
724
+ *.out
725
+ *.app
726
+ *.i*86
727
+ *.x86_64
728
+ *.hex
729
+
730
+ # Debug files
731
+ *.dSYM/
732
+ *.su
733
+ *.idb
734
+ *.pdb
735
+
736
+ # Kernel Module Compile Results
737
+ *.mod*
738
+ *.cmd
739
+ .tmp_versions/
740
+ modules.order
741
+ Module.symvers
742
+ Mkfile.old
743
+ dkms.conf
744
+
745
+ ### VirtualEnv template
746
+ # Virtualenv
747
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
748
+ .Python
749
+ [Bb]in
750
+ [Ii]nclude
751
+ [Ll]ib
752
+ [Ll]ib64
753
+ [Ll]ocal
754
+ [Ss]cripts
755
+ pyvenv.cfg
756
+ .venv
757
+ pip-selfcheck.json
758
+
759
+ ### LibreOffice template
760
+ # LibreOffice locks
761
+ .~lock.*#
762
+
763
+ ### Xilinx template
764
+ # gitignore template for Xilinx Vivado Design Suite
765
+ # website: https://www.xilinx.com/support/download.html
766
+
767
+ # [home]
768
+ *.jou
769
+ *.log
770
+ *.debug
771
+ *.str
772
+ *.tmp
773
+ *.os
774
+ *.js
775
+ *.pb
776
+ *.dcp
777
+ *.hwdef
778
+ *.vds
779
+ *.veo
780
+ *.wdf
781
+ *.vdi
782
+ *.dmp
783
+ *.rpx
784
+ *.rpt
785
+ *_stub.v
786
+ *_stub.vhdl
787
+ *_funcsim.v
788
+ *_funcsim.vhdl
789
+ .project
790
+
791
+ # [dir]
792
+ *.cache
793
+ .metadata
794
+ *.data
795
+ *.ipdefs
796
+ .Xil
797
+ *.sdk
798
+ *.hw
799
+ *.ip_user_files
800
+
801
+ ### IP synth
802
+ *_synth_*
803
+
804
+ .jobs
805
+
806
+ ### project synth
807
+ */*.runs/synth*/*.xml
808
+ */*.runs/synth*/*.txt
809
+ */*.runs/synth*/*.sh
810
+ */*.runs/synth*/*.tcl
811
+ */*.runs/synth*/*.bat
812
+ */*.runs/synth*/*.xdc
813
+ !*/*.runs/synth*/*utilization*.rpt
814
+
815
+ *.runs/synth*/*.xml
816
+ *.runs/synth*/*.txt
817
+ *.runs/synth*/*.sh
818
+ *.runs/synth*/*.tcl
819
+ *.runs/synth*/*.bat
820
+ *.runs/synth*/*.xdc
821
+ !*.runs/synth*/*utilization*.rpt
822
+
823
+ ### project impl
824
+ */*.runs/impl*/*.xml
825
+ */*.runs/impl*/*.html
826
+ */*.runs/impl*/*.txt
827
+ */*.runs/impl*/*.sh
828
+ */*.runs/impl*/*.tcl
829
+ */*.runs/impl*/*.bat
830
+ !*/*.runs/impl*/*utilization*.rpt
831
+
832
+ *.runs/impl*/*.xml
833
+ *.runs/impl*/*.html
834
+ *.runs/impl*/*.txt
835
+ *.runs/impl*/*.sh
836
+ *.runs/impl*/*.tcl
837
+ *.runs/impl*/*.bat
838
+ !*.runs/impl*/*utilization*.rpt
839
+
840
+ ### block design
841
+ */*/bd/*/hdl
842
+ */*/*/bd/*/hdl
843
+
844
+ */*/bd/*/*.xdc
845
+ */*/*/bd/*/*.xdc
846
+
847
+ */*/bd/*/ip/*/*.xdc
848
+ */*/*/bd/*/ip/*/*.xdc
849
+
850
+ */*/bd/*/ip/*/*/
851
+ */*/*/bd/*/ip/*/*/
852
+
853
+ */*/bd/*/ip/*/*.vhd
854
+ */*/*/bd/*/ip/*/*.vhd
855
+
856
+ */*/bd/*/ip/*/*.xml
857
+ */*/*/bd/*/ip/*/*.xml
858
+
859
+ *.c
860
+ *.cpp
861
+ *.h
862
+ *.vho
863
+ */*/bd/*/ip/*/*.tcl
864
+ */*/*/bd/*/ip/*/*.tcl
865
+ hw_handoff
866
+ ipshared
867
+
868
+ ### Lua template
869
+ # Compiled Lua sources
870
+ luac.out
871
+
872
+ # luarocks build files
873
+ *.src.rock
874
+ *.zip
875
+
876
+ # Object files
877
+ *.o
878
+ *.os
879
+ *.ko
880
+ *.obj
881
+ *.elf
882
+
883
+ # Precompiled Headers
884
+ *.gch
885
+ *.pch
886
+
887
+ # Libraries
888
+ *.lib
889
+ *.a
890
+ *.la
891
+ *.lo
892
+ *.def
893
+ *.exp
894
+
895
+ # Shared objects (inc. Windows DLLs)
896
+ *.dll
897
+ *.so
898
+ *.so.*
899
+ *.dylib
900
+
901
+ # Executables
902
+ *.exe
903
+ *.out
904
+ *.app
905
+ *.i*86
906
+ *.x86_64
907
+ *.hex
908
+
909
+
910
+ ### Vagrant template
911
+ # General
912
+ .vagrant/
913
+
914
+ # Log files (if you are creating logs in debug mode, uncomment this)
915
+ # *.log
916
+
917
+ ### PuTTY template
918
+ # Private key
919
+ *.ppk
920
+
921
+ ### Patch template
922
+ *.orig
923
+ *.rej
924
+
925
+ ### Python template
926
+ # Byte-compiled / optimized / DLL files
927
+ __pycache__/
928
+ *.py[cod]
929
+ *$py.class
930
+
931
+ # C extensions
932
+ *.so
933
+
934
+ # Distribution / packaging
935
+ .Python
936
+ build/
937
+ develop-eggs/
938
+ /dist
939
+ wheelhouse/
940
+ downloads/
941
+ eggs/
942
+ .eggs/
943
+ lib/
944
+ lib64/
945
+ parts/
946
+ sdist/
947
+ var/
948
+ wheels/
949
+ share/python-wheels/
950
+ *.egg-info/
951
+ .installed.cfg
952
+ *.egg
953
+ MANIFEST
954
+
955
+ # PyInstaller
956
+ # Usually these files are written by a python script from a template
957
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
958
+ *.manifest
959
+ *.spec
960
+
961
+ # Installer logs
962
+ pip-log.txt
963
+ pip-delete-this-directory.txt
964
+
965
+ # Unit test / coverage reports
966
+ htmlcov/
967
+ .tox/
968
+ .nox/
969
+ .coverage
970
+ .coverage.*
971
+ .cache
972
+ nosetests.xml
973
+ coverage.xml
974
+ *.cover
975
+ *.py,cover
976
+ .hypothesis/
977
+ .pytest_cache/
978
+ cover/
979
+
980
+ # Translations
981
+ *.mo
982
+ *.pot
983
+
984
+ # Django stuff:
985
+ *.log
986
+ local_settings.py
987
+ db.sqlite3
988
+ db.sqlite3-journal
989
+
990
+ # Flask stuff:
991
+ instance/
992
+ .webassets-cache
993
+
994
+ # Scrapy stuff:
995
+ .scrapy
996
+
997
+ # Sphinx documentation
998
+ docs/_build/
999
+
1000
+ # PyBuilder
1001
+ .pybuilder/
1002
+ target/
1003
+
1004
+ # Jupyter Notebook
1005
+ .ipynb_checkpoints
1006
+
1007
+ # IPython
1008
+ profile_default/
1009
+ ipython_config.py
1010
+
1011
+ # pyenv
1012
+ # For a library or package, you might want to ignore these files since the code is
1013
+ # intended to run in multiple environments; otherwise, check them in:
1014
+ # .python-version
1015
+
1016
+ # pipenv
1017
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
1018
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
1019
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
1020
+ # install all needed dependencies.
1021
+ #Pipfile.lock
1022
+
1023
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
1024
+ __pypackages__/
1025
+
1026
+ # Celery stuff
1027
+ celerybeat-schedule
1028
+ celerybeat.pid
1029
+
1030
+ # SageMath parsed files
1031
+ *.sage.py
1032
+
1033
+ # Environments
1034
+ .env
1035
+ .venv
1036
+ /env/
1037
+ venv/
1038
+ ENV/
1039
+ env.bak/
1040
+ venv.bak/
1041
+
1042
+ # Spyder project settings
1043
+ .spyderproject
1044
+ .spyproject
1045
+
1046
+ # Rope project settings
1047
+ .ropeproject
1048
+
1049
+ # mkdocs documentation
1050
+ /site
1051
+
1052
+ # mypy
1053
+ .mypy_cache/
1054
+ .dmypy.json
1055
+ dmypy.json
1056
+
1057
+ # Pyre type checker
1058
+ .pyre/
1059
+
1060
+ # pytype static type analyzer
1061
+ .pytype/
1062
+
1063
+ # Cython debug symbols
1064
+ cython_debug/
1065
+
1066
+ ### Windows template
1067
+ # Windows thumbnail cache files
1068
+ Thumbs.db
1069
+ Thumbs.db:encryptable
1070
+ ehthumbs.db
1071
+ ehthumbs_vista.db
1072
+
1073
+ # Dump file
1074
+ *.stackdump
1075
+
1076
+ # Folder config file
1077
+ [Dd]esktop.ini
1078
+
1079
+ # Recycle Bin used on file shares
1080
+ $RECYCLE.BIN/
1081
+
1082
+ # Windows Installer files
1083
+ *.cab
1084
+ *.msi
1085
+ *.msix
1086
+ *.msm
1087
+ *.msp
1088
+
1089
+ # Windows shortcuts
1090
+ *.lnk
1091
+
1092
+ ### Xcode template
1093
+ # Xcode
1094
+ #
1095
+ # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
1096
+
1097
+ ## User settings
1098
+ xcuserdata/
1099
+
1100
+ ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
1101
+ *.xcscmblueprint
1102
+ *.xccheckout
1103
+
1104
+ ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
1105
+ build/
1106
+ DerivedData/
1107
+ *.moved-aside
1108
+ *.pbxuser
1109
+ !default.pbxuser
1110
+ *.mode1v3
1111
+ !default.mode1v3
1112
+ *.mode2v3
1113
+ !default.mode2v3
1114
+ *.perspectivev3
1115
+ !default.perspectivev3
1116
+
1117
+ ## Gcc Patch
1118
+ /*.gcno
1119
+
1120
+ ### JetBrains template
1121
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
1122
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
1123
+
1124
+ # User-specific stuff
1125
+ .idea/**/workspace.xml
1126
+ .idea/**/tasks.xml
1127
+ .idea/**/usage.statistics.xml
1128
+ .idea/**/dictionaries
1129
+ .idea/**/shelf
1130
+
1131
+ # Generated files
1132
+ .idea/**/contentModel.xml
1133
+
1134
+ # Sensitive or high-churn files
1135
+ .idea/**/dataSources/
1136
+ .idea/**/dataSources.ids
1137
+ .idea/**/dataSources.local.xml
1138
+ .idea/**/sqlDataSources.xml
1139
+ .idea/**/dynamic.xml
1140
+ .idea/**/uiDesigner.xml
1141
+ .idea/**/dbnavigator.xml
1142
+
1143
+ # Gradle
1144
+ .idea/**/gradle.xml
1145
+ .idea/**/libraries
1146
+
1147
+ # Gradle and Maven with auto-import
1148
+ # When using Gradle or Maven with auto-import, you should exclude module files,
1149
+ # since they will be recreated, and may cause churn. Uncomment if using
1150
+ # auto-import.
1151
+ # .idea/artifacts
1152
+ # .idea/compiler.xml
1153
+ # .idea/jarRepositories.xml
1154
+ # .idea/modules.xml
1155
+ # .idea/*.iml
1156
+ # .idea/modules
1157
+ # *.iml
1158
+ # *.ipr
1159
+
1160
+ # CMake
1161
+ cmake-build-*/
1162
+
1163
+ # Mongo Explorer plugin
1164
+ .idea/**/mongoSettings.xml
1165
+
1166
+ # File-based project format
1167
+ *.iws
1168
+
1169
+ # IntelliJ
1170
+ out/
1171
+
1172
+ # mpeltonen/sbt-idea plugin
1173
+ .idea_modules/
1174
+
1175
+ # JIRA plugin
1176
+ atlassian-ide-plugin.xml
1177
+
1178
+ # Cursive Clojure plugin
1179
+ .idea/replstate.xml
1180
+
1181
+ # Crashlytics plugin (for Android Studio and IntelliJ)
1182
+ com_crashlytics_export_strings.xml
1183
+ crashlytics.properties
1184
+ crashlytics-build.properties
1185
+ fabric.properties
1186
+
1187
+ # Editor-based Rest Client
1188
+ .idea/httpRequests
1189
+
1190
+ # Android studio 3.1+ serialized cache file
1191
+ .idea/caches/build_file_checksums.ser
1192
+
1193
+ /test_*
1194
+ .python-version
1195
+ /docs/build
1196
+ /public
1197
+ /docs/source/**/*.puml.svg
1198
+ /docs/source/**/*.puml.png
1199
+ /docs/source/**/*.gv.svg
1200
+ /docs/source/**/*.gv.png
1201
+ /docs/source/**/*.py.txt
1202
+ /docs/source/**/*.py.err
1203
+ /docs/source/**/*.py.exitcode
1204
+ /docs/source/**/*.sh.txt
1205
+ /docs/source/**/*.sh.err
1206
+ /docs/source/**/*.sh.exitcode
1207
+ /docs/source/**/*.dat.*
1208
+ !/docs/source/**/*.plot.py.svg
1209
+ !/docs/source/_static/**/*
1210
+ /docs/source/**/*.result.ipynb
1211
+ /cartpole_dqn_*
1212
+ /llmriddles/**/*.json
1213
+ /llmriddles/**/*.yaml
1214
+ /llmriddles/**/*.yml
1215
+ /extra
1216
+ /resource/yolort/*
1217
+ !/resource/yolort/Makefile
1218
+ !/test/testfile/**/*
1219
+ !/zoo/testfile/**/*
1220
+ /test/testfile/dataset
1221
+ /zoo/testfile/dataset
1222
+ /.train
1223
+ *.pt
1224
+ /runs
1225
+ /YOLOv8
README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # LLMRiddles
2
+
3
+ ```shell
4
+ python app.py
5
+ ```
app.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import gradio as gr
4
+
5
+ from llmriddles.questions import QuestionExecutor
6
+ from llmriddles.questions import list_ordered_questions
7
+
8
+ _QUESTION_ID = -1
9
+ _QUESTIONS = list_ordered_questions()
10
+ _LANG = os.environ.get('QUESTION_LANG', 'cn')
11
+ _LLM = os.environ.get('QUESTION_LLM', 'chatgpt')
12
+
13
+ if __name__ == '__main__':
14
+ with gr.Blocks() as demo:
15
+ with gr.Row():
16
+ with gr.Column():
17
+ gr_requirement = gr.TextArea(placeholder='Click \'Next\' to Start', label='Requirements')
18
+ gr_question = gr.TextArea(placeholder='Your Question for LLM', label='Question')
19
+ gr_answer = gr.TextArea(placeholder='Answer From LLM', label='Answer')
20
+ gr_submit = gr.Button('Submit', interactive=False)
21
+
22
+ with gr.Column():
23
+ gr_predict = gr.Label(label='Correctness')
24
+ gr_explanation = gr.TextArea(label='Explanation')
25
+ gr_next = gr.Button('Next')
26
+
27
+
28
+ def _next_question():
29
+ global _QUESTION_ID
30
+ _QUESTION_ID += 1
31
+
32
+ if _QUESTION_ID >= len(_QUESTIONS):
33
+ return 'Congratulations!', '', '', {}, '', \
34
+ gr.Button('Submit', interactive=False), \
35
+ gr.Button('Next', interactive=False)
36
+ else:
37
+ executor = QuestionExecutor(_QUESTIONS[_QUESTION_ID], _LANG)
38
+ return executor.question_text, '', '', {}, '', \
39
+ gr.Button('Submit', interactive=True), \
40
+ gr.Button('Next', interactive=False)
41
+
42
+
43
+ gr_next.click(
44
+ fn=_next_question,
45
+ inputs=[],
46
+ outputs=[gr_requirement, gr_question, gr_answer, gr_predict, gr_explanation, gr_submit, gr_next],
47
+ )
48
+
49
+
50
+ def _submit_answer(qs_text: str):
51
+ executor = QuestionExecutor(_QUESTIONS[_QUESTION_ID], _LANG)
52
+ answer_text, correctness, explanation = executor.check(qs_text)
53
+ labels = {'Correct': 1.0} if correctness else {'Wrong': 1.0}
54
+ if correctness:
55
+ return answer_text, labels, explanation, gr.Button('Next', interactive=True)
56
+ else:
57
+ return answer_text, labels, explanation, gr.Button('Next', interactive=False)
58
+
59
+
60
+ gr_submit.click(
61
+ _submit_answer,
62
+ inputs=[gr_question],
63
+ outputs=[gr_answer, gr_predict, gr_explanation, gr_next],
64
+ )
65
+
66
+ demo.launch()
cloc.sh ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # This scripts counts the lines of code and comments in all source files
4
+ # and prints the results to the command line. It uses the commandline tool
5
+ # "cloc". You can either pass --loc, --comments or --percentage to show the
6
+ # respective values only.
7
+ # Some parts below need to be adapted to your project!
8
+
9
+ # Get the location of this script.
10
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
11
+
12
+ # Run cloc - this counts code lines, blank lines and comment lines
13
+ # for the specified languages. You will need to change this accordingly.
14
+ # For C++, you could use "C++,C/C++ Header" for example.
15
+ # We are only interested in the summary, therefore the tail -1
16
+ SUMMARY="$(cloc "${SCRIPT_DIR}" --include-lang="Python" --md | tail -1)"
17
+
18
+ # The $SUMMARY is one line of a markdown table and looks like this:
19
+ # SUM:|101|3123|2238|10783
20
+ # We use the following command to split it into an array.
21
+ IFS='|' read -r -a TOKENS <<<"$SUMMARY"
22
+
23
+ # Store the individual tokens for better readability.
24
+ NUMBER_OF_FILES=${TOKENS[1]}
25
+ COMMENT_LINES=${TOKENS[3]}
26
+ LINES_OF_CODE=${TOKENS[4]}
27
+
28
+ # To make the estimate of commented lines more accurate, we have to
29
+ # subtract any copyright header which is included in each file.
30
+ # For Fly-Pie, this header has the length of five lines.
31
+ # All dumb comments like those /////////// or those // ------------
32
+ # are also subtracted. As cloc does not count inline comments,
33
+ # the overall estimate should be rather conservative.
34
+ # Change the lines below according to your project.
35
+ # DUMB_COMMENTS="$(grep -r -E '//////|// -----' "${SCRIPT_DIR}" | wc -l)"
36
+ # COMMENT_LINES=$(($COMMENT_LINES - 5 * $NUMBER_OF_FILES - $DUMB_COMMENTS))
37
+
38
+ # Print all results if no arguments are given.
39
+ if [[ $# -eq 0 ]]; then
40
+ awk -v a=$LINES_OF_CODE \
41
+ 'BEGIN {printf "Lines of source code: %6.1fk\n", a/1000}'
42
+ awk -v a=$COMMENT_LINES \
43
+ 'BEGIN {printf "Lines of comments: %6.1fk\n", a/1000}'
44
+ awk -v a=$COMMENT_LINES -v b=$LINES_OF_CODE \
45
+ 'BEGIN {printf "Comment Percentage: %6.1f%\n", 100*a/b}'
46
+ exit 0
47
+ fi
48
+
49
+ # Show lines of code if --loc is given.
50
+ if [[ $* == *--loc* ]]; then
51
+ awk -v a=$LINES_OF_CODE \
52
+ 'BEGIN {printf "%.1fk\n", a/1000}'
53
+ fi
54
+
55
+ # Show lines of comments if --comments is given.
56
+ if [[ $* == *--comments* ]]; then
57
+ awk -v a=$COMMENT_LINES \
58
+ 'BEGIN {printf "%.1fk\n", a/1000}'
59
+ fi
60
+
61
+ # Show precentage of comments if --percentage is given.
62
+ if [[ $* == *--percentage* ]]; then
63
+ awk -v a=$COMMENT_LINES -v b=$LINES_OF_CODE \
64
+ 'BEGIN {printf "%.1f\n", 100*a/b}'
65
+ fi
llmriddles/__init__.py ADDED
File without changes
llmriddles/llms/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from .chatgpt import ask_chatgpt
2
+ from .base import register_llm, get_llm_fn
llmriddles/llms/base.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable, Dict
2
+
3
+ _LLMS: Dict[str, Callable[[str], str]] = {}
4
+
5
+
6
+ def register_llm(name: str, llm_ask_fn: Callable[[str], str]):
7
+ _LLMS[name] = llm_ask_fn
8
+
9
+
10
+ def get_llm_fn(name: str) -> Callable[[str], str]:
11
+ return _LLMS[name]
llmriddles/llms/chatgpt.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from functools import lru_cache
3
+
4
+ import openai
5
+
6
+ from .base import register_llm
7
+
8
+
9
+ @lru_cache()
10
+ def _setup_openai():
11
+ current_path = os.path.dirname(os.path.realpath(__file__))
12
+ parent_dir = os.path.dirname(current_path)
13
+ if 'OPENAI_KEY' in os.environ:
14
+ openai.api_key = os.environ['OPENAI_KEY']
15
+ else:
16
+ openai.api_key_path = f'{parent_dir}/.key'
17
+ return openai.api_key_path
18
+
19
+
20
+ def ask_chatgpt(message: str):
21
+ _setup_openai()
22
+
23
+ response = openai.ChatCompletion.create(
24
+ model="gpt-3.5-turbo",
25
+ messages=[
26
+ {"role": "user", "content": message}
27
+ ],
28
+ )
29
+ return response["choices"][0]["message"]["content"].strip()
30
+
31
+
32
+ register_llm('chatgpt', ask_chatgpt)
llmriddles/questions/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from .executor import QuestionExecutor
2
+ from .level1 import __file__ as _level1_file_
3
+ from .question import Question, register_question, list_ordered_questions
4
+
5
+ _ = _level1_file_
llmriddles/questions/executor.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Tuple
2
+
3
+ from .question import Question
4
+ from ..llms import get_llm_fn
5
+
6
+
7
+ class QuestionExecutor:
8
+ def __init__(self, question: Question, lang: str = 'cn', llm: str = 'chatgpt'):
9
+ self.question = question
10
+ self.lang = lang
11
+ self.llm = llm
12
+
13
+ @property
14
+ def question_text(self):
15
+ return self.question.texts[self.lang]
16
+
17
+ def check(self, qs_text: str) -> Tuple[str, bool, str]:
18
+ answer_text = get_llm_fn(self.llm)(qs_text)
19
+ correct, explanation = self.check_answer(answer_text)
20
+ return answer_text, correct, explanation
21
+
22
+ def check_answer(self, answer_text: str) -> Tuple[bool, str]:
23
+ correct, explanation = self.question.checker(self.question_text, answer_text, self.lang)
24
+ if explanation is None:
25
+ if correct:
26
+ explanation = 'LLM的回答满足要求' if self.lang == 'cn' else 'Correct Answer From LLM'
27
+ else:
28
+ explanation = 'LLM的回答不满足要求' if self.lang == 'cn' else 'Wrong Answer From LLM'
29
+
30
+ return correct, explanation
llmriddles/questions/level1.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .question import register_question
2
+
3
+ CN_TEXT = """
4
+ 欢迎来玩LLM Riddles!
5
+
6
+ 你将通过本游戏对语言大模型产生更深刻的理解。
7
+
8
+ 在本游戏中,你需要构造一个提给一个语言大模型的问题,使得它回复的答案符合要求。
9
+
10
+ 作为第一个题目,请你构造一个问题使模型的回答是一字不差的“1+1=3”(不需要引号)。
11
+
12
+ 请在下面的输入框内填写你构造并点击按钮提交。
13
+ """
14
+
15
+ EN_TEXT = """
16
+ Welcome to LLM Riddles!
17
+
18
+ In this game, you'll gain a deeper understanding of language models.
19
+
20
+ Your challenge is to create a question to ask a language model in a way that the answer it provides meets specific criteria.
21
+
22
+ For the first question, please construct a query for the model that will result in the exact answer "1+1=3" (no quotes needed).
23
+
24
+ Please enter your query below and click the submit button
25
+ """
26
+
27
+
28
+ def _checker(question_text: str, answer_text: str, lang: str):
29
+ _ = question_text, lang
30
+ answer_text = answer_text.strip()
31
+ if answer_text == '1+1=3':
32
+ return True, None
33
+ else:
34
+ return False, None
35
+
36
+
37
+ register_question({
38
+ 'cn': CN_TEXT,
39
+ 'en': EN_TEXT,
40
+ }, _checker)
llmriddles/questions/question.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import collections.abc
2
+ from dataclasses import dataclass
3
+ from typing import Union, Mapping, Literal, Callable, Tuple, List, Optional
4
+
5
+ LangTyping = Literal['en', 'cn']
6
+ MultiLangCheckerTyping = Callable[[str, str, str], Tuple[bool, Optional[str]]]
7
+ SingleLangCheckerTyping = Callable[[str, str], Tuple[bool, Optional[str]]]
8
+
9
+
10
+ @dataclass
11
+ class Question:
12
+ texts: Mapping[str, str]
13
+ checker: MultiLangCheckerTyping
14
+ level: int
15
+
16
+
17
+ _KNOWN_PROBLEMS = []
18
+
19
+
20
+ def register_question(text: Union[Mapping[str, str], str],
21
+ checkers: Union[Mapping[str, SingleLangCheckerTyping], MultiLangCheckerTyping],
22
+ level: int = 1, default_lang='cn'):
23
+ if isinstance(checkers, collections.abc.Mapping):
24
+ _origin_checkers = checkers
25
+
26
+ def _integrated_checker(question_text: str, answer_text: str, lang: str):
27
+ return _origin_checkers[lang](question_text, answer_text)
28
+
29
+ checker: MultiLangCheckerTyping = _integrated_checker
30
+ else:
31
+ checker: MultiLangCheckerTyping = checkers
32
+
33
+ if isinstance(text, str):
34
+ texts = {default_lang: text}
35
+ else:
36
+ texts = text
37
+
38
+ _KNOWN_PROBLEMS.append(Question(texts, checker, level))
39
+
40
+
41
+ def list_ordered_questions() -> List[Question]:
42
+ return [
43
+ problem for _, problem in
44
+ sorted(enumerate(_KNOWN_PROBLEMS), key=lambda x: (x[1].level, x[0]))
45
+ ]
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ hbutils>=0.9.1
2
+ tqdm
3
+ requests>=2.20
4
+ gradio==4.1.1
5
+ openai