Skip to content

Commit

Permalink
✨ feat: Add novelai-python package and initial implementation
Browse files Browse the repository at this point in the history
- Added novelai-python package to the repository
- Implemented the initial version of the `NaiResult` and `NovelAiInference` classes
- Added error handling classes `ServerError`, `ValidationError`, and `AuthError`
- Implemented `NaiPic` class for image processing and encoding/decoding
- Added test cases in the `tests` directory for the implemented classes
- Created GitHub workflows for publishing to PyPI and running tests

# Raw Changes
- Added `novelai-python` package and initial implementation
- Created `NaiResult` and `NovelAiInference` classes
- Added error handling classes `ServerError`, `ValidationError`, and `AuthError`
- Implemented `NaiPic` class for image processing and encoding/decoding
- Added test cases in the `tests` directory
- Created GitHub workflows for publishing to PyPI and running tests
  • Loading branch information
sudoskys committed Jan 26, 2024
1 parent 2033b27 commit 9ec2a14
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# @Time : 2024/1/22 下午11:50
# @Author : sudoskys
# @File : test_server.py
# @Software: PyCharm
from pydantic import SecretStr

from novelai_gen import NovelAiInference, CurlSession, CheckError


def test_nai():
try:
_nai = NovelAiInference.build(prompt="", steps=29)
_nai.charge = False
print(_nai.charge)
_nai.validate_charge()
_nai.generate(session=CurlSession(jwt_token=SecretStr("555")))
except Exception as e:
print(e)
assert isinstance(e, CheckError)
else:
assert False

0 comments on commit 9ec2a14

Please sign in to comment.