| |
| |
| |
| |
| |
| |
| import { apiFetch } from '@szl-holdings/shared-ui/api-fetch'; |
| import type { AgenticRagRequest, AgenticRagResponse } from '@szl-holdings/alloy-client'; |
|
|
| export interface VesselIntelInput { |
| query: string; |
| vesselId?: string; |
| voyageId?: string; |
| fleetId?: string; |
| sessionId?: string; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export async function runVesselsAgenticRag( |
| input: VesselIntelInput, |
| ): Promise<AgenticRagResponse> { |
| const contextParts = [input.query]; |
| if (input.vesselId) contextParts.push(`Vessel: ${input.vesselId}`); |
| if (input.voyageId) contextParts.push(`Voyage: ${input.voyageId}`); |
| if (input.fleetId) contextParts.push(`Fleet: ${input.fleetId}`); |
|
|
| const request: AgenticRagRequest = { |
| query: contextParts.join('\n'), |
| context: { |
| domain: 'vessels', |
| sessionId: input.sessionId, |
| metadata: { |
| vesselId: input.vesselId, |
| voyageId: input.voyageId, |
| fleetId: input.fleetId, |
| }, |
| }, |
| policy: { |
| plannerMode: 'react', |
| maxSpecialists: 3, |
| topK: 12, |
| enabledMcpClasses: ['local-data', 'search-engine', 'cloud-engine'], |
| }, |
| }; |
|
|
| return apiFetch<AgenticRagResponse>('/alloy/agentic-rag/run', { |
| method: 'POST', |
| body: JSON.stringify(request), |
| }); |
| } |
|
|
| export async function getVesselsAgenticRagTrace(runId: string): Promise<unknown> { |
| return apiFetch<unknown>(`/alloy/agentic-rag/runs/${runId}/trace`); |
| } |
|
|