Skip to content

Commit 45908af

Browse files
committed
SimpleChatTC:Cleanup: General T2
Pretty print SimpleProxy gMe config Dont ignore the got http response status text. Update readme wrt why autoSecs
1 parent d34c614 commit 45908af

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

tools/server/public_simplechat/local.tools/filemagic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ def get_from_web(url: str, tag: str, inContentType: str, inHeaders: dict[str, st
4848
with urllib.request.urlopen(req, timeout=10) as response:
4949
contentData = response.read()
5050
statusCode = response.status or 200
51+
statusMsg = response.msg or ""
5152
contentType = response.getheader('Content-Type') or inContentType
53+
print(f"DBUG:FM:GFW:Resp:{response.status}:{response.msg}")
5254
debug.dump({ 'url': req.full_url, 'headers': req.headers, 'ctype': contentType }, { 'cdata': contentData })
53-
return Response(True, statusCode, "", contentType, contentData)
55+
return Response(True, statusCode, statusMsg, contentType, contentData)
5456
except Exception as exc:
5557
return Response(False, 502, f"WARN:{tag}:Failed:{exc}")
5658

tools/server/public_simplechat/local.tools/simpleproxy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ def process_args(args: list[str]):
228228
retained for literal_eval
229229
"""
230230
import ast
231+
import json
231232
global gMe
232233
iArg = 1
233234
while iArg < len(args):
@@ -252,7 +253,7 @@ def process_args(args: list[str]):
252253
except KeyError:
253254
print(f"ERRR:ProcessArgs:{iArg}:{cArg}:UnknownCommand")
254255
exit(103)
255-
print(gMe)
256+
print(json.dumps(gMe, indent=4))
256257
for k in gConfigNeeded:
257258
if gMe.get(k) == None:
258259
print(f"ERRR:ProcessArgs:{k}:missing, did you forget to pass the config file...")

tools/server/public_simplechat/local.tools/webmagic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# by Humans for All
33

44
import urllib.parse
5-
import urllib.request
65
import urlvalidator as uv
76
from dataclasses import dataclass
87
import html.parser

tools/server/public_simplechat/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ It is attached to the document object. Some of these can also be updated using t
279279

280280
setting this value to 0 (default), disables auto logic, so that end user can review the tool calls requested by ai and if needed even modify them, before triggering/executing them as well as review and modify results generated by the tool call, before submitting them back to the ai.
281281

282+
this is specified in seconds, so that users by default will normally not overload any website through the proxy server.
283+
282284
the builtin tools' meta data is sent to the ai model in the requests sent to it.
283285

284286
inturn if the ai model requests a tool call to be made, the same will be done and the response sent back to the ai model, under user control, by default.

0 commit comments

Comments
 (0)