mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 03:10:08 +08:00
feat(agent): add ListAgentsResponse type and update service
Add ListAgentsResponse schema and type to handle agent listing responses Update AgentService to use the new type for listAgents method
This commit is contained in:
parent
0f777e357d
commit
f9fb0f9125
@ -6,6 +6,7 @@ import type {
|
||||
CreateAgentRequest,
|
||||
CreateAgentResponse,
|
||||
GetAgentResponse,
|
||||
ListAgentsResponse,
|
||||
ListOptions,
|
||||
UpdateAgentRequest
|
||||
} from '@types'
|
||||
@ -85,7 +86,7 @@ export class AgentService extends BaseService {
|
||||
return agent
|
||||
}
|
||||
|
||||
async listAgents(options: ListOptions = {}): Promise<{ agents: GetAgentResponse[]; total: number }> {
|
||||
async listAgents(options: ListOptions = {}): Promise<ListAgentsResponse> {
|
||||
this.ensureInitialized() // Build query with pagination
|
||||
|
||||
const totalResult = await this.database.select({ count: count() }).from(agentsTable)
|
||||
|
||||
@ -131,6 +131,13 @@ export const GetAgentResponseSchema = AgentEntitySchema.extend({
|
||||
|
||||
export type GetAgentResponse = z.infer<typeof GetAgentResponseSchema>
|
||||
|
||||
export const ListAgentsResponseSchema = z.object({
|
||||
agents: z.array(GetAgentResponseSchema),
|
||||
total: z.number()
|
||||
})
|
||||
|
||||
export type ListAgentsResponse = z.infer<typeof ListAgentsResponseSchema>
|
||||
|
||||
export type CreateSessionRequest = AgentBase
|
||||
|
||||
export interface UpdateSessionRequest extends Partial<AgentBase> {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user