llms-py 2.0.13__py3-none-any.whl → 2.0.15__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.
- llms/__init__.py +2 -0
- llms/__main__.py +9 -0
- llms/__pycache__/__init__.cpython-312.pyc +0 -0
- llms/__pycache__/__main__.cpython-312.pyc +0 -0
- llms/__pycache__/llms.cpython-312.pyc +0 -0
- llms/__pycache__/main.cpython-312.pyc +0 -0
- llms.py → llms/main.py +65 -19
- {llms_py-2.0.13.data/data → llms}/ui/ai.mjs +1 -1
- llms/ui/lib/vue.mjs +18369 -0
- {llms_py-2.0.13.dist-info → llms_py-2.0.15.dist-info}/METADATA +1 -1
- llms_py-2.0.15.dist-info/RECORD +46 -0
- llms_py-2.0.15.dist-info/entry_points.txt +2 -0
- llms_py-2.0.13.data/data/requirements.txt +0 -1
- llms_py-2.0.13.dist-info/RECORD +0 -40
- llms_py-2.0.13.dist-info/entry_points.txt +0 -2
- {llms_py-2.0.13.data/data → llms}/index.html +0 -0
- {llms_py-2.0.13.data/data → llms}/llms.json +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/App.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/Avatar.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/Brand.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/ChatPrompt.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/Main.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/ModelSelector.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/ProviderStatus.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/Recents.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/SettingsDialog.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/Sidebar.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/SignIn.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/SystemPromptEditor.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/SystemPromptSelector.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/Welcome.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/app.css +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/fav.svg +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/highlight.min.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/idb.min.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/marked.min.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/servicestack-client.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/servicestack-vue.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/vue-router.min.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/lib/vue.min.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/markdown.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/tailwind.input.css +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/threadStore.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/typography.css +0 -0
- {llms_py-2.0.13.data/data → llms}/ui/utils.mjs +0 -0
- {llms_py-2.0.13.data/data → llms}/ui.json +0 -0
- {llms_py-2.0.13.dist-info → llms_py-2.0.15.dist-info}/WHEEL +0 -0
- {llms_py-2.0.13.dist-info → llms_py-2.0.15.dist-info}/licenses/LICENSE +0 -0
- {llms_py-2.0.13.dist-info → llms_py-2.0.15.dist-info}/top_level.txt +0 -0
llms/__init__.py
ADDED
llms/__main__.py
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
llms.py → llms/main.py
RENAMED
|
@@ -22,7 +22,7 @@ from aiohttp import web
|
|
|
22
22
|
from pathlib import Path
|
|
23
23
|
from importlib import resources # Py≥3.9 (pip install importlib_resources for 3.7/3.8)
|
|
24
24
|
|
|
25
|
-
VERSION = "2.0.
|
|
25
|
+
VERSION = "2.0.15"
|
|
26
26
|
_ROOT = None
|
|
27
27
|
g_config_path = None
|
|
28
28
|
g_ui_path = None
|
|
@@ -947,6 +947,36 @@ def resolve_root():
|
|
|
947
947
|
# importlib.resources not available (Python < 3.9)
|
|
948
948
|
pass
|
|
949
949
|
|
|
950
|
+
# Method 1b: Look for the installed package and check for UI files
|
|
951
|
+
try:
|
|
952
|
+
import llms
|
|
953
|
+
# If llms is a package, check its directory
|
|
954
|
+
if hasattr(llms, '__path__'):
|
|
955
|
+
# It's a package
|
|
956
|
+
package_path = Path(llms.__path__[0])
|
|
957
|
+
|
|
958
|
+
# Check if UI files are in the package directory
|
|
959
|
+
if (package_path / "index.html").exists() and (package_path / "ui").is_dir():
|
|
960
|
+
_log(f"RESOURCE ROOT (package directory): {package_path}")
|
|
961
|
+
return package_path
|
|
962
|
+
else:
|
|
963
|
+
# It's a module
|
|
964
|
+
module_path = Path(llms.__file__).resolve().parent
|
|
965
|
+
|
|
966
|
+
# Check if UI files are in the same directory as the module
|
|
967
|
+
if (module_path / "index.html").exists() and (module_path / "ui").is_dir():
|
|
968
|
+
_log(f"RESOURCE ROOT (module directory): {module_path}")
|
|
969
|
+
return module_path
|
|
970
|
+
|
|
971
|
+
# Check parent directory (sometimes data files are installed one level up)
|
|
972
|
+
parent_path = module_path.parent
|
|
973
|
+
if (parent_path / "index.html").exists() and (parent_path / "ui").is_dir():
|
|
974
|
+
_log(f"RESOURCE ROOT (module parent): {parent_path}")
|
|
975
|
+
return parent_path
|
|
976
|
+
|
|
977
|
+
except (ImportError, AttributeError):
|
|
978
|
+
pass
|
|
979
|
+
|
|
950
980
|
# Method 2: Try to find data files in sys.prefix (where data_files are installed)
|
|
951
981
|
# Get all possible installation directories
|
|
952
982
|
possible_roots = [
|
|
@@ -976,6 +1006,22 @@ def resolve_root():
|
|
|
976
1006
|
except AttributeError:
|
|
977
1007
|
pass
|
|
978
1008
|
|
|
1009
|
+
# Method 2b: Look for data files in common macOS Homebrew locations
|
|
1010
|
+
# Homebrew often installs data files in different locations
|
|
1011
|
+
homebrew_roots = []
|
|
1012
|
+
if sys.platform == "darwin": # macOS
|
|
1013
|
+
homebrew_prefixes = ["/opt/homebrew", "/usr/local"] # Apple Silicon and Intel
|
|
1014
|
+
for prefix in homebrew_prefixes:
|
|
1015
|
+
if Path(prefix).exists():
|
|
1016
|
+
homebrew_roots.extend([
|
|
1017
|
+
Path(prefix),
|
|
1018
|
+
Path(prefix) / "share",
|
|
1019
|
+
Path(prefix) / "lib" / "python3.11" / "site-packages",
|
|
1020
|
+
Path(prefix) / "lib" / f"python{sys.version_info.major}.{sys.version_info.minor}" / "site-packages",
|
|
1021
|
+
])
|
|
1022
|
+
|
|
1023
|
+
possible_roots.extend(homebrew_roots)
|
|
1024
|
+
|
|
979
1025
|
for root in possible_roots:
|
|
980
1026
|
try:
|
|
981
1027
|
if root.exists() and (root / "index.html").exists() and (root / "ui").is_dir():
|
|
@@ -1118,12 +1164,12 @@ def main():
|
|
|
1118
1164
|
if resource_exists(resource_config_path):
|
|
1119
1165
|
try:
|
|
1120
1166
|
# Read config from resource (handle both Path and Traversable objects)
|
|
1121
|
-
config_json = read_resource_text(
|
|
1167
|
+
config_json = read_resource_text(resource_config_path)
|
|
1122
1168
|
except (OSError, AttributeError) as e:
|
|
1123
1169
|
_log(f"Error reading resource config: {e}")
|
|
1124
1170
|
if not config_json:
|
|
1125
1171
|
try:
|
|
1126
|
-
config_json = asyncio.run(save_text(github_url("llms.json"),
|
|
1172
|
+
config_json = asyncio.run(save_text(github_url("llms.json"), home_config_path))
|
|
1127
1173
|
except Exception as e:
|
|
1128
1174
|
_log(f"Error downloading llms.json: {e}")
|
|
1129
1175
|
print("Could not create llms.json. Create one with --init or use --config <path>")
|
|
@@ -1279,6 +1325,20 @@ def main():
|
|
|
1279
1325
|
raise web.HTTPNotFound
|
|
1280
1326
|
|
|
1281
1327
|
app.router.add_get("/ui/{path:.*}", ui_static, name="ui_static")
|
|
1328
|
+
|
|
1329
|
+
async def ui_config_handler(request):
|
|
1330
|
+
with open(g_ui_path, "r") as f:
|
|
1331
|
+
ui = json.load(f)
|
|
1332
|
+
if 'defaults' not in ui:
|
|
1333
|
+
ui['defaults'] = g_config['defaults']
|
|
1334
|
+
enabled, disabled = provider_status()
|
|
1335
|
+
ui['status'] = {
|
|
1336
|
+
"all": list(g_config['providers'].keys()),
|
|
1337
|
+
"enabled": enabled,
|
|
1338
|
+
"disabled": disabled
|
|
1339
|
+
}
|
|
1340
|
+
return web.json_response(ui)
|
|
1341
|
+
app.router.add_get('/config', ui_config_handler)
|
|
1282
1342
|
|
|
1283
1343
|
async def not_found_handler(request):
|
|
1284
1344
|
return web.Response(text="404: Not Found", status=404)
|
|
@@ -1294,23 +1354,9 @@ def main():
|
|
|
1294
1354
|
|
|
1295
1355
|
# Serve index.html as fallback route (SPA routing)
|
|
1296
1356
|
app.router.add_route('*', '/{tail:.*}', index_handler)
|
|
1297
|
-
|
|
1298
|
-
async def ui_config_handler(request):
|
|
1299
|
-
with open(g_ui_path, "r") as f:
|
|
1300
|
-
ui = json.load(f)
|
|
1301
|
-
if 'defaults' not in ui:
|
|
1302
|
-
ui['defaults'] = g_config['defaults']
|
|
1303
|
-
enabled, disabled = provider_status()
|
|
1304
|
-
ui['status'] = {
|
|
1305
|
-
"all": list(g_config['providers'].keys()),
|
|
1306
|
-
"enabled": enabled,
|
|
1307
|
-
"disabled": disabled
|
|
1308
|
-
}
|
|
1309
|
-
return web.json_response(ui)
|
|
1310
|
-
app.router.add_get('/config', ui_config_handler)
|
|
1311
1357
|
|
|
1312
1358
|
print(f"Starting server on port {port}...")
|
|
1313
|
-
web.run_app(app, host='0.0.0.0', port=port)
|
|
1359
|
+
web.run_app(app, host='0.0.0.0', port=port, print=_log)
|
|
1314
1360
|
exit(0)
|
|
1315
1361
|
|
|
1316
1362
|
if cli_args.enable is not None:
|
|
@@ -1436,5 +1482,5 @@ def main():
|
|
|
1436
1482
|
parser.print_help()
|
|
1437
1483
|
|
|
1438
1484
|
|
|
1439
|
-
if __name__ == "__main__":
|
|
1485
|
+
if __name__ == "__main__":
|
|
1440
1486
|
main()
|