-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzha.tea
More file actions
162 lines (135 loc) · 4.59 KB
/
zha.tea
File metadata and controls
162 lines (135 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/tttt -fc
v:vVERSION:{v1.0.9}
v:vRANK:{-----[☆☆☆☆☆☆]-----}
#----------------------------------------------|
# ZHA: Zee Hacker Assistant | JUN,'26
#----------------------------------------------|
# based off of TEAPAT: TEA Personal AssistanT:
# REF: doi.org/10.20944/preprints202502.1849.v1
#----------------------------------------------|
# This little program is a mini
# quasi-general artificial intelligence (qAGI)
# a special personal assistant perhaps
# best left for hackers, created
# using the TEA programming language:
# tea.nuchwezi.com
###############################################|
#-------[ DISCLAIMER NOTE ]
**Disclaimer:** **ZHA (Zee Hacker Assistant)** is a creative, offline simulation tool provided by **Nuchwezi Research** that generates fictionalized conversational content based solely on user prompts; any dialogue produced is **purely synthetic** and **does not** represent statements, endorsements, or admissions by real persons or entities, whether named by the user or otherwise. By using ZHA and exporting or sharing any conversation logs you acknowledge and agree that **you alone** are responsible for how those logs are used, published, or represented, and you will **not** hold Nuchwezi Research or its affiliates liable for any claims, damages, losses, or harms arising from your use, misuse, or distribution of generated content; you further agree to indemnify and defend Nuchwezi Research against any third‑party claims resulting from such use. ZHA is provided **as‑is** without warranties of any kind, express or implied, including accuracy, fitness for a particular purpose, or non‑infringement, and Nuchwezi Research reserves the right to modify, suspend, or terminate the service or these terms at any time to the fullest extent permitted by law.
#-------[ END DISCLAIMER NOTE ]
#-------[ SOME VARIABLES ]
v:vLOG:{} # hold chat history..
v:vDELIM:{
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
}
v:vNL:{
}
v:vUSERPREFIX:{I: }
#-------[ ZHA LOGIC ]
#show welcome message
R@:"■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■■■■■ *:{~} ZHA #vVERSION# ■■■■■■■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
welcome to the future of chat_
u'll specify who to talk to
or default input shall be used.
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■"|v:vWELCOME
y:vWELCOME | i:
# update chat history..
g*:{}:vLOG:vWELCOME | v:vLOG
# use externally set name?
y*: | t!.: | d!:{^.{1,10}} # only use first 10 chars
v:vTEMPPANAME
f:^$:lSETNAME
i!:{Proceed to chat with }
| x*!:vTEMPPANAME | x!:{?
N: NO
Y: Yes (default)} | i: | t!.:| v:vOPT
f!:^[nN]$:lNOSET
v:vTEMPPANAME:{}|i!:{}|j:lSETNAME
# set entity name
l:lSETNAME
v:vPANAME:{ZHA}
f:^$:lSET:lNOSET
l:lSET
i!:{Who do u wish to talk to? } | v:vPROMPT |i:
v:vUSERPANAME # user's entity name
# update chat history..
g*:{}:vLOG:vNL:vNL:vPROMPT | v:vLOG
y:vUSERPANAME
g:| t!.: #clean it up then test...
f!:^$:lSETI:lRULES
l:lSETI
v:vPANAME
j:lRULES
l:lNOSET | y:vTEMPPANAME | v:vPANAME # evoke invoker's entity
l:lRULES # show instructions
# update chat history..
g*:{}:vLOG:vNL:vPANAME | v:vLOG
i!:{At any time, reply with 'bye' to quit
}| v:vPROMPT |i:
# update chat history..
g*:{}:vNL:vPROMPT:vDELIM
x*:vLOG | v:vLOG
#---[CHECK: showing off TEA functions next...]
## A Prompt Generating Function
V:vPromptGenerator:"
# generate question
n:10000000|s:|v:qN|
# decide between ANE and NE
n:|f!:[2357]:qANE:qNE
l:qANE|
# decide between AE and ANE
n:1|f:0:qAE
# generate ANE
p!:27
|s:_:13:5 |d:_.*$
|s: |v:qR
|g*:{}:qR:qN
|j:qF|
l:qAE # pure AE
p!:27
|s:_:13:5 |d:_.*$ |s:
|j:qF|
l:qNE # pure NE
|y:qN
|l:qF # process and package question
|a:
|x:{: }
v:vQ
# decide on whether question or not
n:|f:[2357]:lNoQ
y:vQ
|x!:{? }
j:lProQ
l:lNoQ
y:vQ
|x!:{ }
l:lProQ
# stash generated question
v:vGenQuestion
"
######
# NOTE: that was essentially another TEA program
# held inside a mere string variable!
# Now we can reuse that as you'll soon see..
######
l:lPROMPT # prompt, get answer, process
e*:vPromptGenerator | v:vPROMPT # generate and store..
g*:{}:vPANAME:vPROMPT | v:vPAPROMPT
l:lDisplayPROMPT
# first update chat history..
y:vLOG | x!:{
} | x*!:vPAPROMPT | v:vLOG
y:vPAPROMPT | i: | v:vUSERRESP
# update chat history..
g*:{}:vNL:vUSERPREFIX:vUSERRESP:vNL
x*:vLOG | v:vLOG
# check: should we quit?
y:vUSERRESP |z:|
f:^bye$:lQUIT
| j:lPROMPT # and loop
# quiting gracefully...
l:lQUIT
# ends with returning chat history to user...
G*!:vNL:vLOG:vRANK | q!: