remove Ai Service

This commit is contained in:
Andreas Knuth 2025-03-05 17:19:50 +01:00
parent b55447cd3f
commit dded8b8ca9
2 changed files with 30 additions and 27 deletions

View File

@ -101,23 +101,10 @@ export class AiService {
const prompt = `The Search Query of the User is: "${query}"`; const prompt = `The Search Query of the User is: "${query}"`;
let response = null; let response = null;
try { try {
// response = await this.openai.chat.completions.create({ response = await this.openai.chat.completions.create({
// model: 'gpt-4o-mini', model: 'gpt-4o-mini',
// //model: 'gpt-3.5-turbo', //model: 'gpt-3.5-turbo',
// max_tokens: 300, max_tokens: 300,
// messages: [
// {
// role: 'system',
// content: `Please create unformatted JSON Object from a user input.
// The type is: ${JSON.stringify(businessListingCriteriaStructure)}.,
// If location details available please fill city, county and state as State Code`,
// },
// ],
// temperature: 0.5,
// response_format: { type: 'json_object' },
// });
response = await this.groq.chat.completions.create({
messages: [ messages: [
{ {
role: 'system', role: 'system',
@ -130,17 +117,33 @@ export class AiService {
{ {
role: 'user', role: 'user',
content: prompt, content: prompt,
}, },
], ],
model: 'llama-3.3-70b-versatile', temperature: 0.5,
//model: 'llama-3.1-8b-instant',
// model: 'mixtral-8x7b-32768',
//model: 'gemma2-9b-it',
temperature: 0.2,
max_tokens: 300,
response_format: { type: 'json_object' }, response_format: { type: 'json_object' },
}); });
// response = await this.groq.chat.completions.create({
// messages: [
// {
// role: 'system',
// content: `Please create unformatted JSON Object from a user input.
// The criteriaType must be only either 'businessListings' or 'commercialPropertyListings' or 'brokerListings' !!!!
// The format of the object (depending on your choice of criteriaType) must be either ${BusinessListingCriteriaStructure}, ${CommercialPropertyListingCriteriaStructure} or ${UserListingCriteriaStructure} !!!!
// If location details available please fill city and state as State Code and only county if explicitly mentioned.
// If you decide for searchType==='exact', please do not set the attribute radius`,
// },
// {
// role: 'user',
// content: prompt,
// },
// ],
// model: 'llama-3.3-70b-versatile',
// temperature: 0.2,
// max_tokens: 300,
// response_format: { type: 'json_object' },
// });
const generatedCriteria = JSON.parse(response.choices[0]?.message?.content); const generatedCriteria = JSON.parse(response.choices[0]?.message?.content);
return generatedCriteria; return generatedCriteria;

View File

@ -40,7 +40,7 @@
<div class="w-11/12 md:w-2/3 lg:w-1/2"> <div class="w-11/12 md:w-2/3 lg:w-1/2">
<h1 class="text-3xl md:text-4xl lg:text-5xl font-bold text-blue-900 mb-4 text-center">Find businesses for sale.</h1> <h1 class="text-3xl md:text-4xl lg:text-5xl font-bold text-blue-900 mb-4 text-center">Find businesses for sale.</h1>
<p class="text-base md:text-lg lg:text-xl text-blue-600 mb-8 text-center">Unlocking Exclusive Opportunities - Empowering Entrepreneurial Dreams</p> <p class="text-base md:text-lg lg:text-xl text-blue-600 mb-8 text-center">Unlocking Exclusive Opportunities - Empowering Entrepreneurial Dreams</p>
<div class="bg-white bg-opacity-80 p-2 rounded-lg shadow-lg w-full" [ngClass]="{ 'pt-6': aiSearch }"> <div class="bg-white bg-opacity-80 pb-6 pt-2 px-2 rounded-lg shadow-lg w-full" [ngClass]="{ 'pt-6': aiSearch }">
@if(!aiSearch){ @if(!aiSearch){
<div class="text-sm lg:text-base mb-1 text-center text-gray-500 border-gray-200 dark:text-gray-400 dark:border-gray-700 flex justify-center"> <div class="text-sm lg:text-base mb-1 text-center text-gray-500 border-gray-200 dark:text-gray-400 dark:border-gray-700 flex justify-center">
<ul class="flex flex-wrap -mb-px"> <ul class="flex flex-wrap -mb-px">
@ -193,7 +193,7 @@
</div> </div>
</div> </div>
} }
<div class="mt-4 flex items-center justify-center text-gray-700"> <!-- <div class="mt-4 flex items-center justify-center text-gray-700">
<span class="mr-2">AI-Search</span> <span class="mr-2">AI-Search</span>
<span [attr.data-tooltip-target]="tooltipTargetBeta" class="bg-sky-300 text-teal-800 text-xs font-semibold px-2 py-1 rounded">BETA</span> <span [attr.data-tooltip-target]="tooltipTargetBeta" class="bg-sky-300 text-teal-800 text-xs font-semibold px-2 py-1 rounded">BETA</span>
<app-tooltip [id]="tooltipTargetBeta" text="AI will convert your input into filter criteria. Please check them in the filter menu after search"></app-tooltip> <app-tooltip [id]="tooltipTargetBeta" text="AI will convert your input into filter criteria. Please check them in the filter menu after search"></app-tooltip>
@ -202,7 +202,7 @@
<input (click)="toggleAiSearch()" type="checkbox" name="toggle" id="toggle" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 border-gray-300 appearance-none cursor-pointer" /> <input (click)="toggleAiSearch()" type="checkbox" name="toggle" id="toggle" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 border-gray-300 appearance-none cursor-pointer" />
<label for="toggle" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label> <label for="toggle" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
</div> </div>
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>