unisi 0.3.17__py3-none-any.whl → 0.3.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unisi/containers.py +1 -0
- unisi/llmrag.py +13 -2
- unisi/server.py +3 -4
- unisi/web/css/565.f35d8840.css +1 -0
- unisi/web/css/72.9393078c.css +1 -0
- unisi/web/css/{vendor.f7e3cefe.css → app.36cc37f3.css} +3 -3
- unisi/web/css/app.36cc37f3.css.gz +0 -0
- unisi/web/fonts/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWuYjalmUiAw.2cafd699.woff +0 -0
- unisi/web/fonts/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWuZtalmUiAw.7f471697.woff +0 -0
- unisi/web/fonts/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWuaabVmUiAw.b69d1cce.woff +0 -0
- unisi/web/fonts/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWub2bVmUiAw.2115c3bd.woff +0 -0
- unisi/web/fonts/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWubEbFmUiAw.bb8ee9ee.woff +0 -0
- unisi/web/fonts/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWubEbVmUiAw.eb9d7304.woff +0 -0
- unisi/web/index.html +1 -1
- unisi/web/js/260.1d50abd6.js +1 -0
- unisi/web/js/565.437dc595.js +3 -0
- unisi/web/js/565.437dc595.js.gz +0 -0
- unisi/web/js/609.a5c4177e.js +1 -0
- unisi/web/js/72.f1673470.js +1 -0
- unisi/web/js/935.a10cb1a0.js +1 -0
- unisi/web/js/app.aa62bd3c.js +1 -0
- unisi/web/js/echart.8f773fb7.js +1 -0
- unisi/web/js/echart.8f773fb7.js.gz +0 -0
- unisi/web/js/sigma.ce21336a.js +1 -0
- unisi/web/js/sigma.ce21336a.js.gz +0 -0
- unisi/web/js/vendor.6a64dcc5.js +57 -0
- unisi/web/js/vendor.6a64dcc5.js.gz +0 -0
- {unisi-0.3.17.dist-info → unisi-0.3.19.dist-info}/METADATA +1 -1
- unisi-0.3.19.dist-info/RECORD +58 -0
- unisi/web/css/337.703d8f36.css +0 -1
- unisi/web/css/app.31d6cfe0.css +0 -0
- unisi/web/fonts/KFOkCnqEu92Fr1MmgVxIIzQ.68bb21d0.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmEU9fBBc-.48af7707.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmSU5fBBc-.c2f7ab22.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.77ecb942.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmYUtfBBc-.f5677eb2.woff +0 -0
- unisi/web/fonts/KFOmCnqEu92Fr1Mu4mxM.f1e2a767.woff +0 -0
- unisi/web/js/337.f67a085d.js +0 -3
- unisi/web/js/609.35dc13d3.js +0 -1
- unisi/web/js/935.cc0c012c.js +0 -1
- unisi/web/js/app.5d4f7ec8.js +0 -1
- unisi/web/js/vendor.1bb14e9d.js +0 -45
- unisi-0.3.17.dist-info/RECORD +0 -49
- {unisi-0.3.17.dist-info → unisi-0.3.19.dist-info}/WHEEL +0 -0
- {unisi-0.3.17.dist-info → unisi-0.3.19.dist-info}/entry_points.txt +0 -0
- {unisi-0.3.17.dist-info → unisi-0.3.19.dist-info}/licenses/LICENSE +0 -0
unisi/containers.py
CHANGED
@@ -145,6 +145,7 @@ class Dialog:
|
|
145
145
|
|
146
146
|
async def dialog_command_handler(self, button, _):
|
147
147
|
if user := Unishare.context_user():
|
148
|
+
user.active_dialog = None
|
148
149
|
await user.send(TypeMessage('action', 'close'))
|
149
150
|
return await call_anysync(self.changed, self, button.name)
|
150
151
|
|
unisi/llmrag.py
CHANGED
@@ -80,6 +80,13 @@ def is_type(variable, expected_type):
|
|
80
80
|
|
81
81
|
return False
|
82
82
|
|
83
|
+
def remove_comments(json_str):
|
84
|
+
# Regular expression to remove single-line comments (// ...)
|
85
|
+
json_str = re.sub(r'//.*', '', json_str)
|
86
|
+
# Regular expression to remove multi-line comments (/* ... */)
|
87
|
+
json_str = re.sub(r'/\*.*?\*/', '', json_str, flags=re.DOTALL)
|
88
|
+
return json_str
|
89
|
+
|
83
90
|
def Q(str_prompt, type_value = str, blank = True, **format_model):
|
84
91
|
"""returns LLM async call for a question"""
|
85
92
|
llm = Unishare.llm_model
|
@@ -90,13 +97,17 @@ def Q(str_prompt, type_value = str, blank = True, **format_model):
|
|
90
97
|
if not re.search(r'json', str_prompt, re.IGNORECASE):
|
91
98
|
jtype = jstype(type_value)
|
92
99
|
format = " dd/mm/yyyy string" if type_value == 'date' else f'a JSON {jtype}' if jtype != 'string' else jtype
|
93
|
-
str_prompt = f"System: You are an intelligent and extremely smart assistant. Output STRONGLY {format}.
|
100
|
+
str_prompt = f"System: You are an intelligent and extremely smart assistant. Output STRONGLY {format}. DO NOT OUTPUT ANY COMMENTARY." + str_prompt
|
94
101
|
async def f():
|
95
102
|
io = await llm.ainvoke(str_prompt)
|
96
103
|
js = io.content.strip().strip('`').replace('json', '')
|
97
104
|
if type_value == str or type_value == 'date':
|
98
105
|
return js
|
99
|
-
|
106
|
+
try:
|
107
|
+
clean_js = remove_comments(js)
|
108
|
+
parsed = json.loads(clean_js)
|
109
|
+
except json.JSONDecodeError as e:
|
110
|
+
raise ValueError(f'Invalid JSON: {js}, \n Query: {str_prompt}')
|
100
111
|
if isinstance(type_value, dict):
|
101
112
|
for k, v in type_value.items():
|
102
113
|
if k not in parsed:
|
unisi/server.py
CHANGED
@@ -174,11 +174,10 @@ def start(user_type = User, http_handlers = []):
|
|
174
174
|
User.type = user_type
|
175
175
|
run_tests(User.init_user())
|
176
176
|
|
177
|
-
|
178
|
-
|
179
|
-
web.get('/{tail:.*}', static_serve), web.post('/', post_handler)]
|
177
|
+
server_handlers = [web.get('/ws', websocket_handler), web.static(f'/{config.upload_dir}', upload_dir),
|
178
|
+
web.get('/{tail:.*}', static_serve), web.post('/', post_handler)] + http_handlers
|
180
179
|
|
181
180
|
app = web.Application()
|
182
|
-
app.add_routes(
|
181
|
+
app.add_routes(server_handlers)
|
183
182
|
web.run_app(app, port = port)
|
184
183
|
|
@@ -0,0 +1 @@
|
|
1
|
+
thead tr:first-child th{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);position:sticky;top:0;z-index:1000}:root{--scrollbar-width-height:10px;--scrollbar-thumb-hover:#2176d2;--scrollbar-thumb-dark:#2176d2;--scrollbar-thumb-hover-dark:#2176d2}::-webkit-scrollbar{height:var(--scrollbar-width-height);width:var(--scrollbar-width-height)}::-webkit-scrollbar-track{box-shadow:inset 0 0 4px var(--scrollbar-track-dark)}::-webkit-scrollbar-corner{background:var(--scrollbar-track-dark)}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb-dark);border-radius:5px}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover-dark)}body[data-v-6398f67f]{display:flex;justify-content:center}.custom-caption[data-v-6398f67f]{padding:5px!important}.web-camera-container[data-v-6398f67f]{align-items:center;border:1px solid #ccc;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-bottom:2rem;margin-top:2rem;padding:2rem;width:500px}.web-camera-container .camera-button[data-v-6398f67f]{margin-bottom:2rem}.web-camera-container .camera-box .camera-shutter[data-v-6398f67f]{background-color:#fff;height:337.5px;opacity:0;position:absolute;width:450px}.web-camera-container .camera-box .camera-shutter.flash[data-v-6398f67f]{opacity:1}.web-camera-container .camera-shoot[data-v-6398f67f]{margin:1rem 0}.web-camera-container .camera-shoot button[data-v-6398f67f]{align-items:center;border-radius:100%;display:flex;height:60px;justify-content:center;width:60px}.web-camera-container .camera-shoot button img[data-v-6398f67f]{height:35px;object-fit:cover}.web-camera-container .camera-loading[data-v-6398f67f]{height:100%;margin:3rem 0 0 -1.2rem;min-height:150px;overflow:hidden;position:absolute;width:100%}.web-camera-container .camera-loading ul[data-v-6398f67f]{height:100%;margin:0;position:absolute;width:100%;z-index:999999}.web-camera-container .camera-loading .loader-circle[data-v-6398f67f]{display:block;height:14px;left:100%;margin:0 auto;padding:0;position:absolute;top:50%;transform:translateY(-50%);transform:translateX(-50%);width:100%}.web-camera-container .camera-loading .loader-circle li[data-v-6398f67f]{animation:preload-6398f67f 1s infinite;background:#999;border-radius:100%;display:block;float:left;height:10px;line-height:10px;margin:0 0 0 4px;padding:0;position:relative;top:-50%;width:10px}.web-camera-container .camera-loading .loader-circle li[data-v-6398f67f]:nth-child(2){animation-delay:.2s}.web-camera-container .camera-loading .loader-circle li[data-v-6398f67f]:nth-child(3){animation-delay:.4s}@keyframes preload-6398f67f{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.container[data-v-6398f67f]{position:relative}.frame[data-v-6398f67f]{border:2px solid #573497;border-radius:8px;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:10}.container{position:relative}.frame{border:2px solid #573497;border-radius:8px;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:10}.q-tab__label{font-size:16px;font-weight:700}
|
@@ -0,0 +1 @@
|
|
1
|
+
#header[data-v-a6b7e7b0]{font-size:16px;font-weight:700;left:10px;pointer-events:none;position:absolute;top:10px;z-index:2}#graph[data-v-a6b7e7b0]{border:1px solid #ccc;height:600px;position:relative;width:100%}
|