<script lang="ts">
    import { Chat } from "./chat"
    import InputRow from "./InputRow.svelte"
    import Messages from "./Messages.svelte"
    function generateUniqueId() {
        return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
    }
    let chat = $derived(
        new Chat(generateUniqueId(), {
            url: "https://2schat-server.robins-spielwiese.de/api/v1/chatbot/stream",
            headers: {
                "Content-Type": "application/json",
            },
        })
    )
</script>

<div class="chat-wrapper">
    <Messages {chat} />
    <InputRow {chat} />
</div>

<style lang="less">
    .chat-wrapper {
        min-height: 400px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
</style>
