import { ConversationMessage_MessageType, } from "./gen/aiserver/v1/aiserver_pb.js";
export function cursorRequestToOpenAI(value) {
    const conversation = value.streamUnifiedChatRequest?.conversation ?? [];
    const messages = [];
    for (const item of conversation) {
        const content = item.text;
        if (content.length === 0) {
            continue;
        }
        messages.push({
            role: item.type ===
                ConversationMessage_MessageType.CONVERSATION_MESSAGE_MESSAGE_TYPE_MESSAGE_TYPE_AI
                ? "assistant"
                : "user",
            content,
        });
    }
    if (messages.length === 0) {
        messages.push({ role: "user", content: "Hello" });
    }
    return messages;
}
