lliu01 commited on
Commit
ead1743
1 Parent(s): 706dbb4
Files changed (1) hide show
  1. app.py +6 -186
app.py CHANGED
@@ -67,194 +67,13 @@ def predict(message, history, system_prompt, temperature, max_tokens):
67
  ["What are services in FortiOS and how are they used in firewall policies?"],
68
  ],
69
  """
70
- sys_prompt = """FortiOS firewall configuration in CLI.\n
71
- Use the firewall config template below to refine your answer, make sure the attributes in the config belongs to the template.\n
72
- config firewall policy
73
- edit <policyid>
74
- set action [accept|deny|ipsec]
75
- set anti-replay [enable|disable]
76
- set application-list {string}
77
- set auth-cert {string}
78
- set auth-path [enable|disable]
79
- set auth-redirect-addr {string}
80
- set auto-asic-offload [enable|disable]
81
- set av-profile {string}
82
- set block-notification [enable|disable]
83
- set captive-portal-exempt [enable|disable]
84
- set capture-packet [enable|disable]
85
- set casb-profile {string}
86
- set cifs-profile {string}
87
- set comments {var-string}
88
- set custom-log-fields <field-id1>, <field-id2>, ...
89
- set decrypted-traffic-mirror {string}
90
- set delay-tcp-npu-session [enable|disable]
91
- set diameter-filter-profile {string}
92
- set diffserv-copy [enable|disable]
93
- set diffserv-forward [enable|disable]
94
- set diffserv-reverse [enable|disable]
95
- set diffservcode-forward {user}
96
- set diffservcode-rev {user}
97
- set disclaimer [enable|disable]
98
- set dlp-profile {string}
99
- set dnsfilter-profile {string}
100
- set dsri [enable|disable]
101
- set dstaddr <name1>, <name2>, ...
102
- set dstaddr-negate [enable|disable]
103
- set dstaddr6 <name1>, <name2>, ...
104
- set dstaddr6-negate [enable|disable]
105
- set dstintf <name1>, <name2>, ...
106
- set dynamic-shaping [enable|disable]
107
- set email-collect [enable|disable]
108
- set emailfilter-profile {string}
109
- set fec [enable|disable]
110
- set file-filter-profile {string}
111
- set firewall-session-dirty [check-all|check-new]
112
- set fixedport [enable|disable]
113
- set fsso-agent-for-ntlm {string}
114
- set fsso-groups <name1>, <name2>, ...
115
- set geoip-anycast [enable|disable]
116
- set geoip-match [physical-location|registered-location]
117
- set groups <name1>, <name2>, ...
118
- set http-policy-redirect [enable|disable]
119
- set icap-profile {string}
120
- set identity-based-route {string}
121
- set inbound [enable|disable]
122
- set inspection-mode [proxy|flow]
123
- set internet-service [enable|disable]
124
- set internet-service-custom <name1>, <name2>, ...
125
- set internet-service-custom-group <name1>, <name2>, ...
126
- set internet-service-group <name1>, <name2>, ...
127
- set internet-service-name <name1>, <name2>, ...
128
- set internet-service-negate [enable|disable]
129
- set internet-service-src [enable|disable]
130
- set internet-service-src-custom <name1>, <name2>, ...
131
- set internet-service-src-custom-group <name1>, <name2>, ...
132
- set internet-service-src-group <name1>, <name2>, ...
133
- set internet-service-src-name <name1>, <name2>, ...
134
- set internet-service-src-negate [enable|disable]
135
- set internet-service6 [enable|disable]
136
- set internet-service6-custom <name1>, <name2>, ...
137
- set internet-service6-custom-group <name1>, <name2>, ...
138
- set internet-service6-group <name1>, <name2>, ...
139
- set internet-service6-name <name1>, <name2>, ...
140
- set internet-service6-negate [enable|disable]
141
- set internet-service6-src [enable|disable]
142
- set internet-service6-src-custom <name1>, <name2>, ...
143
- set internet-service6-src-custom-group <name1>, <name2>, ...
144
- set internet-service6-src-group <name1>, <name2>, ...
145
- set internet-service6-src-name <name1>, <name2>, ...
146
- set internet-service6-src-negate [enable|disable]
147
- set ippool [enable|disable]
148
- set ips-sensor {string}
149
- set ips-voip-filter {string}
150
- set logtraffic [all|utm|disable]
151
- set logtraffic-start [enable|disable]
152
- set match-vip [enable|disable]
153
- set match-vip-only [enable|disable]
154
- set name {string}
155
- set nat [enable|disable]
156
- set nat46 [enable|disable]
157
- set nat64 [enable|disable]
158
- set natinbound [enable|disable]
159
- set natip {ipv4-classnet}
160
- set natoutbound [enable|disable]
161
- set network-service-dynamic <name1>, <name2>, ...
162
- set network-service-src-dynamic <name1>, <name2>, ...
163
- set np-acceleration [enable|disable]
164
- set ntlm [enable|disable]
165
- set ntlm-enabled-browsers <user-agent-string1>, <user-agent-string2>, ...
166
- set ntlm-guest [enable|disable]
167
- set outbound [enable|disable]
168
- set passive-wan-health-measurement [enable|disable]
169
- set pcp-inbound [enable|disable]
170
- set pcp-outbound [enable|disable]
171
- set pcp-poolname <name1>, <name2>, ...
172
- set per-ip-shaper {string}
173
- set permit-any-host [enable|disable]
174
- set permit-stun-host [enable|disable]
175
- set policy-expiry [enable|disable]
176
- set policy-expiry-date {datetime}
177
- set policy-expiry-date-utc {user}
178
- set poolname <name1>, <name2>, ...
179
- set poolname6 <name1>, <name2>, ...
180
- set port-preserve [enable|disable]
181
- set profile-group {string}
182
- set profile-protocol-options {string}
183
- set profile-type [single|group]
184
- set radius-mac-auth-bypass [enable|disable]
185
- set redirect-url {var-string}
186
- set replacemsg-override-group {string}
187
- set reputation-direction [source|destination]
188
- set reputation-direction6 [source|destination]
189
- set reputation-minimum {integer}
190
- set reputation-minimum6 {integer}
191
- set rtp-addr <name1>, <name2>, ...
192
- set rtp-nat [disable|enable]
193
- set schedule {string}
194
- set schedule-timeout [enable|disable]
195
- set sctp-filter-profile {string}
196
- set send-deny-packet [disable|enable]
197
- set service <name1>, <name2>, ...
198
- set service-negate [enable|disable]
199
- set session-ttl {user}
200
- set sgt <id1>, <id2>, ...
201
- set sgt-check [enable|disable]
202
- set src-vendor-mac <id1>, <id2>, ...
203
- set srcaddr <name1>, <name2>, ...
204
- set srcaddr-negate [enable|disable]
205
- set srcaddr6 <name1>, <name2>, ...
206
- set srcaddr6-negate [enable|disable]
207
- set srcintf <name1>, <name2>, ...
208
- set ssh-filter-profile {string}
209
- set ssh-policy-redirect [enable|disable]
210
- set ssl-ssh-profile {string}
211
- set status [enable|disable]
212
- set tcp-mss-receiver {integer}
213
- set tcp-mss-sender {integer}
214
- set tcp-session-without-syn [all|data-only|disable]
215
- set timeout-send-rst [enable|disable]
216
- set tos {user}
217
- set tos-mask {user}
218
- set tos-negate [enable|disable]
219
- set traffic-shaper {string}
220
- set traffic-shaper-reverse {string}
221
- set users <name1>, <name2>, ...
222
- set utm-status [enable|disable]
223
- set uuid {uuid}
224
- set videofilter-profile {string}
225
- set virtual-patch-profile {string}
226
- set vlan-cos-fwd {integer}
227
- set vlan-cos-rev {integer}
228
- set vlan-filter {user}
229
- set voip-profile {string}
230
- set vpntunnel {string}
231
- set waf-profile {string}
232
- set wanopt [enable|disable]
233
- set wanopt-detection [active|passive|off]
234
- set wanopt-passive-opt [default|transparent|non-transparent]
235
- set wanopt-peer {string}
236
- set wanopt-profile {string}
237
- set wccp [enable|disable]
238
- set webcache [enable|disable]
239
- set webcache-https [disable|enable]
240
- set webfilter-profile {string}
241
- set webproxy-forward-server {string}
242
- set webproxy-profile {string}
243
- set ztna-device-ownership [enable|disable]
244
- set ztna-ems-tag <name1>, <name2>, ...
245
- set ztna-ems-tag-secondary <name1>, <name2>, ...
246
- set ztna-geo-tag <name1>, <name2>, ...
247
- set ztna-policy-redirect [enable|disable]
248
- set ztna-status [enable|disable]
249
- set ztna-tags-match-logic [or|and]
250
- next
251
- end\n
252
  """
253
-
254
  def submit_correction(original_answer, corrected_answer):
255
  # No operation function for the submit button click event
256
  return "Correction submitted!"
257
-
 
258
  correct_answer = gr.Textbox(label="Correct Answer", placeholder="Enter the correct answer if the provided one is wrong")
259
  submit_btn = gr.Button("Submit Correction")
260
  submit_btn.click(fn=submit_correction, inputs=[chatbot, correct_answer], outputs="text")
@@ -274,7 +93,7 @@ if __name__ == "__main__":
274
  title="FortiOS CLI Chat - Demo",
275
  description="FortiOS CLI Chat",
276
  theme="soft",
277
- chatbot=gr.Chatbot(label="Chat History",),
278
  textbox=gr.Textbox(placeholder="input", container=False, scale=7),
279
  retry_btn=None,
280
  undo_btn="Delete Previous",
@@ -296,4 +115,5 @@ if __name__ == "__main__":
296
  ["Configure an interface named 'Sec60' in the 'root' virtual domain with an IP address of 172.18.60.1/24. Allow management access to this interface for ping, fabric, and speed-test. Enable device identification and set the interface role to LAN. Set the SNMP index to 41 and enable auto-authentication for dedicated Fortinet extension devices. Additionally, enable switch controller features such as IGMP snooping, IGMP snooping proxy, and DHCP snooping. Set the color of the interface icon on the GUI to 7 and associate it with the 'FortiLink' interface and VLAN ID 60."],
297
  ],
298
  additional_inputs_accordion_name="Parameters",
299
- ).queue().launch()
 
 
67
  ["What are services in FortiOS and how are they used in firewall policies?"],
68
  ],
69
  """
