feat(transcription): v0.5.0 with global speaker management and trimming
- Backend: Added global speaker rename endpoint - Backend: Hardened JSON parsing and timestamp offsets - Frontend: Integrated Speaker Management Bar - Frontend: Added Trim Start/End (Scissors) and Single Line Delete - Frontend: Fixed various TypeScript and Syntax issues - Docs: Full documentation of v0.5.0 features
This commit is contained in:
@@ -97,6 +97,41 @@ async def upload_audio(
|
||||
|
||||
return meeting
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
class RenameRequest(BaseModel):
|
||||
old_name: str
|
||||
new_name: str
|
||||
|
||||
@app.post("/api/meetings/{meeting_id}/rename_speaker")
|
||||
def rename_speaker_globally(meeting_id: int, payload: RenameRequest, db: Session = Depends(get_db)):
|
||||
meeting = db.query(Meeting).filter(Meeting.id == meeting_id).first()
|
||||
if not meeting:
|
||||
raise HTTPException(404, detail="Meeting not found")
|
||||
|
||||
count = 0
|
||||
# Iterate over all chunks directly from DB relation
|
||||
for chunk in meeting.chunks:
|
||||
if not chunk.json_content:
|
||||
continue
|
||||
|
||||
modified = False
|
||||
new_content = []
|
||||
for msg in chunk.json_content:
|
||||
if msg.get("speaker") == payload.old_name:
|
||||
msg["speaker"] = payload.new_name
|
||||
modified = True
|
||||
count += 1
|
||||
new_content.append(msg)
|
||||
|
||||
if modified:
|
||||
# Force update of the JSON field
|
||||
chunk.json_content = list(new_content)
|
||||
db.add(chunk)
|
||||
|
||||
db.commit()
|
||||
return {"status": "updated", "rows_affected": count}
|
||||
|
||||
@app.delete("/api/meetings/{meeting_id}")
|
||||
def delete_meeting(meeting_id: int, db: Session = Depends(get_db)):
|
||||
meeting = db.query(Meeting).filter(Meeting.id == meeting_id).first()
|
||||
|
||||
Reference in New Issue
Block a user