User: I will give you code that displays a web app to chat with an LLM, using streamlit. I want you to create a new button that will allow for opening a new web-page, with markdown-formatted data, using st.markdown of the whole history.
Code:
```py
import streamlit as st
from gradio_client import Client
import os
import json

# Set page configuration
st.set_page_config(
    page_title="LLM Chat Application",
    layout="wide",
    initial_sidebar_state="auto"
)

# Constants
HISTORY_FILE = 'history.txt'  # This file stores the conversation history
MODEL_CLIENT_NAME = 'yuntian-deng/ChatGPT4'  # Replace with your actual model identifier
CONFIG_FILE = 'config.json'  # Config file to store top_p and temperature

# Function to load history from the file
def load_history():
    if os.path.exists(HISTORY_FILE):
        with open(HISTORY_FILE, 'r', encoding='utf-8') as f:
            return f.read()
    return ""

# Function to save history to the file
def save_history(history):
    with open(HISTORY_FILE, 'w', encoding='utf-8') as f:
        f.write(history)

# Function to load config from the file
def load_config():
    if os.path.exists(CONFIG_FILE):
        with open(CONFIG_FILE, 'r', encoding='utf-8') as f:
            return json.load(f)
    else:
        return {"top_p": 1.0, "temperature": 1.0}

# Function to save config to the file
def save_config(config):
    with open(CONFIG_FILE, 'w', encoding='utf-8') as f:
        json.dump(config, f)

# Initialize session state for history
if 'history' not in st.session_state:
    st.session_state.history = load_history()

# Initialize session state for config
if 'config' not in st.session_state:
    st.session_state.config = load_config()

# Editable text area for conversation history
history_input = st.text_area(
    "history",
    value=st.session_state.history,
    height=400,
    key='history_text_area',
    placeholder="Your converstation will be displayed here...",
)

# Update session state and save history if manually edited
if history_input != st.session_state.history:
    st.session_state.history = history_input
    save_history(st.session_state.history)

# Create a form for new input
with st.form("chat_form", clear_on_submit=True):
    user_input = st.text_area("Your Message", key='user_input', placeholder="Type your message here...")

    # Generate Response button
    generate = st.form_submit_button("Send Message")

    # Sliders for Temperature and Top-P sampling
    col1, col2 = st.columns(2)
    with col1:
        temperature = st.slider(
            "Temperature",
            min_value=0.0,
            max_value=5.0,
            value=st.session_state.config.get('temperature', 1.0),
            step=0.1,
            help="Controls the randomness of the model's output."
        )
    with col2:
        top_p = st.slider(
            "Top-P Sampling",
            min_value=0.0,
            max_value=1.0,
            value=st.session_state.config.get('top_p', 1.0),
            step=0.05,
            help="Nucleus sampling."
        )

    col3, col4 = st.columns(2)
    with col3:
        user_prefix = st.text_area('User Prefix', key='user_prefix', placeholder="User...", value="User: ", height=68)
    with col4:
        llm_prefix = st.text_area('LLM Prefix', key='llm_prefix', placeholder="Assistant...", value="Assistant: ", height=68)

    # Update the config in session_state and save to file when sliders change
    if temperature != st.session_state.config.get('temperature', 1.0) or top_p != st.session_state.config.get('top_p', 1.0):
        st.session_state.config['temperature'] = temperature
        st.session_state.config['top_p'] = top_p
        save_config(st.session_state.config)

# Handle form submission
if generate:
    if user_input.strip():
        # Append user's message to the history
        st.session_state.history += f"{user_prefix}{user_input.strip()}\n"
        save_history(st.session_state.history)
        try:
            # Initialize the client
            client = Client(MODEL_CLIENT_NAME)

            # Prepare the prompt
            prompt = st.session_state.history

            # Call the model to get a response
            result = client.predict(
                inputs=prompt,
                top_p=st.session_state.config['top_p'],
                temperature=st.session_state.config['temperature'],
                chat_counter=0,
                chatbot=[],
                api_name='/predict'
            )
            # Adjust based on actual API response structure
            # Assuming 'result' is a list of lists where result[0][0][1] is the response
            output = result[0][0][1].strip()

            # Append model response to history
            st.session_state.history += f"{llm_prefix}{output}\n"
            save_history(st.session_state.history)

            # Re-render the page to show updated history
            st.rerun()

        except Exception as e:
            st.error(f"Error communicating with the model: {e}")
    else:
        st.warning("Please enter a message.")
```