- Added views for webshop admin interface using FastAPI and Jinja2 templates. - Created initial SQL migration for webshop configurations, products, orders, and order items. - Defined module metadata in module.json for webshop. - Implemented HTML template for the webshop index page. - Documented frontend requirements and API contracts in WEBSHOP_FRONTEND_PROMPT.md. - Introduced scripts for generating conversation summaries and testing Whisper capabilities.
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
import logging
|
|
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
from app.core.database import init_db, execute_query, execute_update
|
|
from app.services.ollama_service import ollama_service
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
async def main(conv_id):
|
|
init_db()
|
|
|
|
# Get transcript
|
|
rows = execute_query("SELECT transcript FROM conversations WHERE id = %s", (conv_id,))
|
|
if not rows or not rows[0]['transcript']:
|
|
print("No transcript found")
|
|
return
|
|
|
|
transcript = rows[0]['transcript']
|
|
print(f"Transcript length: {len(transcript)}")
|
|
|
|
# Override endpoint for Docker Mac access
|
|
ollama_service.endpoint = os.environ.get("OLLAMA_ENDPOINT", "http://host.docker.internal:11434")
|
|
print(f"Using Ollama endpoint: {ollama_service.endpoint}")
|
|
|
|
summary = await ollama_service.generate_summary(transcript)
|
|
print(f"Summary generated: {summary}")
|
|
|
|
execute_update("UPDATE conversations SET summary = %s WHERE id = %s", (summary, conv_id))
|
|
print("Database updated")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main(1))
|