feat(hooks): add useAgentClient hook for agent API client initialization

This commit is contained in:
icarus
2025-09-18 18:02:05 +08:00
parent cb0833a915
commit 0b1b9a913f

View File

@@ -0,0 +1,15 @@
import { AgentApiClient } from '@renderer/api/agent'
import { useSettings } from '../useSettings'
export const useAgentClient = () => {
const { apiServer } = useSettings()
const { host, port, apiKey } = apiServer
const client = new AgentApiClient({
baseURL: `${host}:${port}`,
headers: {
Authorization: `Bearer ${apiKey}`
}
})
return client
}