37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
# OpenAI Chat Demo
|
|
|
|
A small web chat service that sends questions to the OpenAI Responses API. The browser talks only to this app; `API_KEY` stays in the server container and is never sent to the browser.
|
|
|
|
## Configuration
|
|
|
|
The container uses exactly two application environment variables:
|
|
|
|
| Variable | Purpose | Example |
|
|
| --- | --- | --- |
|
|
| `MODEL` | OpenAI model name to call | `gpt-4.1-mini` |
|
|
| `API_KEY` | OpenAI API key; configure this as a secret | Set it in the runtime secret manager |
|
|
|
|
The app listens on port `8080`.
|
|
|
|
## Run with Docker
|
|
|
|
Set the real key in your shell or secret manager, then run:
|
|
|
|
```sh
|
|
docker run --rm -p 8080:8080 \
|
|
-e MODEL=gpt-4.1-mini \
|
|
-e API_KEY \
|
|
lucnguyen666/aisp-openai-chat-demo:1.0.0
|
|
```
|
|
|
|
Open <http://localhost:8080>. For a platform deployment, map `MODEL` as a regular environment variable and `API_KEY` as a secret environment variable.
|
|
|
|
## Build locally
|
|
|
|
```sh
|
|
docker build -t aisp-openai-chat-demo:local .
|
|
docker run --rm -p 8080:8080 -e MODEL=gpt-4.1-mini -e API_KEY aisp-openai-chat-demo:local
|
|
```
|
|
|
|
The chat history is held in browser memory for the current page session. The server calls `POST https://api.openai.com/v1/responses` with `store: false`. It does not log prompts or API keys.
|