refactor(api): migrate service app endpoints to BaseModel (#37960)

Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
chariri
2026-07-09 04:23:47 +00:00
committed by GitHub
co-authored by Asuka Minato autofix-ci[bot]
parent 458aa4892d
commit 6540d178c6
14 changed files with 522 additions and 338 deletions
@@ -20,7 +20,7 @@ export type AgentThought = {
}
export type Annotation = {
content?: string | null
answer?: string | null
created_at?: number | null
hit_count?: number | null
id: string
@@ -32,10 +32,15 @@ export type AnnotationCreatePayload = {
question: string
}
export type AnnotationJobStatusResponse = {
error_msg?: string | null
export type AnnotationJobStatusDetailResponse = {
error_msg?: string
job_id: string
job_status: string
job_status: 'completed' | 'error' | 'processing' | 'waiting' | string
}
export type AnnotationJobStatusResponse = {
job_id: string
job_status: 'completed' | 'error' | 'processing' | 'waiting' | string
}
export type AnnotationList = {
@@ -1776,7 +1781,7 @@ export type GetAppsAnnotationReplyByActionStatusByJobIdErrors = {
}
export type GetAppsAnnotationReplyByActionStatusByJobIdResponses = {
200: AnnotationJobStatusResponse
200: AnnotationJobStatusDetailResponse
}
export type GetAppsAnnotationReplyByActionStatusByJobIdResponse
@@ -1910,7 +1915,9 @@ export type PostChatMessagesErrors = {
}
export type PostChatMessagesResponses = {
200: GeneratedAppResponse
200: {
[key: string]: unknown
}
}
export type PostChatMessagesResponse = PostChatMessagesResponses[keyof PostChatMessagesResponses]
@@ -1955,7 +1962,9 @@ export type PostCompletionMessagesErrors = {
}
export type PostCompletionMessagesResponses = {
200: GeneratedAppResponse
200: {
[key: string]: unknown
}
}
export type PostCompletionMessagesResponse
@@ -6,7 +6,7 @@ import * as z from 'zod'
* Annotation
*/
export const zAnnotation = z.object({
content: z.string().nullish(),
answer: z.string().nullish(),
created_at: z.int().nullish(),
hit_count: z.int().nullish(),
id: z.string(),
@@ -21,13 +21,21 @@ export const zAnnotationCreatePayload = z.object({
question: z.string(),
})
/**
* AnnotationJobStatusDetailResponse
*/
export const zAnnotationJobStatusDetailResponse = z.object({
error_msg: z.string().optional().default(''),
job_id: z.string(),
job_status: z.union([z.enum(['completed', 'error', 'processing', 'waiting']), z.string()]),
})
/**
* AnnotationJobStatusResponse
*/
export const zAnnotationJobStatusResponse = z.object({
error_msg: z.string().nullish(),
job_id: z.string(),
job_status: z.string(),
job_status: z.union([z.enum(['completed', 'error', 'processing', 'waiting']), z.string()]),
})
/**
@@ -2356,7 +2364,8 @@ export const zGetAppsAnnotationReplyByActionStatusByJobIdPath = z.object({
/**
* Successfully retrieved task status.
*/
export const zGetAppsAnnotationReplyByActionStatusByJobIdResponse = zAnnotationJobStatusResponse
export const zGetAppsAnnotationReplyByActionStatusByJobIdResponse
= zAnnotationJobStatusDetailResponse
export const zGetAppsAnnotationsQuery = z.object({
keyword: z.string().optional().default(''),
@@ -2414,7 +2423,7 @@ export const zPostChatMessagesBody = zChatRequestPayloadWithUser
* - If `response_mode` is `blocking`, returns `application/json` with a `ChatCompletionResponse` object.
* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of Server-Sent Events.
*/
export const zPostChatMessagesResponse = zGeneratedAppResponse
export const zPostChatMessagesResponse = z.record(z.string(), z.unknown())
export const zPostChatMessagesByTaskIdStopBody = zRequiredServiceApiUserPayload
@@ -2435,7 +2444,7 @@ export const zPostCompletionMessagesBody = zCompletionRequestPayloadWithUser
* - If `response_mode` is `blocking`, returns `application/json` with a `CompletionResponse` object.
* - If `response_mode` is `streaming`, returns `text/event-stream` with a stream of `ChunkCompletionEvent` objects.
*/
export const zPostCompletionMessagesResponse = zGeneratedAppResponse
export const zPostCompletionMessagesResponse = z.record(z.string(), z.unknown())
export const zPostCompletionMessagesByTaskIdStopBody = zRequiredServiceApiUserPayload