|
|
@@ -19,8 +19,8 @@ export const SCHEMAS = {
|
|
|
startDate: z.string().nullable(),
|
|
|
endDate: z.string().nullable(),
|
|
|
}),
|
|
|
- aggregationType: z.enum(["sum", "avg", "count"]),
|
|
|
- fieldToAggregate: z.enum(["quantity", "weight"])
|
|
|
+ aggregationType: z.enum(["sum", "avg", "count", "list", "count_distinct"]),
|
|
|
+ fieldToAggregate: z.enum(["quantity", "weight", "site", "block", "phase"])
|
|
|
})
|
|
|
};
|
|
|
|
|
|
@@ -53,23 +53,29 @@ You are an Application Router for a production database.
|
|
|
Analyze the user input and route to: [Semantic, Aggregate].
|
|
|
|
|
|
INTENTS:
|
|
|
-- Aggregate: Asking for numbers, totals, averages, counts (e.g., "How much...", "Total weight").
|
|
|
+- Aggregate: Asking for numbers, totals, averages, counts (e.g., "How much...", "Total weight", "How many sites", "List all blocks").
|
|
|
- Semantic: Asking for specific records, qualitative descriptions, issues, "what happened", "find info about" (e.g., "Show me records for Site A").
|
|
|
|
|
|
User Input: "${lastMessage}"
|
|
|
`,
|
|
|
- META: (lastMessage: string, context: string) => `
|
|
|
+ META: (lastMessage: string, context: string, providerName?: string, dataSchema?: string) => `
|
|
|
You are the FFB Production Agent.
|
|
|
+Runtime: ${providerName ?? 'Unknown Provider'}
|
|
|
User Input: "${lastMessage}"
|
|
|
|
|
|
Your Capabilities:
|
|
|
1. Querying specific production logs.
|
|
|
-2. Aggregating data (totals, averages).
|
|
|
-3. Summarizing production events.
|
|
|
+2. Aggregating data (totals, averages, counts).
|
|
|
+3. Listing distinct entities (sites, blocks).
|
|
|
+4. Explaining the data structure.
|
|
|
+
|
|
|
+Data Schema Context:
|
|
|
+${dataSchema ?? 'Not available'}
|
|
|
|
|
|
INSTRUCTIONS:
|
|
|
-- If the user asks about capabilities, list them.
|
|
|
-- If the user asks "what did I ask?", summarize the RELEVANT previous user messages from the context.
|
|
|
+- If asked "who are you" or about the provider, mention you are powered by ${providerName ?? 'an AI model'}.
|
|
|
+- If asked about data shape/fields, refer to the Data Schema Context.
|
|
|
+- If asked "what did I ask?", summarize the RELEVANT previous user messages.
|
|
|
- Do NOT help with off-topic or general questions.
|
|
|
- Be professional and concise.
|
|
|
|