import { useMemo } from "react";
import { mapOpenAIMessagesToMessageBubbleData } from "./mapOpenAIMessages";
/**
 * 将 OpenAI Chat Completions 风格的 messages 转为 MessageBubbleData[]（与 {@link mapOpenAIMessagesToMessageBubbleData} 一致，带 memo）。
 */ export function useOpenAIMessageBubbleData(messages, mapOptions, mapMessage) {
    var _ref = mapOptions !== null && mapOptions !== void 0 ? mapOptions : {}, baseTime = _ref.baseTime, timeStepMs = _ref.timeStepMs, bumpUpdateAtOnLastMessage = _ref.bumpUpdateAtOnLastMessage, getMessageId = _ref.getMessageId, toolRoleAs = _ref.toolRoleAs, appendToolCallsToContent = _ref.appendToolCallsToContent, preserveRawInExtra = _ref.preserveRawInExtra;
    return useMemo(function() {
        return mapOpenAIMessagesToMessageBubbleData(messages, mapOptions, mapMessage);
    }, [
        messages,
        baseTime,
        timeStepMs,
        bumpUpdateAtOnLastMessage,
        getMessageId,
        toolRoleAs,
        appendToolCallsToContent,
        preserveRawInExtra,
        mapMessage
    ]);
}
