You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mod.rs
    path of file: ./repos/ninja/crates/openai/src/serve/router/chat
    
    the code of the file until where you have to start completion: mod cookier;
mod props;
mod session;

use axum::body;
use axum::body::Body;
use axum::extract::ConnectInfo;
use axum::extract::Path;
use axum::extract::Query;
use axum::headers::authorization::Bearer;
use axum::headers::Authorization;
use axum::http::header;
use axum::http::response::Builder;
use axum::http::HeaderMap;
use axum::http::Response;
use axum::http::StatusCode;
use axum::middleware;
use axum::response::IntoResponse;
use axum::routing::any;
use axum::routing::{get, post};
use axum::Json;
use axum::Router;
use axum::TypedHeader;
use axum_csrf::CsrfConfig;
use axum_csrf::CsrfLayer;
use axum_csrf::CsrfToken;
use axum_csrf::Key;
use axum_extra::extract::CookieJar;
use serde_json::{json, Value};
use std::collections::HashMap;
use std::net::SocketAddr;
use std::sync::OnceLock;
use tower::ServiceBuilder;
use tower_http::ServiceBuilderExt;

use crate::constant::ARKOSE_ENDPOINT;
use crate::constant::AUTH_KEY;
use crate::constant::CSRF_TOKEN;
use crate::constant::EMPTY;
use crate::constant::ERROR;
use crate::constant::PICTURE;
use crate::constant::SITE_KEY;
use crate::constant::SUPPORT_APPLE;
use crate::constant::USERNAME;
use crate::context::args::Args;
use crate::serve::error::ProxyError;
use crate::serve::error::ResponseError;
use crate::serve::middleware::csrf;
use crate::serve::proxy::header_convert;
use crate::serve::turnstile;
use crate::serve::whitelist;
use crate::with_context;
use crate::{
    auth::{model::AuthAccount, provide::AuthProvider},
    token::model::Token,
    URL_CHATGPT_API,
};

use super::get_static_resource;
use session::session::Session;
use session::SessionExt;

const HOME_INDEX: &str = "/";
const LOGIN_INDEX: &str = "/auth/login";
const SESSION_ID: &str = "session";
const SESSION_TOKEN_ID: &str = "session_token";
const PUID_ID: &str = "_puid";
const BUILD_ID: &str = "eFlZtDCQUjuHAccnRY3au";
const TEMP_404: &str = "404.htm";
const TEMP_AUTH: &str = "auth.htm";
const TEMP_CHAT: &str = "chat.htm";
const TEMP_DETAIL: &str = "detail.htm";
const TEMP_LOGIN: &str = "login.htm";
const TEMP_SHARE: &str = "share.htm";

static TEMPLATE: OnceLock<
    
pub(super) fn config(router: Router, args: &Args) -> Router {
    // If the UI is disabled, then return the router directly
    if !args.enable_webui {
        return router;
    }

    // Configure csrf
    let config = CsrfConfig::default().with_key(Some(Key::generate()));

    // Configure arkose routing
    let router =     // If the auth key is empty, then the auth page is not required
    if with_context!(auth_key).is_some() {
        router
    } else {
        router.route("/auth", get(auth))
    };

    // Configure the UI routing
    router
        .route("/auth/login", get(login_index))
        .route(
            "/auth/login",
            post(login).layer(
                ServiceBuilder::new()
                    .map_request_body(body::boxed)
                    .layer(middleware::from_fn(csrf::csrf_middleware)),
            ),
        )
        .layer(CsrfLayer::new(config))
        .route("/auth/login/token", post(login_token))
        .route("/auth/logout", get(logout))
        .route("/auth/session", get(session))
        .route("/auth/me", get(auth_me))
        .route("/", get(chat))
        .route("/c", get(chat))
        .route("/c/:conversation_id", get(chat))
        .route("/chat", any(redirect_to_home))
        .route("/chat/:conversation_id", any(redirect_to_home))
        .route("/share/e/:share_id", get(share_chat))
        .route("/share/:share_id", get(share_chat))
        .route("/share/:share_id/continue", get(share_chat_continue))
        .route(
            &format!("/_next/data/{BUILD_ID}/index.json"),
            get(chat_info),
        )
        .route(
            // {conversation_id}.json
            &format!("/_next/data/{BUILD_ID}/c/:conversation_id"),
            get(chat_info),
        )
        .route(
            // {share_id}.json
            &format!("/_next/data/{BUILD_ID}/share/:share_id"),
            get(share_chat_info),
        )
        .route(
            &format!("/_next/data/{BUILD_ID}/share/:share_id/continue.json"),
            get(share_chat_continue_info),
        )
        // static resource endpoints
        .route("/resources/*path", get(get_static_resource))
        .route("/_next/static/*path", get(get_static_resource))
        .route("/fonts/*path", get(get_static_resource))
        .route("/ulp/*path", get(get_static_resource))
        .route("/sweetalert2/*path", get(get_static_resource))
        // 404 endpoint
        .fallback(error_404)
}