@@ -57,10 +57,9 @@ export async function processMemberBotAnalysisWithLLM(
5757 OUTPUT FORMAT:
5858 - Include "signals" object only when isBot: true
5959 - Omit fields from signals that provide no automation evidence
60- IMPORTANT:
61- - Your response must be raw JSON only.
62- - No markdown, no code fences, no backticks, no explanation.
63- - Start with { and end with }.
60+ - You must return ONLY valid JSON.
61+ - Do NOT add code fences, explanations, or extra text.
62+ - The JSON must begin with '{' and end with '}'.
6463 JSON SCHEMA:
6564 {
6665 "isBot": boolean,
@@ -73,8 +72,12 @@ export async function processMemberBotAnalysisWithLLM(
7372
7473 const llm = await getLLMResult ( LlmQueryType . MEMBER_BOT_VALIDATION , PROMPT , memberId )
7574
76- const answer = llm . answer . replace ( / ^ ` ` ` (?: j s o n ) ? \s * | \s * ` ` ` $ / g, '' ) . trim ( )
77- const { isBot, signals } = JSON . parse ( answer ) as MemberBotSuggestionResult
75+ const start = llm . answer . indexOf ( '{' )
76+ const end = llm . answer . lastIndexOf ( '}' )
77+
78+ const { isBot, signals } = JSON . parse (
79+ llm . answer . substring ( start , end + 1 ) ,
80+ ) as MemberBotSuggestionResult
7881
7982 if ( ! isBot ) {
8083 await createMemberNoBot ( memberId )
0 commit comments