diff --git a/package.json b/package.json index 73458c5..6fd93af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pezkuwi-telegram-miniapp", - "version": "1.0.242", + "version": "1.0.243", "type": "module", "description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards", "author": "Pezkuwichain Team", diff --git a/src/version.json b/src/version.json index e62d78b..57a396a 100644 --- a/src/version.json +++ b/src/version.json @@ -1,5 +1,5 @@ { - "version": "1.0.242", - "buildTime": "2026-07-19T16:50:27.640Z", - "buildNumber": 1784479827641 + "version": "1.0.243", + "buildTime": "2026-07-19T16:57:33.951Z", + "buildNumber": 1784480253951 } diff --git a/supabase/functions/ask/index.ts b/supabase/functions/ask/index.ts index 060a6e2..da68454 100644 --- a/supabase/functions/ask/index.ts +++ b/supabase/functions/ask/index.ts @@ -10,6 +10,8 @@ const SYSTEM = `You are the official PezkuwiChain AI Assistant on the news site RULES: - Answer in the SAME LANGUAGE the user writes in. If they write in Kurdish (Kurmancî), answer in Kurdish. If Turkish, answer in Turkish. If English, answer in English. If Arabic, answer in Arabic. If Persian, answer in Persian. +- Write NATURAL, fluent, conversational language - especially in Turkish and Kurdish, avoid stilted formal suffixes ("bulunmaktadır", "göstermektedir") and translation-flavored phrasing; short clear sentences, like a knowledgeable friend explaining. +- STRICTLY plain text: never use markdown (**, ##, bullet asterisks). Simple dashes for lists are fine. - Be concise — website answers should be short, clear and helpful. - Use plain text, no markdown headers. You can use bold with *text* sparingly. - If you don't know something, say so honestly. @@ -258,7 +260,7 @@ serve(async (req) => { method: 'POST', headers: { Authorization: 'Bearer ' + GROQ_API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ - model: 'llama-3.3-70b-versatile', + model: 'openai/gpt-oss-120b', temperature: 0.3, max_tokens: 900, messages: [{ role: 'system', content: SYSTEM }, ...messages], @@ -300,6 +302,8 @@ serve(async (req) => { if (!answer) return J({ answer: 'Sorry, I could not answer right now. Please try again.' }, 200); + // Models occasionally emit markdown despite the plain-text rule. + answer = answer.replace(/\*\*/g, '').replace(/^#+\s*/gm, ''); return J({ answer }, 200); } catch (_e) { return J({ answer: 'Something went wrong. Please try again.' }, 200); diff --git a/supabase/functions/telegram-bot/index.ts b/supabase/functions/telegram-bot/index.ts index db8c39e..4161fba 100644 --- a/supabase/functions/telegram-bot/index.ts +++ b/supabase/functions/telegram-bot/index.ts @@ -90,6 +90,8 @@ const CLAUDE_SYSTEM_PROMPT = `You are the official PezkuwiChain AI Assistant on RULES: - Answer in the SAME LANGUAGE the user writes in. If they write in Kurdish (Kurmancî), answer in Kurdish. If Turkish, answer in Turkish. If English, answer in English. If Arabic, answer in Arabic. If Persian, answer in Persian. +- Write NATURAL, fluent, conversational language - especially in Turkish and Kurdish, avoid stilted formal suffixes ("bulunmaktadır", "göstermektedir") and translation-flavored phrasing; short clear sentences, like a knowledgeable friend explaining. +- STRICTLY plain text: never use markdown (**, ##, bullet asterisks). Simple dashes for lists are fine. - Be concise — Telegram messages should be short and readable. - Use plain text, no markdown headers. You can use bold with *text* sparingly. - If you don't know something, say so honestly. @@ -293,7 +295,7 @@ async function handleAIChat(token: string, chatId: number, userMessage: string, method: 'POST', headers: { Authorization: 'Bearer ' + GROQ_API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ - model: 'llama-3.3-70b-versatile', + model: 'openai/gpt-oss-120b', temperature: 0.3, max_tokens: 900, messages: [ @@ -336,6 +338,9 @@ async function handleAIChat(token: string, chatId: number, userMessage: string, } } + // Models occasionally emit markdown despite the plain-text rule; Telegram renders it raw. + if (aiReply) aiReply = aiReply.replace(/\*\*/g, '').replace(/^#+\s*/gm, ''); + if (!aiReply) { await sendTelegramRequest(token, 'sendMessage', { chat_id: chatId,