send analyses to ai
This commit is contained in:
@@ -1,24 +1,40 @@
|
||||
'use client';
|
||||
'use server';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { AccountWithParams } from '@/packages/features/accounts/src/types/accounts';
|
||||
|
||||
import { analysisResponses } from '../(dashboard)/analysis-results/test/test-responses';
|
||||
import { loadAnalyses } from '../_lib/server/load-analyses';
|
||||
import { loadRecommendations } from '../_lib/server/load-recommendations';
|
||||
import OrderAnalysesCards, { OrderAnalysisCard } from './order-analyses-cards';
|
||||
|
||||
export default function Recommendations({
|
||||
recommended,
|
||||
countryCode,
|
||||
export default async function Recommendations({
|
||||
account,
|
||||
}: {
|
||||
recommended: OrderAnalysisCard[];
|
||||
countryCode: string;
|
||||
account: AccountWithParams;
|
||||
}) {
|
||||
if (recommended.length < 1) {
|
||||
const { analyses, countryCode } = await loadAnalyses();
|
||||
const [isLoadingTimeSlots, setIsLoadingTimeSlots] = useState(false);
|
||||
const analysisResults = analysisResponses;
|
||||
console.log('selectedDate', isLoadingTimeSlots);
|
||||
const analysisRecommendations = await loadRecommendations(
|
||||
analysisResults,
|
||||
analyses,
|
||||
account,
|
||||
);
|
||||
const orderAnalyses = analyses.filter((analysis) =>
|
||||
analysisRecommendations.includes(analysis.title),
|
||||
);
|
||||
console.log('analysisRecommendations', analysisRecommendations);
|
||||
if (orderAnalyses.length < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h4>Medreport soovitab teile</h4>
|
||||
<OrderAnalysesCards analyses={recommended} countryCode={countryCode} />
|
||||
<OrderAnalysesCards analyses={orderAnalyses} countryCode={countryCode} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user