Skip to content

Commit e8ad56d

Browse files
committed
重新模板接口返回值。
1 parent 66b0f3d commit e8ad56d

4 files changed

Lines changed: 4 additions & 34 deletions

File tree

src/router/v1.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ async def create_draft_with_template(
189189
code=0,
190190
message="success",
191191
draft_url=result["draft_url"],
192-
draft_id=result["draft_id"],
193-
tip_url=result["tip_url"],
194-
template_id=result["template_id"],
195-
estimated_duration=result.get("estimated_duration")
196192
)
197193

198194
except CustomException as e:
@@ -248,10 +244,6 @@ async def create_draft_688001(
248244
code=0,
249245
message="success",
250246
draft_url=result["draft_url"],
251-
draft_id=result["draft_id"],
252-
tip_url=result["tip_url"],
253-
template_id="688001",
254-
estimated_duration=result.get("estimated_duration")
255247
)
256248

257249
except CustomException as e:
@@ -295,10 +287,6 @@ async def create_draft_688002(
295287
code=0,
296288
message="success",
297289
draft_url=result["draft_url"],
298-
draft_id=result["draft_id"],
299-
tip_url=result["tip_url"],
300-
template_id="688002",
301-
estimated_duration=result.get("estimated_duration")
302290
)
303291

304292
except CustomException as e:
@@ -342,10 +330,6 @@ async def create_draft_688003(
342330
code=0,
343331
message="success",
344332
draft_url=result["draft_url"],
345-
draft_id=result["draft_id"],
346-
tip_url=result["tip_url"],
347-
template_id="688003",
348-
estimated_duration=result.get("estimated_duration")
349333
)
350334

351335
except CustomException as e:

src/schemas/template_base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ class CreateDraftResponse(BaseModel):
105105
code: int = Field(0, description="状态码,0表示成功")
106106
message: str = Field("success", description="状态信息")
107107
draft_url: str = Field(..., description="草稿下载URL")
108-
draft_id: str = Field(..., description="草稿ID")
109-
tip_url: str = Field(..., description="帮助文档URL")
110-
template_id: str = Field(..., description="使用的模板ID")
111-
estimated_duration: Optional[float] = Field(None, description="预估视频时长(秒)")
112108

113109

114110
class TemplateInfo(BaseModel):

tests/unit/test_template_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_create_draft_success(self, mock_create, mock_validate, mock_exists):
128128
"draft_url": "https://example.com/draft",
129129
"tip_url": "https://docs.example.com",
130130
"template_id": "688001",
131-
"estimated_duration": 30.0
131+
"estimated_duration": 30.0,
132132
}
133133

134134
response = client.post(
@@ -193,7 +193,7 @@ def test_create_draft_688001_success(self, mock_create):
193193
"draft_url": "https://example.com/draft",
194194
"tip_url": "https://docs.example.com",
195195
"template_id": "688001",
196-
"estimated_duration": 30.0
196+
"estimated_duration": 30.0,
197197
}
198198

199199
response = client.post(

tests/unit/test_template_schemas.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -425,21 +425,14 @@ def test_valid_response(self):
425425
code=0,
426426
message="success",
427427
draft_url="https://example.com/draft?id=123",
428-
draft_id="2024032512000012345678",
429-
tip_url="https://docs.example.com",
430-
template_id="688001",
431-
estimated_duration=30.5
432428
)
433429
assert response.code == 0
434-
assert response.draft_id == "2024032512000012345678"
430+
assert response.draft_url.startswith("https://example.com/draft")
435431

436432
def test_default_values(self):
437433
"""测试默认值"""
438434
response = CreateDraftResponse(
439435
draft_url="https://example.com/draft?id=123",
440-
draft_id="123",
441-
tip_url="https://docs.example.com",
442-
template_id="688001"
443436
)
444437
assert response.code == 0
445438
assert response.message == "success"
@@ -541,10 +534,7 @@ def test_response_dict(self):
541534
"""测试响应模型字典转换"""
542535
response = CreateDraftResponse(
543536
draft_url="https://example.com/draft",
544-
draft_id="123",
545-
tip_url="https://docs.example.com",
546-
template_id="688001"
547537
)
548538
data = response.model_dump()
549539
assert data["code"] == 0
550-
assert data["draft_id"] == "123"
540+
assert data["draft_url"] == "https://example.com/draft"

0 commit comments

Comments
 (0)