Commit Graph

11 Commits

Author SHA1 Message Date
kingbri
036ba2669c Auth: Migrate to Pydantic
It's easier to work with Pydantic dataclasses rather than standard
python classes.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-12-12 23:58:22 -05:00
kingbri
eb8ccb9783 Tree: Fix linter issues
Signed-off-by: kingbri <bdashore3@proton.me>
2023-12-12 23:58:19 -05:00
kingbri
2bc3da0155 YAML: Force all files to open with utf8
The default encoding method when opening files on Windows is cp1252
which doesn't support all unicode and can cause issues.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-29 22:04:29 -05:00
kingbri
2aa9c145be Auth: Fix an oops with headers
I copy pasted the code wrong.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-20 00:16:12 -05:00
kingbri
39ea730be5 Auth: Allow admin keys to work with api key routes
Admin keys are an administrator key, so it makes sense to allow it
for API key routes as well.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-19 23:53:07 -05:00
kingbri
e4a8848445 Auth: Log API and admin key on startup
Helpful for users who run headless or use Docker.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-19 00:52:39 -05:00
kingbri
6b9af58cc1 Tree: Fix extraneous bugs and update T/s print
Model: Add extra information to print and fix the divide by zero error.
Auth: Fix validation of API and admin keys to look for the entire key.

References #7 and #6

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-18 22:34:40 -05:00
kingbri
d627d14385 API: Fix exceptions and defaults
Stop conditions was None, causing model to error out when trying to
add the EOS token to a None value.

Authentication failed when Bearer contained an empty string. To fix
this, add a condition which checks array length.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-17 17:56:05 -05:00
kingbri
593471a04d Auth: Fix init from YAML dict
A class can't have multiple constructors.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-15 23:00:12 -05:00
kingbri
bbb59d0747 Auth: Fix methods for writing and validation
These were not working properly. Make the YAML file get written
to properly and the validator to return a 401 when the bearer
token is invalid.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-15 00:55:15 -05:00
kingbri
b625bface9 OAI: Add API-based model loading/unloading and auth routes
Models can be loaded and unloaded via the API. Also add authentication
to use the API and for administrator tasks.

Both types of authorization use different keys.

Also fix the unload function to properly free all used vram.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-11-14 01:17:19 -05:00