modify: 流式输出
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
class AddGetRequest(BaseModel):
|
||||
@@ -67,6 +67,11 @@ class MultiplyGetResponse(BaseModel):
|
||||
operation: str = Field(default='multiply')
|
||||
timestamp: Optional[float] = Field(default=0.0)
|
||||
|
||||
class StreamChatPostRequest(BaseModel):
|
||||
"""模拟 AI 流式对话(SSE,逐 token 输出) — 请求体"""
|
||||
prompt: str = Field(...)
|
||||
tokens: int = Field(...)
|
||||
|
||||
class SubtractGetRequest(BaseModel):
|
||||
"""Subtract two numbers — 请求体"""
|
||||
a: float = Field(...)
|
||||
@@ -80,4 +85,4 @@ class SubtractGetResponse(BaseModel):
|
||||
|
||||
|
||||
# 所有响应模型的联合类型
|
||||
ExampleResponse = AddPostResponse | AddGetResponse | DivideGetResponse | SubtractGetResponse | CountGetResponse | MultiplyGetResponse
|
||||
ExampleResponse = MultiplyGetResponse | AddPostResponse | CountGetResponse | SubtractGetResponse | DivideGetResponse | AddGetResponse
|
||||
|
||||
Reference in New Issue
Block a user