mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
Cleaned warehouse related UI and made all 15 pages consisitent
This commit is contained in:
48
apps/edr-freight-web/backoffice/src/services/ai.service.ts
Normal file
48
apps/edr-freight-web/backoffice/src/services/ai.service.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { api as client } from "../auth/http";
|
||||
|
||||
export interface AiExtractedBooking {
|
||||
customerName: string | null;
|
||||
origin: string | null;
|
||||
destination: string | null;
|
||||
cargoType: string | null;
|
||||
containerType: "20FT" | "40FT" | "BULK" | "RO_RO" | null;
|
||||
quantity: number | null;
|
||||
direction: "IMPORT" | "EXPORT" | null;
|
||||
weightKg: number | null;
|
||||
pickupRequired: boolean | null;
|
||||
deliveryRequired: boolean | null;
|
||||
}
|
||||
|
||||
export interface AiValidationResult {
|
||||
valid: boolean;
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
export interface AiRecommendation {
|
||||
action: "CREATE_DRAFT_BOOKING" | "REQUEST_MISSING_INFORMATION";
|
||||
message: string;
|
||||
confidence: number;
|
||||
}
|
||||
|
||||
export interface AiBookingExtractResult {
|
||||
provider: "mock";
|
||||
extracted: AiExtractedBooking;
|
||||
validation: AiValidationResult;
|
||||
recommendation: AiRecommendation;
|
||||
}
|
||||
|
||||
interface AiBookingExtractResponse {
|
||||
success: boolean;
|
||||
data: AiBookingExtractResult;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export const extractBookingFromText = async (
|
||||
text: string,
|
||||
): Promise<AiBookingExtractResult> => {
|
||||
const response = await client.post<AiBookingExtractResponse>(
|
||||
"/ai/booking/extract",
|
||||
{ text },
|
||||
);
|
||||
return response.data.data;
|
||||
};
|
||||
Reference in New Issue
Block a user