changes shopping
This commit is contained in:
1 parent
62ab5b2608
commit
f4bc93bc8a
17 files changed
+2290
-1025
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import { secureLogger } from "@/lib/secure-logger";
|
||||
import { buildGeminiParts, buildItemPrompt, InlineImageData } from "@/lib/ai/item-prompt";
|
||||
|
||||
interface GenerateItemStructureInput {
|
||||
name: string;
|
||||
description: string;
|
||||
scope: "global" | "server";
|
||||
server?: string | null;
|
||||
categories: string[];
|
||||
servers: string[];
|
||||
images?: InlineImageData[];
|
||||
}
|
||||
|
||||
interface GeminiResponse {
|
||||
@@ -51,7 +55,21 @@ export async function generateItemStructure(
|
||||
"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=" +
|
||||
apiKey;
|
||||
|
||||
const prompt = buildPrompt(input);
|
||||
const prompt = await buildItemPrompt(
|
||||
{
|
||||
name: input.name,
|
||||
description: input.description,
|
||||
scope: input.scope,
|
||||
server: input.server,
|
||||
categories: input.categories,
|
||||
servers: input.servers,
|
||||
},
|
||||
input.images && input.images.length > 0
|
||||
? "Duas imagens de contexto foram fornecidas como partes inline (após o prompt). Utilize-as para compreender atributos visuais."
|
||||
: undefined,
|
||||
);
|
||||
|
||||
const parts = await buildGeminiParts(prompt, input.images);
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
@@ -63,7 +81,7 @@ export async function generateItemStructure(
|
||||
contents: [
|
||||
{
|
||||
role: "user",
|
||||
parts: [{ text: prompt }],
|
||||
parts,
|
||||
},
|
||||
],
|
||||
generationConfig: {
|
||||
|
||||
Reference in new issue
Block a user