feat(transcription): [2f388f42] integrate prompt database and AI insights

Implements the core functionality for the AI-powered analysis of meeting transcripts in the Transcription Tool.

This commit introduces a new 'AI Insights' feature that allows users to generate various summaries and analyses from a transcript on demand.

- Creates a  to manage and version different AI prompts for tasks like generating meeting minutes, extracting action items, and creating sales summaries.
- Adds a new  responsible for orchestrating the analysis process: fetching the transcript, calling the Gemini API with the appropriate prompt, and caching the results in the database.
- Extends the FastAPI backend with a new endpoint  to trigger the insight generation.
- Updates the React frontend () with a new 'AI Insights' panel, including buttons to trigger the analyses and a modal to display the results.
- Updates the documentation () to reflect the new features, API endpoints, and version.
This commit is contained in:
2026-01-26 07:43:24 +00:00
parent 01c4968ddf
commit 771b06c1bc
5 changed files with 348 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ from datetime import datetime
from .config import settings
from .database import init_db, get_db, Meeting, TranscriptChunk, AnalysisResult, SessionLocal
from .services.orchestrator import process_meeting_task
from .services.insights_service import generate_insight
# Initialize FastAPI App
app = FastAPI(
@@ -42,7 +43,8 @@ def list_meetings(db: Session = Depends(get_db)):
@app.get("/api/meetings/{meeting_id}")
def get_meeting(meeting_id: int, db: Session = Depends(get_db)):
meeting = db.query(Meeting).options(
joinedload(Meeting.chunks)
joinedload(Meeting.chunks),
joinedload(Meeting.analysis_results) # Eager load analysis results
).filter(Meeting.id == meeting_id).first()
if not meeting:
@@ -99,6 +101,26 @@ async def upload_audio(
from pydantic import BaseModel
class InsightRequest(BaseModel):
insight_type: str
@app.post("/api/meetings/{meeting_id}/insights")
def create_insight(meeting_id: int, payload: InsightRequest, db: Session = Depends(get_db)):
"""
Triggers the generation of a specific insight (e.g., meeting minutes, action items).
If the insight already exists, it returns the stored result.
Otherwise, it generates, stores, and returns the new insight.
"""
try:
insight = generate_insight(db, meeting_id, payload.insight_type)
return insight
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
except Exception as e:
# For unexpected errors, return a generic 500 error
print(f"ERROR: Unexpected error in create_insight: {e}")
raise HTTPException(status_code=500, detail="An internal error occurred while generating the insight.")
class RenameRequest(BaseModel):
old_name: str
new_name: str