Skip to content
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a3eef1a
feat(ui): add Token Estimator link to footer
HmbleCreator Jun 29, 2025
6247f92
feat: Add token estimator documentation page and simplify footer link…
HmbleCreator Jun 30, 2025
cef47a2
feat: Add token estimator documentation page and simplify footer link…
HmbleCreator Jun 30, 2025
48328ab
feat: use Jinja template for token estimator API docs
HmbleCreator Jun 30, 2025
2ed86f6
Merge branch 'main' into main
filipchristiansen Jun 30, 2025
3f0c1a5
Merge branch 'main' into main
HmbleCreator Jul 1, 2025
98e5c45
Refactor token count API and routing, enforce API-only for /api/token…
HmbleCreator Jul 1, 2025
5c271b5
Merge branch 'main' of https://github.com/HmbleCreator/gitingest
HmbleCreator Jul 1, 2025
41ecea9
Merge branch 'main' into main
filipchristiansen Jul 1, 2025
92b8660
Merge branch 'main' into main
filipchristiansen Jul 2, 2025
e1648c4
Merge branch 'main' into main
HmbleCreator Jul 3, 2025
75daa98
Merge branch 'main' into main
filipchristiansen Jul 3, 2025
5b282b5
Merge branch 'main' into main
HmbleCreator Jul 4, 2025
806d2d5
Merge branch 'main' into main
HmbleCreator Jul 5, 2025
79eb882
Merge branch 'main' into main
HmbleCreator Jul 6, 2025
7852fde
Merge branch 'cyclotruc:main' into main
HmbleCreator Jul 7, 2025
b802ccf
Merge branch 'main' into main
filipchristiansen Jul 10, 2025
e1c5859
Merge branch 'main' into main
HmbleCreator Jul 14, 2025
9e69ce8
Merge branch 'main' into main
HmbleCreator Jul 19, 2025
260cb9b
Merge branch 'main' into main
HmbleCreator Aug 1, 2025
99bd52a
Merge branch 'main' into main
HmbleCreator Sep 23, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Add token estimator documentation page and simplify footer link…
… text - Add GET endpoint for /api/tokencount with interactive documentation - Include API usage examples and interactive form for testing
  • Loading branch information
HmbleCreator committed Jun 30, 2025
commit cef47a2982b20656fbda4808ab0af2cb5c3c1e3c
23 changes: 23 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from fastapi.testclient import TestClient
from src.server.main import app

client = TestClient(app, base_url="http://localhost")


def test_tokencount_valid():
response = client.post("/api/tokencount", json={"input_text": "Hello world!", "model_id": "openai-community/gpt2"}, headers={"host": "localhost"})
if response.status_code != 200:
print("Response content:", response.content)
assert response.status_code == 200
data = response.json()
assert "token_count" in data
assert isinstance(data["token_count"], int)
assert data["token_count"] > 0

def test_tokencount_missing_input():
response = client.post("/api/tokencount", json={"model_id": "openai-community/gpt2"}, headers={"host": "localhost"})
if response.status_code != 400:
print("Response content:", response.content)
assert response.status_code == 400
data = response.json()
assert "error" in data