feat: 沙盒模型合规优化 — 移除境外模型引用,新增 GET /sandbox/models 接口
- MODEL_CATALOG 仅保留国内已备案模型(DeepSeek/SenseNova) - chat()/chatStream() modelMap 仅路由到国内 provider - provider 命名明确化:"OpenAI 兼容接口" → "硅基流动 / DeepSeek" - 新增 getSandboxModels() 动态返回可用模型列表 - sandbox 控制器拆分 auth 级别,GET /sandbox/models 无需认证 - 新增 getAvailableModels() 供前端调用 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -3,6 +3,13 @@ import { PrismaService } from '../../prisma/prisma.service';
|
||||
import { AIGatewayService, ChatOptions } from '../ai/ai-gateway.service';
|
||||
import { randomUUID, createHmac } from 'crypto';
|
||||
|
||||
export interface SandboxModelInfo {
|
||||
id: string;
|
||||
label: string;
|
||||
provider: string;
|
||||
desc: string;
|
||||
}
|
||||
|
||||
interface StreamResult {
|
||||
type: 'text' | 'done' | 'error';
|
||||
content?: string;
|
||||
@@ -288,6 +295,16 @@ export class SandboxService {
|
||||
};
|
||||
}
|
||||
|
||||
/** 返回沙箱中可用的模型列表 */
|
||||
getAvailableModels(): SandboxModelInfo[] {
|
||||
return this.aiGateway.getSandboxModels().map(m => ({
|
||||
id: m.id,
|
||||
label: m.label,
|
||||
provider: m.provider,
|
||||
desc: m.desc,
|
||||
}));
|
||||
}
|
||||
|
||||
async generateShareToken(userId: number, sessionId: number) {
|
||||
const session = await this.prisma.sandboxSession.findFirst({
|
||||
where: { id: sessionId, userId },
|
||||
|
||||
Reference in New Issue
Block a user