- To get started, edit the page.tsx file. -
-- Looking for a starting point or more instructions? Head over to{" "} - - Templates - {" "} - or the{" "} - - Learning - {" "} - center. -
-diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..d134642 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +# 前端容器对外暴露的端口 +HTTP_PORT=8080 +# 构建期注入:编译后的前端调用的后端地址 +# - 本机直连后端:http://host.docker.internal:4001 +# - 与 aura-server 同 docker 网络时:http://server:4001 +VITE_API_TARGET=http://host.docker.internal:4001 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb18b22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +node_modules +dist +.DS_Store +*.log +.env +.env.local +tsconfig.tsbuildinfo diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a4f5001 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +# 前端构建:Vite 静态产物 → nginx 提供 +FROM node:20-alpine AS builder +WORKDIR /src +COPY package.json package-lock.json* ./ +RUN npm ci || npm install +COPY . ./ +# 后端在 docker 网络中通过服务名 server 访问(compose 里) +ARG VITE_API_TARGET=http://server:4001 +ENV VITE_API_TARGET=$VITE_API_TARGET +RUN npm run build + +FROM nginx:alpine +COPY --from=builder /src/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/README.md b/README.md index e69de29..dcde59b 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,45 @@ +# aura-web + +Aura Agent Platform 前端项目(React + Vite + TypeScript)。 + +> 由 `rh-agent-platform/web/` 拆分独立而来。后端代码现位于平级项目 `aura-server`。 + +## 本地开发 + +```bash +npm install +npm run dev # http://localhost:5173 +``` + +默认 `/api` 代理到 `http://localhost:4001`(即 aura-server 的 Go 服务)。 +如需切换: + +```bash +VITE_API_TARGET=http://localhost:4000 npm run dev +``` + +## 构建 + +```bash +npm run build # 产物输出至 dist/ +npm run preview # 本地预览 +``` + +## Docker + +```bash +cp .env.example .env +docker compose up -d --build +# 浏览器访问 http://localhost:8080 +``` + +## 目录结构 + +``` +src/ +├── components/ 公共组件 +├── pages/ 路由页面 +├── store/ Zustand 状态 +├── api.ts REST/SSE 客户端 +└── main.tsx 入口 +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..10fe49f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.9" + +# 独立的前端编排:构建 Vite 产物并由 nginx 提供 +# 后端地址通过构建参数 VITE_API_TARGET 注入(默认指向同机 4001) +services: + web: + build: + context: . + dockerfile: Dockerfile + args: + VITE_API_TARGET: ${VITE_API_TARGET:-http://host.docker.internal:4001} + image: agent-studio-web:v0.9 + container_name: agent-web + restart: unless-stopped + ports: + - "${HTTP_PORT:-8080}:80" diff --git a/index.html b/index.html new file mode 100644 index 0000000..86a3c58 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + +
+ + +- Looking for a starting point or more instructions? Head over to{" "} - - Templates - {" "} - or the{" "} - - Learning - {" "} - center. -
-
+ {s.transport === 'stdio'
+ ? `${s.command} ${s.args.join(' ')}`
+ : s.url}
+
+ {status?.tools && status.tools.length > 0 && (
+ {r.uri}
+ {r.description &&
+ {contentModal?.content}
+
+ 任何人凭此链接都可只读访问该会话:
++ Skill 是一个带 YAML frontmatter 的 Markdown 文件,frontmatter 用于声明工具元信息: +
+{`---
+name: 工具内部名(仅字母数字下划线)
+description: 给 LLM 看的功能描述
+type: prompt | http | js
+parameters: # JSON Schema (function calling 标准)
+ type: object
+ properties:
+ foo: { type: string }
+ required: [foo]
+handler: ... # http: URL 模板 / js: 代码体
+config: # 可选:method/headers/body/timeout/allowFetch
+ method: GET
+---`}
+ {'{{var}}'} 替换参数),可配 method/headers/body
+ args,需 return 结果
+ 定义这个智能体的身份、语气、边界和输出规范,让它更像一个稳定的角色,而不是随机回复的模型。
+这里决定它用什么模型、拥有哪些知识和技能,以及它会以怎样的方式被别人看到。
+一边调整人设和能力,一边看对话气质是否符合你的预期。
++ {agent.description || '我是你的专属 AI 助手,随时准备为你服务。'} +
+
+ {JSON.stringify(t.result?.result ?? t.result?.error ?? t.result).slice(0, 500)}
+
+ + 可视化编排提示词、知识库与工具,让每一位团队成员都能调用最契合的 AI 能力。 +
+ ++ 浏览社区创建的智能体,快速复制、微调并投入你的日常工作流。 +
+{'{{input.x}} {{vars.x}} {{steps..output...}}'} 。condition(返回 bool 的 JS 片段),引擎按 next/elseNext 走。
+
+ {JSON.stringify(s.output, null, 2)}
+
+ )}
+
+ {JSON.stringify(finalRun, null, 2)}
+
+