Compare commits
1 Commits
test/watch
...
ca71b81ff7
| Author | SHA1 | Date | |
|---|---|---|---|
| ca71b81ff7 |
@@ -1,3 +1,5 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
.git
|
||||
*
|
||||
!Dockerfile
|
||||
!server.js
|
||||
!public/
|
||||
!public/**
|
||||
|
||||
38
README.md
38
README.md
@@ -1,12 +1,36 @@
|
||||
# Watch paths Phase 4 fixture
|
||||
# OpenAI Chat Demo
|
||||
|
||||
Small two-service monorepo used to accept the per-service Gitea watch-path filtering flow.
|
||||
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.
|
||||
|
||||
- `web/` builds from repository root and uses `packages/shared`, root npm workspace manifests, and `healthcare-miniapp/package.json` as build inputs.
|
||||
- `backend/` builds from its own directory and has no dependency on web files.
|
||||
## Configuration
|
||||
|
||||
Both containers expose `/health` on port 8080. No external services or credentials are needed.
|
||||
The container uses exactly two application environment variables:
|
||||
|
||||
Phase 4 acceptance probe: root documentation only.
|
||||
| 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 |
|
||||
|
||||
Phase 4 acceptance probe: docs-only commit after relevant change.
|
||||
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.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
FROM docker.io/library/node:22-alpine
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
COPY --chown=1000:1000 server.js ./server.js
|
||||
USER 1000
|
||||
EXPOSE 8080
|
||||
CMD ["node", "server.js"]
|
||||
@@ -1,8 +0,0 @@
|
||||
const http = require("node:http");
|
||||
const server = http.createServer((request, response) => {
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.writeHead(200).end(JSON.stringify({ status: "ok", service: "backend" }));
|
||||
});
|
||||
server.listen(8080, "0.0.0.0");
|
||||
|
||||
// phase 4 selected backend source probe
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "watch-paths-fixture-miniapp",
|
||||
"version": "1.0.1",
|
||||
"private": true
|
||||
}
|
||||
42
package-lock.json
generated
42
package-lock.json
generated
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "watch-paths-phase4-fixture",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "watch-paths-phase4-fixture",
|
||||
"workspaces": [
|
||||
"web",
|
||||
"packages/shared",
|
||||
"healthcare-miniapp"
|
||||
]
|
||||
},
|
||||
"healthcare-miniapp": {
|
||||
"name": "watch-paths-fixture-miniapp",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"node_modules/watch-paths-fixture-miniapp": {
|
||||
"resolved": "healthcare-miniapp",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/watch-paths-fixture-shared": {
|
||||
"resolved": "packages/shared",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/watch-paths-fixture-web": {
|
||||
"resolved": "web",
|
||||
"link": true
|
||||
},
|
||||
"packages/shared": {
|
||||
"name": "watch-paths-fixture-shared",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"web": {
|
||||
"name": "watch-paths-fixture-web",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"watch-paths-fixture-shared": "file:../packages/shared"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "watch-paths-phase4-fixture",
|
||||
"private": true,
|
||||
"workspaces": ["web", "packages/shared", "healthcare-miniapp"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = { fixtureName: "watch-paths-phase4-shared" };
|
||||
@@ -1 +0,0 @@
|
||||
{"name":"watch-paths-fixture-shared","version":"1.0.0","main":"index.js"}
|
||||
@@ -1,14 +0,0 @@
|
||||
FROM docker.io/library/node:22-alpine
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
COPY --chown=1000:1000 package.json package-lock.json ./
|
||||
COPY --chown=1000:1000 packages/shared/package.json ./packages/shared/
|
||||
COPY --chown=1000:1000 healthcare-miniapp/package.json ./healthcare-miniapp/
|
||||
COPY --chown=1000:1000 web/package.json ./web/
|
||||
RUN npm ci --omit=dev
|
||||
COPY --chown=1000:1000 packages/shared ./packages/shared
|
||||
COPY --chown=1000:1000 web ./web
|
||||
WORKDIR /app/web
|
||||
USER 1000
|
||||
EXPOSE 8080
|
||||
CMD ["npm", "start"]
|
||||
@@ -1 +0,0 @@
|
||||
# Documentation-only path used to verify excluded changes
|
||||
@@ -1 +0,0 @@
|
||||
relevant first commit within one push
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"name": "watch-paths-fixture-web",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"watch-paths-fixture-shared": "file:../packages/shared"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
const http = require("node:http");
|
||||
const { fixtureName } = require("watch-paths-fixture-shared");
|
||||
const server = http.createServer((request, response) => {
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
if (request.url === "/health") {
|
||||
response.writeHead(200).end(JSON.stringify({ status: "ok", service: "web", fixtureName }));
|
||||
return;
|
||||
}
|
||||
response.writeHead(200).end(JSON.stringify({ service: "web", fixtureName }));
|
||||
});
|
||||
server.listen(8080, "0.0.0.0");
|
||||
Reference in New Issue
Block a user