      }
    } catch (e) {
      console.error("Error processing chunk:", e);
    }
  }

  function handleCompletionChunk(chunk) {
    // addNode(getChunkContent(chunk), "relevant_concepts");
  }

  function handleBoostEvent(chunk) {
    const { event } = chunk;
    const handler = handlers[event];

    if (handler) {
      console.log("Handling boost event:", event);
      handler(chunk);
    } else {
      console.warn(`No handler for event: ${event}`);
    }
  }

  function getChunkContent(chunk) {
    re