Use generated short id for llm asr tts

This commit is contained in:
Xin Wang
2026-02-12 19:05:50 +08:00
parent 14991af1bf
commit 28ca003662
6 changed files with 98 additions and 27 deletions

View File

@@ -1,12 +1,12 @@
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from typing import List, Optional
import uuid
import httpx
import time
from datetime import datetime
from ..db import get_db
from ..id_generator import unique_short_id
from ..models import LLMModel
from ..schemas import (
LLMModelCreate, LLMModelUpdate, LLMModelOut,
@@ -53,7 +53,7 @@ def get_llm_model(id: str, db: Session = Depends(get_db)):
def create_llm_model(data: LLMModelCreate, db: Session = Depends(get_db)):
"""创建LLM模型"""
llm_model = LLMModel(
id=data.id or str(uuid.uuid4())[:8],
id=unique_short_id("llm", db, LLMModel),
user_id=1, # 默认用户
name=data.name,
vendor=data.vendor,