Skip to content

Commit 776ff6b

Browse files
committed
Refactor App.vue to replace SSE functionality with POST request handling, updating UI components and state management accordingly. Modify useSSE composable to support POST requests and adjust server routes to handle POST requests for /generate, including enhanced logging and error handling.
1 parent cf36043 commit 776ff6b

7 files changed

Lines changed: 1231 additions & 390 deletions

File tree

.dockerignore

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Node modules
2+
node_modules/
3+
**/node_modules/
4+
5+
# Build outputs
6+
dist/
7+
build/
8+
*.log
9+
10+
# Git
11+
.git/
12+
.gitignore
13+
14+
# IDE
15+
.vscode/
16+
.idea/
17+
*.swp
18+
*.swo
19+
20+
# OS
21+
.DS_Store
22+
Thumbs.db
23+
24+
# Environment files
25+
.env
26+
.env.local
27+
.env.*.local
28+
29+
# Documentation
30+
*.md
31+
!examples/typescript/servers/advanced/README.md
32+
33+
# Test files
34+
**/*.test.ts
35+
**/*.spec.ts
36+
**/__tests__/
37+
38+
# Other examples (only need advanced server)
39+
examples/typescript/clients/
40+
examples/typescript/agent/
41+
examples/typescript/discovery/
42+
examples/typescript/facilitator/
43+
examples/typescript/fullstack/
44+
examples/typescript/dynamic_agent/
45+
examples/typescript/mcp/
46+
examples/typescript/mcp-embedded-wallet/
47+
examples/typescript/servers/simple/
48+
examples/typescript/servers/mainnet/
49+
50+
# Python and Go examples
51+
examples/python/
52+
go/
53+
java/
54+
python/
55+
56+
# E2E tests
57+
e2e/
58+
59+
# Static files
60+
static/
61+
62+
# Specs
63+
specs/
64+
65+
# Other monorepo packages not needed
66+
typescript/packages/coinbase-x402/
67+
typescript/packages/x402-axios/
68+
typescript/packages/x402-express/
69+
typescript/packages/x402-fetch/
70+
typescript/packages/x402-hono/
71+
typescript/packages/x402-next/
72+
typescript/site/
73+

advanced-server/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# 使用 Node.js 官方镜像
2+
FROM node:20-slim
3+
4+
# 安装 pnpm
5+
RUN npm install -g pnpm@10.7.0
6+
7+
# 设置工作目录
8+
WORKDIR /app
9+
10+
# 复制 typescript monorepo 配置文件
11+
COPY typescript/package.json typescript/
12+
COPY typescript/pnpm-workspace.yaml typescript/
13+
COPY typescript/pnpm-lock.yaml typescript/
14+
COPY typescript/tsconfig.base.json typescript/
15+
16+
# 复制 x402 包(advanced 服务的依赖)
17+
COPY typescript/packages/x402/ typescript/packages/x402/
18+
19+
# 复制 examples/typescript workspace 配置
20+
COPY examples/typescript/package.json examples/typescript/
21+
COPY examples/typescript/pnpm-workspace.yaml examples/typescript/
22+
COPY examples/typescript/pnpm-lock.yaml examples/typescript/
23+
24+
# 复制 advanced 服务文件
25+
COPY examples/typescript/servers/advanced/ examples/typescript/servers/advanced/
26+
27+
# 设置工作目录到 examples/typescript
28+
WORKDIR /app/examples/typescript
29+
30+
# 安装依赖
31+
RUN pnpm install
32+
33+
# 暴露服务端口
34+
EXPOSE 4021
35+
36+
# 设置环境变量默认值(可以通过 docker run -e 覆盖)
37+
ENV FACILITATOR_URL=""
38+
ENV ADDRESS=""
39+
ENV PROXY_TARGET_URL="http://127.0.0.1:9999"
40+
41+
# 启动服务
42+
CMD ["pnpm", "--filter", "advanced-server-example", "dev"]
43+

advanced-server/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Advanced Server Docker 配置
2+
3+
本目录包含用于构建和运行 `examples/typescript/servers/advanced` 服务的 Docker 配置文件。
4+
5+
## 使用方法
6+
7+
### 构建镜像
8+
9+
在项目根目录执行:
10+
11+
```bash
12+
docker build -f advanced-server/Dockerfile -t advanced-server .
13+
```
14+
15+
### 运行容器
16+
17+
```bash
18+
docker run -d \
19+
-p 4021:4021 \
20+
-e FACILITATOR_URL="https://your-facilitator-url.com" \
21+
-e ADDRESS="0xYourEthereumAddress" \
22+
-e PROXY_TARGET_URL="http://127.0.0.1:9999" \
23+
--name advanced-server \
24+
advanced-server
25+
```
26+
27+
### 使用环境变量文件
28+
29+
```bash
30+
docker run -d \
31+
-p 4021:4021 \
32+
--env-file .env \
33+
--name advanced-server \
34+
advanced-server
35+
```
36+
37+
## 环境变量
38+
39+
- `FACILITATOR_URL` (必需): Facilitator 服务的 URL
40+
- `ADDRESS` (必需): 接收支付的以太坊地址
41+
- `PROXY_TARGET_URL` (可选): 代理目标 URL,默认为 `http://127.0.0.1:9999`
42+
43+
## 端口
44+
45+
服务默认监听在 `4021` 端口。
46+

0 commit comments

Comments
 (0)