HumeraR commited on
Commit
c0b9f7d
·
1 Parent(s): 3c705c5

Update .gitignore to exclude local notes and add local object storage; refactor imports in artifacts and voice routers; update test function signatures; enhance pricing tiers component to validate plans before setting state; add media-utils dependency in package-lock.json

Browse files
.gitignore CHANGED
@@ -20,3 +20,6 @@ renderer/build/
20
 
21
  # Local object storage (used when no R2 is configured)
22
  .storage/
 
 
 
 
20
 
21
  # Local object storage (used when no R2 is configured)
22
  .storage/
23
+
24
+ # Local-only notes, not for the repo
25
+ docs-local/
backend/app/routers/artifacts.py CHANGED
@@ -10,9 +10,9 @@ from app.models import Artifact, CalendarItem, Document, Job, Notebook
10
  from app.routers.notebooks import ensure_archive_notebook
11
  from app.services.artifacts import latest_jobs, serialize_artifact, start_artifact
12
  from app.services.jobs import create_job, serialize_job
 
13
  from app.services.renderer import COMPOSITIONS
14
  from app.services.storage import storage
15
- from app.services.plans import effective_plan, plan_limit_error
16
  from app.services.usage import check_limit
17
 
18
  router = APIRouter(prefix="/api/artifacts", tags=["artifacts"])
 
10
  from app.routers.notebooks import ensure_archive_notebook
11
  from app.services.artifacts import latest_jobs, serialize_artifact, start_artifact
12
  from app.services.jobs import create_job, serialize_job
13
+ from app.services.plans import effective_plan, plan_limit_error
14
  from app.services.renderer import COMPOSITIONS
15
  from app.services.storage import storage
 
16
  from app.services.usage import check_limit
17
 
18
  router = APIRouter(prefix="/api/artifacts", tags=["artifacts"])
backend/app/routers/voice.py CHANGED
@@ -266,7 +266,8 @@ async def design(body: DesignIn, ctx: Ctx = Depends(get_ctx)):
266
  for p in previews:
267
  key = f"ws/{ctx.workspace.id}/voice-previews/{uuid.uuid4().hex}.mp3"
268
  storage.put_bytes(key, p["audio"], "audio/mpeg")
269
- out.append({"generated_voice_id": p["generated_voice_id"], "url": storage.presign_get(key), "seconds": p["seconds"]})
 
270
  record_usage(ctx.db, workspace_id=ctx.workspace.id, kind="voice_design", provider="elevenlabs",
271
  quantity=len(out), unit="previews")
272
  return {"description": description, "previews": out}
 
266
  for p in previews:
267
  key = f"ws/{ctx.workspace.id}/voice-previews/{uuid.uuid4().hex}.mp3"
268
  storage.put_bytes(key, p["audio"], "audio/mpeg")
269
+ out.append({"generated_voice_id": p["generated_voice_id"], "url": storage.presign_get(key),
270
+ "seconds": p["seconds"]})
271
  record_usage(ctx.db, workspace_id=ctx.workspace.id, kind="voice_design", provider="elevenlabs",
272
  quantity=len(out), unit="previews")
273
  return {"description": description, "previews": out}
backend/tests/test_simplified_flows.py CHANGED
@@ -7,7 +7,7 @@ from app.models import Job
7
  from tests.test_buildout import auth, connect, docs, feed, llm # noqa: F401 (fixtures)
8
 
9
 
10
- def test_archive_notebook_is_created_once_and_listed_first(client, auth, run_jobs, feed):
11
  connect(client, auth, run_jobs)
12
  client.post("/api/notebooks", json={"title": "Newer"}, headers=auth)
13
  first = client.post("/api/notebooks/archive", headers=auth).json()
@@ -23,14 +23,14 @@ def test_archive_notebook_is_created_once_and_listed_first(client, auth, run_job
23
  assert nb["is_archive"] and len(nb["documents"]) == len(indexed)
24
 
25
 
26
- def test_generate_from_whole_archive_uses_the_archive_notebook(client, auth, run_jobs, feed):
27
  connect(client, auth, run_jobs)
28
  art = client.post("/api/artifacts/generate", json={"type": "summary", "archive": True}, headers=auth).json()
29
  archive = client.post("/api/notebooks/archive", headers=auth).json()
30
  assert art["notebook_id"] == archive["id"]
31
 
32
 
33
- def test_sync_queues_resurfacing_and_writing_voice_once(client, auth, feed, db_session, session_factory,
34
  monkeypatch):
35
  from app.services.jobs import claim_next
36
  from app.worker import run_job
 
7
  from tests.test_buildout import auth, connect, docs, feed, llm # noqa: F401 (fixtures)
8
 
9
 
10
+ def test_archive_notebook_is_created_once_and_listed_first(client, auth, run_jobs, feed): # noqa: F811
11
  connect(client, auth, run_jobs)
12
  client.post("/api/notebooks", json={"title": "Newer"}, headers=auth)
13
  first = client.post("/api/notebooks/archive", headers=auth).json()
 
23
  assert nb["is_archive"] and len(nb["documents"]) == len(indexed)
24
 
25
 
26
+ def test_generate_from_whole_archive_uses_the_archive_notebook(client, auth, run_jobs, feed): # noqa: F811
27
  connect(client, auth, run_jobs)
28
  art = client.post("/api/artifacts/generate", json={"type": "summary", "archive": True}, headers=auth).json()
29
  archive = client.post("/api/notebooks/archive", headers=auth).json()
30
  assert art["notebook_id"] == archive["id"]
31
 
32
 
33
+ def test_sync_queues_resurfacing_and_writing_voice_once(client, auth, feed, db_session, session_factory, # noqa: F811
34
  monkeypatch):
35
  from app.services.jobs import claim_next
36
  from app.worker import run_job
frontend/src/components/PricingTiers.tsx CHANGED
@@ -94,7 +94,7 @@ export default function PricingTiers() {
94
  useEffect(() => {
95
  api<{ billing_enabled: boolean; plans: Plan[] }>("/api/billing/plans")
96
  .then((r) => {
97
- setPlans(r.plans);
98
  setBillingEnabled(r.billing_enabled);
99
  })
100
  .catch(() => {
 
94
  useEffect(() => {
95
  api<{ billing_enabled: boolean; plans: Plan[] }>("/api/billing/plans")
96
  .then((r) => {
97
+ if (Array.isArray(r.plans) && r.plans.length > 0) setPlans(r.plans);
98
  setBillingEnabled(r.billing_enabled);
99
  })
100
  .catch(() => {
renderer/package-lock.json CHANGED
@@ -10,6 +10,7 @@
10
  "dependencies": {
11
  "@remotion/bundler": "4.0.242",
12
  "@remotion/google-fonts": "^4.0.242",
 
13
  "@remotion/renderer": "4.0.242",
14
  "express": "^4.21.2",
15
  "react": "^18.3.1",
 
10
  "dependencies": {
11
  "@remotion/bundler": "4.0.242",
12
  "@remotion/google-fonts": "^4.0.242",
13
+ "@remotion/media-utils": "4.0.242",
14
  "@remotion/renderer": "4.0.242",
15
  "express": "^4.21.2",
16
  "react": "^18.3.1",