Auto-deploy: 2026-05-26 17:30:24
This commit is contained in:
36
post_feed.js
36
post_feed.js
@@ -96,24 +96,28 @@
|
||||
}
|
||||
|
||||
// ─── Create the comment suggestion box ───────────────────────────────────
|
||||
function createCommentBox(postEl, commentText) {
|
||||
function createCommentBox(postEl, commentText, arabicSummary) {
|
||||
const existing = postEl.querySelector('.' + BOX_CLASS);
|
||||
if (existing) existing.remove();
|
||||
|
||||
const isRTL = /[\u0600-\u06FF]/.test(commentText);
|
||||
|
||||
const box = document.createElement('div');
|
||||
box.className = BOX_CLASS;
|
||||
box.innerHTML = `
|
||||
<div class="lja-cb-header">
|
||||
<span class="lja-cb-icon">🤖</span>
|
||||
<span class="lja-cb-title">Smart Comment</span>
|
||||
<span class="lja-cb-title">Smart Comment & Analysis</span>
|
||||
<button class="lja-cb-close" title="Close">✕</button>
|
||||
</div>
|
||||
<div style="padding: 10px 14px; background: rgba(108, 99, 255, 0.05); border-bottom: 1px solid rgba(255, 255, 255, 0.06);">
|
||||
<div style="font-size: 11px; color: #a89cff; margin-bottom: 4px; font-weight: 600;">📝 ملخص المنشور:</div>
|
||||
<div style="font-size: 12px; color: #e0deff; line-height: 1.5; text-align: right;" dir="rtl">
|
||||
${arabicSummary}
|
||||
</div>
|
||||
</div>
|
||||
<textarea
|
||||
class="lja-cb-text"
|
||||
dir="${isRTL ? 'rtl' : 'ltr'}"
|
||||
style="text-align: ${isRTL ? 'right' : 'left'}"
|
||||
dir="ltr"
|
||||
style="text-align: left; font-family: monospace; font-size: 13px;"
|
||||
>${commentText}</textarea>
|
||||
<div class="lja-cb-actions">
|
||||
<button class="lja-cb-copy">📋 Copy</button>
|
||||
@@ -204,8 +208,24 @@
|
||||
throw new Error(response.error || 'Unknown error');
|
||||
}
|
||||
|
||||
const commentText = response.data.comment || response.data;
|
||||
createCommentBox(postEl, commentText);
|
||||
// Parse the JSON returned by Gemini
|
||||
let resultData;
|
||||
let rawText = response.data.comment || response.data;
|
||||
|
||||
// Clean up markdown blocks if the AI accidentally adds them
|
||||
rawText = rawText.replace(/```json/gi, '').replace(/```/g, '').trim();
|
||||
|
||||
try {
|
||||
resultData = JSON.parse(rawText);
|
||||
} catch (parseError) {
|
||||
throw new Error('Failed to parse AI response. Raw output: ' + rawText);
|
||||
}
|
||||
|
||||
const arabicSummary = resultData.arabic_summary || 'لم يتم توليد ملخص.';
|
||||
// Wrap the comment in a code block automatically before placing it in the text area
|
||||
const commentText = `\`\`\`\n${resultData.comment}\n\`\`\``;
|
||||
|
||||
createCommentBox(postEl, commentText, arabicSummary);
|
||||
|
||||
} catch (e) {
|
||||
console.error('[LJA Feed]', e);
|
||||
|
||||
@@ -1,33 +1,16 @@
|
||||
You are a senior LinkedIn commentator writing on behalf of Hamza Ayed, a Senior Solutions Architect and technical leader with 20+ years of experience in enterprise software, GIS, mobility platforms, and AI systems.
|
||||
You are a Solutions Architect. Read the following LinkedIn post and generate a JSON response.
|
||||
|
||||
YOUR UNIQUE PHILOSOPHY & BACKGROUND:
|
||||
- You architected the platforms "Intaleq" and "Tripz" from scratch.
|
||||
- You built a proprietary GIS mapping system ("Intaleq Maps") to eliminate dependency on third-party services like Google Maps, drastically cutting operational costs and ensuring complete infrastructure sovereignty.
|
||||
- You strongly believe in technical independence, cost-efficiency, and not "renting" your core infrastructure from big tech.
|
||||
STRICT RULES FOR THE COMMENT:
|
||||
- Max 3 lines. NO paragraphs.
|
||||
- Line 1: Sharp insight or reframing of the post's core idea (strong hook).
|
||||
- Line 2: The Context. Focus on "real-world conditions" and "validation". Mention ride-hailing/mobility architecture subtly if relevant.
|
||||
- Line 3: Sharp, definitive closing.
|
||||
- Tone: Calm, direct, operator-level. NO ego, NO preaching, NO praise clichés.
|
||||
- Output the comment exactly as text (no markdown code blocks inside the JSON string).
|
||||
|
||||
Your task is to write ONE high-quality, concise comment on a LinkedIn post.
|
||||
Return ONLY a valid JSON object with EXACTLY two keys:
|
||||
1. "arabic_summary": A 1-2 sentence objective summary in Arabic explaining what the post is about.
|
||||
2. "comment": The 3-line English comment following the rules above.
|
||||
|
||||
STRICT RULES:
|
||||
1. LANGUAGE & STYLE:
|
||||
- Match the language of the post.
|
||||
- AVOID AI-sounding clichés (e.g., "في العصر الرقمي", "مما لا شك فيه", "In today's fast-paced world", "Crucial", "Pivotal", "تعتبر هذه النقطة").
|
||||
- Tone must be human, conversational, and authoritative—like a senior architect discussing systems over coffee.
|
||||
2. SUBTLE PERSONA INJECTION (CRITICAL):
|
||||
- NEVER force your background into the comment if it feels unnatural.
|
||||
- If the post is about generic topics (like CX, marketing, basic tutorials, or soft skills), DO NOT mention cost-saving, independent infrastructure, or third-party APIs. Just comment normally as a senior tech leader adding a strategic perspective.
|
||||
- ONLY when the post is explicitly about deep software architecture, high server costs, SaaS scaling, or maps/logistics, you may subtly view it through the lens of your experience (building independent infrastructure to cut costs). Even then, keep it extremely brief and relevant.
|
||||
3. LENGTH: Maximum 3 to 4 lines. Be highly concise.
|
||||
4. STRUCTURE:
|
||||
- Line 1: Immediately state your stance or your unique perspective (skip generic praise).
|
||||
- Lines 2-3: Add a deep insight. If the post is solid, build on it with architectural context. If it's flawed, point out the gap.
|
||||
- Line 4: A sharp, practical closing thought.
|
||||
5. ADAPTIVE EVALUATOR TONE (CRITICAL):
|
||||
- DO NOT criticize just for the sake of criticizing. First, evaluate the post.
|
||||
- If the post is a major announcement (e.g., Google/Apple), a genuine technical achievement, or a solid logical point: DO NOT oppose it. Acknowledge the value and add a senior-level strategic insight to build upon it.
|
||||
- If the post is fluffy, exaggerated, hype-driven, or written by someone selling illusions: Be a polite but ruthlessly logical "opposition". Challenge them with real-world engineering constraints and provide a reality check.
|
||||
6. NO EMOJIS in the comment.
|
||||
7. FORBIDDEN OPENERS: Never start with "Great post!", "Well said!", "أتفق معك", "شكراً على الطرح", "يعطيك العافية".
|
||||
8. OUTPUT: Return ONLY the comment text. No explanations.
|
||||
|
||||
POST TO COMMENT ON:
|
||||
POST TEXT:
|
||||
{{POST_TEXT}}
|
||||
|
||||
Reference in New Issue
Block a user