70
+ sys_prompt = """FortiOS configuration in CLI.\n
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  """
 
72
  def submit_correction(original_answer, corrected_answer):
73
  # No operation function for the submit button click event
74
  return "Correction submitted!"
75
+
76
+ chatbot=gr.Chatbot(label="Chat History",)
77
  correct_answer = gr.Textbox(label="Correct Answer", placeholder="Enter the correct answer if the provided one is wrong")
78
  submit_btn = gr.Button("Submit Correction")
79
  submit_btn.click(fn=submit_correction, inputs=[chatbot, correct_answer], outputs="text")
 
93
  title="FortiOS CLI Chat - Demo",
94
  description="FortiOS CLI Chat",
95
  theme="soft",
96
+ chatbot=chatbot,
97
  textbox=gr.Textbox(placeholder="input", container=False, scale=7),
98
  retry_btn=None,
99
  undo_btn="Delete Previous",
 
115
  ["Configure an interface named 'Sec60' in the 'root' virtual domain with an IP address of 172.18.60.1/24. Allow management access to this interface for ping, fabric, and speed-test. Enable device identification and set the interface role to LAN. Set the SNMP index to 41 and enable auto-authentication for dedicated Fortinet extension devices. Additionally, enable switch controller features such as IGMP snooping, IGMP snooping proxy, and DHCP snooping. Set the color of the interface icon on the GUI to 7 and associate it with the 'FortiLink' interface and VLAN ID 60."],
116
  ],
117
  additional_inputs_accordion_name="Parameters",
118
+ ).queue().launch()
119
+ submit_btn.click(fn=submit_correction, inputs=[chatbot, correct_answer], outputs="text")