docs: 完善 CLAUDE.md 开发指南和项目发现工作流文档

- 添加常见开发模式指南(API 端点、数据库字段、自定义 Agent、多语言内容)
- 新增故障排除部分,涵盖常见问题和调试技巧
- 改进 GET /api/discovery/tasks 端点,支持通过查询参数传递 API key
- 更新环境变量示例,使用更安全的 API key 格式
This commit is contained in:
2026-01-19 07:57:44 +08:00
parent d59c5aaee6
commit 13acdd426b
3 changed files with 112 additions and 5 deletions
+4 -3
View File
@@ -96,8 +96,11 @@ export async function POST(request: NextRequest) {
*/
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
// 验证 API Key(只读权限)
const apiKey = request.headers.get('x-api-key')
// 支持两种方式:1. 请求头 x-api-key 2. 查询参数 apiKey
const apiKey = request.headers.get('x-api-key') || searchParams.get('apiKey')
const validApiKey = process.env.WEBHOOK_API_KEY
if (
!validApiKey ||
@@ -109,8 +112,6 @@ export async function GET(request: NextRequest) {
{ status: 401 }
)
}
const { searchParams } = new URL(request.url)
const validation = GetDiscoveryTasksQuerySchema.safeParse({
status: searchParams.get('status') || undefined,
limit: searchParams.get('limit') || '10',