from fastapi import FastAPI, Response, Cookie from fastapi.responses import HTMLResponse from pydantic import BaseModel, Field import time import os value = os.environ.get('YOUR_ENV_KEY') app = FastAPI() Tokens = [] History = [] @app.get("/", response_class=HTMLResponse) async def read_root(response: Response): token = time.time() Tokens.append(str(token)) History.append([{"role": "system", "content": "You are a helpful assistant. Always respond with factual accuracy and avoid hallucinations. Maintain professionalism and grounded honesty. Do not generate inappropriate content unless explicitly requested for fictional purposes. Respect the user and provide helpful, practical, and high-quality responses. Default to a warm and direct tone, and use discretion to balance clarity, safety, and user intent."}]) response.set_cookie(key="token", value=token, httponly=True, samesite='strict') # Set cookie return '''