nodebb-plugin-search-agent 0.0.91 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,6 +188,8 @@ async function reRankWithAI(queryText, candidates, topicMap, apiKey, model, maxR
188
188
  { role: 'user', content: userMessage },
189
189
  ]);
190
190
 
191
+ console.log('AI scoring response:', response.choices[0].message.content);
192
+
191
193
  const content = (response.choices[0].message.content || '').trim();
192
194
 
193
195
  // Extract the JSON object from the response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-search-agent",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "description": "NodeBB plugin that adds a floating chat assistant to help users find relevant forum topics using TF-IDF text similarity",
5
5
  "main": "library.js",
6
6
  "author": "Racheli Bayfus",
@@ -11,8 +11,10 @@ const OPENAI_EMBEDDINGS_PATH = '/v1/embeddings';
11
11
  const EMBEDDING_MODEL = 'text-embedding-3-small';
12
12
  const MAX_RETRIES = 3;
13
13
  const RETRY_DELAY_MS = 500;
14
- // text-embedding-3-small supports 8 192 tokens; ~4 chars/token → cap at 30 000 chars (~7 500 tokens)
15
- const MAX_CHARS = 30000;
14
+ // text-embedding-3-small supports 8 192 tokens.
15
+ // Hebrew/non-ASCII text tokenizes at ~1.5–2 chars/token (UTF-8 multibyte).
16
+ // Using 1.5 chars/token worst-case: 8000 tokens × 1.5 = 12 000 chars — gives a safe margin.
17
+ const MAX_CHARS = 12000;
16
18
 
17
19
  function truncate(text) {
18
20
  return text.length > MAX_CHARS ? text.slice(0, MAX_CHARS) : text;