|
|
@@ -148,20 +148,11 @@ ${locationContext}
|
|
|
Choose 2-3 specific aspects to focus on. Do not cover everything. Keep it grounded, practical, and observational.
|
|
|
|
|
|
You may choose from (but are not limited to) the following aspects:
|
|
|
-- Harvest conditions (e.g., slippery laterite paths, loose fronds, uneven ground)
|
|
|
-- Crop quality or ripeness (e.g., mixed ripeness, loose fruit levels, overripe bunches)
|
|
|
-- Weather or micro-climate effects (e.g., morning mist, short showers, heat buildup)
|
|
|
-- Equipment or tools (e.g., tractor performance, bin condition, cutter sharpness)
|
|
|
-- Manpower or team dynamics (e.g., fast harvesters, fatigue setting in, new worker adapting)
|
|
|
-- Field layout or block characteristics (e.g., long walking distance, soft patches, slope)
|
|
|
-- Collection point or evacuation flow (e.g., bin queue forming, delayed pickup, smooth turnaround)
|
|
|
-- Timing or pacing (e.g., late start, catching up by midday, slowing toward afternoon)
|
|
|
-- Small operational adjustments (e.g., rerouting harvest path, spacing out bin movement)
|
|
|
-- Minor issues or near-misses (e.g., short hold-up, brief stoppage, quick fix on site)
|
|
|
-- Sensory details (e.g., smell of fresh fruit, sound of rustling leaves, sight of sun glare)
|
|
|
-- Human factors (e.g., harvester morale, supervisor vigilance, teamwork spirit)
|
|
|
-- Environmental observations (e.g., presence of wildlife, condition of surrounding vegetation)
|
|
|
-- Any other specific, tangible detail relevant to FFB production
|
|
|
+- Harvest conditions (e.g., favorable weather, good ground conditions)
|
|
|
+- Crop quality (e.g., ripe fruit, good bunch weight)
|
|
|
+- Team dynamics (e.g., good attendance, high morale, efficient teamwork)
|
|
|
+- Operational flow (e.g., smooth evacuation, timely transport)
|
|
|
+- General observations (e.g., completed scheduled harvesting, routine maintenance done)
|
|
|
|
|
|
Do not mention any of the above aspects explicitly in the remark. Instead, weave them naturally into the observation.
|
|
|
|
|
|
@@ -170,6 +161,7 @@ Guidelines:
|
|
|
- Include at least one concrete, physical detail.
|
|
|
- Avoid generic phrases like “overall performance was good” or “operations ran smoothly”.
|
|
|
- Do not explain or summarize the entire day.
|
|
|
+- FOCUS ON GENERAL WORK DONE AND POSITIVE/NEUTRAL OBSERVATIONS. DO NOT MENTION ISSUES OR PROBLEMS (Use generate-issues for that).
|
|
|
|
|
|
${contextInfo ? `Context Reference (use lightly, do not restate verbatim): ${contextInfo}` : ''}
|
|
|
|
|
|
@@ -181,4 +173,67 @@ Remark:`;
|
|
|
return remark.replace(/^Remark:\s*/i, '').replace(/^"|"$/g, '').trim();
|
|
|
}
|
|
|
|
|
|
+ /** Generate LLM issues for provided data */
|
|
|
+ async generateIssues(data?: any) {
|
|
|
+ let contextInfo = '';
|
|
|
+ let locationContext = '';
|
|
|
+
|
|
|
+ if (data && Object.keys(data).length > 0) {
|
|
|
+ const { siteId, phaseId, blockId } = data;
|
|
|
+
|
|
|
+ // Fetch additional context if IDs are provided
|
|
|
+ const [site, phase, block] = await Promise.all([
|
|
|
+ siteId ? this.siteService.findById(siteId) : null,
|
|
|
+ phaseId ? this.phaseService.findById(phaseId) : null,
|
|
|
+ blockId ? this.blockService.findById(blockId) : null,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if (site) {
|
|
|
+ locationContext += `Site "${site.name}": ${site.description || 'No description available.'} Location: ${site.address}. `;
|
|
|
+ }
|
|
|
+ if (phase) {
|
|
|
+ locationContext += `Phase "${phase.name}": ${phase.description || 'No description available.'} Status: ${phase.status}. `;
|
|
|
+ }
|
|
|
+ if (block) {
|
|
|
+ locationContext += `Block "${block.name}": ${block.description || 'No description available.'} Size: ${block.size} ${block.sizeUom || 'units'}, Number of trees: ${block.numOfTrees}. `;
|
|
|
+ }
|
|
|
+
|
|
|
+ contextInfo = `Production Data: ${JSON.stringify(data)}. `;
|
|
|
+ if (locationContext) {
|
|
|
+ contextInfo += `Location Context: ${locationContext}`;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ contextInfo = 'Data: Random FFB production context.';
|
|
|
+ }
|
|
|
+
|
|
|
+ const prompt = `Write a specific issue report (1-2 sentences) from an oil palm plantation regarding FFB production.
|
|
|
+
|
|
|
+${locationContext ? `IMPORTANT: The issue should be RELEVANT to the following location context if provided:
|
|
|
+${locationContext}
|
|
|
+` : ''}
|
|
|
+
|
|
|
+Choose 1 specific problem to focus on. Keep it realistic and problematic.
|
|
|
+
|
|
|
+You may choose from (but are not limited to):
|
|
|
+- Weather issues (e.g., heavy rain halting work, flooded paths)
|
|
|
+- Equipment breakdown (e.g., tractor stuck, engine failure, broken ramp)
|
|
|
+- Manpower shortage (e.g., absentees, medical leave, slow progress)
|
|
|
+- Crop issues (e.g., high rate of uncollected loose fruit, unripe bunches harvested)
|
|
|
+- Access issues (e.g., collapsed bridge, road washed out, blocked drain)
|
|
|
+- Pests/Wildlife (e.g., elephant intrusion damage, rat damage)
|
|
|
+
|
|
|
+Guidelines:
|
|
|
+- Direct and to the point.
|
|
|
+- Clearly state the problem.
|
|
|
+- FOCUS ON ISSUES ONLY.
|
|
|
+
|
|
|
+${contextInfo ? `Context Reference: ${contextInfo}` : ''}
|
|
|
+
|
|
|
+Issue Report:`;
|
|
|
+
|
|
|
+ const remark = await this.ffbLangChainService.chatStateless(prompt, 'gemini');
|
|
|
+
|
|
|
+ // Clean up remark
|
|
|
+ return remark.replace(/^Issue Report:\s*/i, '').replace(/^"|"$/g, '').trim();
|
|
|
+ }
|
|
|
}
|