Skip to content

feat: multi-user sessions + text/image chat with OpenAI and secure env loading#2

Open
teachingandlearning4077-prog wants to merge 4 commits intomainfrom
codex/create-quantumx-chatbot-on-github-rlfk6t
Open

feat: multi-user sessions + text/image chat with OpenAI and secure env loading#2
teachingandlearning4077-prog wants to merge 4 commits intomainfrom
codex/create-quantumx-chatbot-on-github-rlfk6t

Conversation

@teachingandlearning4077-prog
Copy link
Copy Markdown
Owner

Motivation

  • Make the QuantumX chatbot fully functional for multiple simultaneous visitors with per-user histories and a richer feature set.
  • Allow advanced ChatGPT-like behavior and image generation when an OpenAI key is configured while keeping a robust local fallback when the API is not available.
  • Avoid hardcoding secrets and provide a safe .env-backed configuration path.

Description

  • Add app/settings.py with get_env() that reads environment variables first and falls back to a local .env file.
  • Rewrite the engine into app/engine.py to return a ChatResult (text + optional image_base64) and implement OpenAI-backed text completions and image generation, plus local fallbacks for math, summaries and lists.
  • Add multi-user session management in app/main.py using a qx_session cookie so each visitor gets an isolated ChatEngine instance and /chat accepts mode=text|image.
  • Update frontend templates and static assets (app/templates/index.html, app/static/app.js, app/static/styles.css) to support mode selection and render generated images inline.
  • Add tests/test_engine.py and tests/test_settings.py to cover the new ChatResult flow, image-mode fallback without an API key, and .env behavior, and update README.md, .env.example, .gitignore, and requirements.txt accordingly.

Testing

  • Ran unit tests with python -m pytest -q and all tests passed (6 passed).
  • Performed an automated import check python - <<'PY'\nimport fastapi\nPY which failed because fastapi is not installed in this environment, so the live web server could not be validated here.

Codex Task

@teachingandlearning4077-prog
Copy link
Copy Markdown
Owner Author

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant