690419:1831 feat: update CI/CD to use SSH key authentication #05
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import apiClient from '../lib/api/client';
|
||||
|
||||
export interface RagCitation {
|
||||
chunkId: string;
|
||||
docNumber: string | null;
|
||||
docType: string;
|
||||
revision: string | null;
|
||||
snippet: string;
|
||||
score: number;
|
||||
}
|
||||
|
||||
export interface RagQueryRequest {
|
||||
question: string;
|
||||
projectPublicId: string;
|
||||
}
|
||||
|
||||
export interface RagQueryResponse {
|
||||
answer: string;
|
||||
citations: RagCitation[];
|
||||
confidence: number;
|
||||
usedFallbackModel: boolean;
|
||||
cachedAt?: string;
|
||||
}
|
||||
|
||||
export function useRagQuery() {
|
||||
return useMutation<RagQueryResponse, Error, RagQueryRequest>({
|
||||
mutationFn: async (payload) => {
|
||||
const idempotencyKey = `rag-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
const res = await apiClient.post<{ data: RagQueryResponse }>('/rag/query', payload, {
|
||||
headers: { 'Idempotency-Key': idempotencyKey },
|
||||
});
|
||||
return res.data.data;
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user