From 5ccb1d39840d28007431467ca9b4fb2ee2f5e4d4 Mon Sep 17 00:00:00 2001 From: Sven Olderaan Date: Fri, 14 Mar 2025 20:57:19 +0100 Subject: [PATCH] Fix function registration for AI visibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add isPublic flag to make function visible to AI - Add explicit context registration for better compatibility - Add debug logs to help track registration status - Improve documentation with SillyTavern-specific setup instructions - Add warning styles for important setup notes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- example.html | 9 +++++++++ index.js | 15 +++++++++++++++ style.css | 11 +++++++++++ 3 files changed, 35 insertions(+) diff --git a/example.html b/example.html index 783a985..02133da 100644 --- a/example.html +++ b/example.html @@ -37,6 +37,15 @@
  • text: The text to display in the bubble
  • style: (Optional) Bubble style
  • +
    +

    Important: Make sure function calling is enabled in SillyTavern's AI settings and the model you're using supports function calling.

    +

    In SillyTavern's AI settings, verify that:

    +
      +
    1. Function calling is enabled
    2. +
    3. "Include functions in context" is checked
    4. +
    5. The function appears in the function list
    6. +
    +

    diff --git a/index.js b/index.js index 79b7ef0..f3f8009 100644 --- a/index.js +++ b/index.js @@ -119,11 +119,26 @@ jQuery(async () => { required: false, } ], + isPublic: true, // Make sure function is exposed to the AI run: async function(text, style) { return generateChatBubbleImage(text, style); } }); + // Log to console to verify registration + console.log(`[${extensionName}] Function registered: generateChatBubbleImage`); + + // Add to context if needed - this might be required to expose to AI + try { + const context = getContext(); + if (context && typeof context.addExtensionFunction === 'function') { + context.addExtensionFunction('generateChatBubbleImage', generateChatBubbleImage); + console.log(`[${extensionName}] Function added to context: generateChatBubbleImage`); + } + } catch (error) { + console.error(`[${extensionName}] Error adding function to context:`, error); + } + // Load settings loadSettings(); }); diff --git a/style.css b/style.css index 518fb7b..8b5dce3 100644 --- a/style.css +++ b/style.css @@ -35,6 +35,17 @@ font-family: monospace; } +.sillybubble_important { + margin-top: 10px; + padding: 10px; + border-left: 3px solid #e74c3c; + background-color: rgba(231, 76, 60, 0.1); +} + +.sillybubble_important strong { + color: #e74c3c; +} + .sillybubble-test pre { background-color: rgba(0, 0, 0, 0.1); padding: 10px;