Skip to content

Commit 35c8ed0

Browse files
committed
feat(backend): auto task pipeline
1 parent f27d2fb commit 35c8ed0

646 files changed

Lines changed: 237234 additions & 68319 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/.licenserc.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,34 @@ dependency:
4242
licenses:
4343
- name: github.com/cloudwego/eino-ext/*/*/*
4444
license: Apache-2.0
45+
- name: github.com/cloudwego/eino
46+
license: Apache-2.0
47+
- name: github.com/cloudwego/gopkg
48+
license: Apache-2.0
49+
- name: github.com/cloudwego/configmanager
50+
license: Apache-2.0
51+
- name: github.com/cloudwego/localsession
52+
license: Apache-2.0
53+
- name: github.com/cloudwego/runtimex
54+
license: Apache-2.0
55+
- name: github.com/hertz-contrib/sse
56+
license: Apache-2.0
57+
- name: github.com/xeipuuv/gojsonschema
58+
license: Apache-2.0
59+
- name: github.com/xeipuuv/gojsonpointer
60+
license: Apache-2.0
61+
- name: github.com/xeipuuv/gojsonreference
62+
license: Apache-2.0
63+
- name: github.com/google/s2a-go
64+
license: Apache-2.0
65+
- name: github.com/josharian/intern
66+
license: MIT
67+
- name: github.com/lib/pq
68+
license: MIT
69+
- name: github.com/olekukonko/tablewriter
70+
license: MIT
71+
- name: github.com/paulmach/orb
72+
license: MIT
4573
excludes:
4674
- name: github.com/alicebob/gopher-json
4775
license: Unlicense

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ output/
2424
# Files generated by IDEs
2525
.idea/
2626
*.iml
27+
.trae/
2728

2829
# MacOS files
2930
**/.DS_Store
@@ -59,4 +60,6 @@ backend/script/errorx/.env
5960
.cursor/
6061
.specify/
6162
specs/
62-
.puml
63+
.puml
64+
.trae
65+
openspec/

README.cn.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ Coze Loop 通过提供全生命周期的管理能力,帮助开发者更高效
115115
6. 开始定制你的 Coze Loop 项目。
116116
参考 `examples/` 目录示例,修改 `values.yaml` 即可覆盖默认设置,修改后重新执行 `make helm-up` 生效。
117117

118+
> [!WARNING]
119+
> 如果要将 Coze Loop 部署到公网环境,建议在部署前评估整体评估安全风险,例如账号注册功能、Coze Server 监听地址配置、SSRF 和部分 API 水平越权的风险,并采取相应防护措施。详细信息可参考[快速开始](https://github.com/coze-dev/coze-loop/wiki/2.-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B#%E5%85%AC%E7%BD%91%E5%AE%89%E5%85%A8%E9%A3%8E%E9%99%A9)
120+
118121
## 使用 Coze Loop 开源版
119122

120123
* [Prompt 开发与调试](https://loop.coze.cn/open/docs/cozeloop/create-prompt):Coze Loop 提供了完整的提示词开发流程。

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ Procedure:
115115
6. Start customizing your Coze Loop project.
116116
Refer to the examples in the `examples/` directory. Modify `values.yaml` to override the default settings. After making changes, rerun `make helm-up` for the changes to take effect.
117117

118+
> [!WARNING]
119+
> If you want to deploy Coze Loop in a public network environment, it is recommended to assess security risks before you begin, and take corresponding protection measures. Possible security risks include account registration functions, Coze Server listening address configurations, SSRF (Server - Side Request Forgery), and some horizontal privilege escalations in APIs. For more details, refer to [Quickstart](https://github.com/coze-dev/coze-loop/wiki/2.-Quickstart#security-risks-in-public-networks).
120+
118121
## Use the Coze Loop open source version
119122

120123
* [Prompt development and debugging](https://loop.coze.cn/open/docs/cozeloop/create-prompt): Coze Loop provides a complete prompt development workflow.

backend/api/api.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/api/handler/coze/loop/apis/eval_open_apiservice.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/api/handler/coze/loop/apis/eval_target_service.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/api/handler/coze/loop/apis/evaluation_set_service.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/api/handler/coze/loop/apis/evaluator_service.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/api/handler/coze/loop/apis/evaluator_service_test.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ import (
1919
// mockEvaluatorClient 实现 evaluatorservice.Client 的必要方法,返回空响应以通过渲染
2020
type mockEvaluatorClient struct{}
2121

22+
func (m *mockEvaluatorClient) AsyncRunEvaluator(ctx context.Context, req *evaluator.AsyncRunEvaluatorRequest, callOptions ...callopt.Option) (r *evaluator.AsyncRunEvaluatorResponse, err error) {
23+
return nil, nil
24+
}
25+
26+
func (m *mockEvaluatorClient) AsyncDebugEvaluator(ctx context.Context, req *evaluator.AsyncDebugEvaluatorRequest, callOptions ...callopt.Option) (r *evaluator.AsyncDebugEvaluatorResponse, err error) {
27+
return nil, nil
28+
}
29+
2230
func (m *mockEvaluatorClient) ListEvaluators(ctx context.Context, req *evaluator.ListEvaluatorsRequest, callOptions ...callopt.Option) (r *evaluator.ListEvaluatorsResponse, err error) {
2331
return &evaluator.ListEvaluatorsResponse{}, nil
2432
}
@@ -63,6 +71,10 @@ func (m *mockEvaluatorClient) BatchGetEvaluatorVersions(ctx context.Context, req
6371
return &evaluator.BatchGetEvaluatorVersionsResponse{}, nil
6472
}
6573

74+
func (m *mockEvaluatorClient) BatchGetEvaluatorVersionIDs(ctx context.Context, req *evaluator.BatchGetEvaluatorVersionIDsRequest, callOptions ...callopt.Option) (r *evaluator.BatchGetEvaluatorVersionIDsResponse, err error) {
75+
return &evaluator.BatchGetEvaluatorVersionIDsResponse{}, nil
76+
}
77+
6678
func (m *mockEvaluatorClient) SubmitEvaluatorVersion(ctx context.Context, req *evaluator.SubmitEvaluatorVersionRequest, callOptions ...callopt.Option) (r *evaluator.SubmitEvaluatorVersionResponse, err error) {
6779
return &evaluator.SubmitEvaluatorVersionResponse{}, nil
6880
}
@@ -239,3 +251,63 @@ func TestEvaluatorService_Handlers(t *testing.T) {
239251
})
240252
}
241253
}
254+
255+
func TestEvaluatorService_AsyncHandlers(t *testing.T) {
256+
t.Parallel()
257+
258+
ctx := context.Background()
259+
260+
tests := []struct {
261+
name string
262+
body string
263+
handler func(context.Context, *app.RequestContext)
264+
wantStatus int
265+
}{
266+
{
267+
name: "AsyncRunEvaluator bad json",
268+
body: "{invalid",
269+
handler: AsyncRunEvaluator,
270+
wantStatus: http.StatusBadRequest,
271+
},
272+
{
273+
name: "AsyncRunEvaluator ok",
274+
body: `{"workspace_id":1,"evaluator_version_id":2,"input_data":{"input_fields":{}}}`,
275+
handler: AsyncRunEvaluator,
276+
wantStatus: http.StatusOK,
277+
},
278+
{
279+
name: "AsyncDebugEvaluator bad json",
280+
body: "{invalid",
281+
handler: AsyncDebugEvaluator,
282+
wantStatus: http.StatusBadRequest,
283+
},
284+
{
285+
name: "AsyncDebugEvaluator ok",
286+
body: `{"workspace_id":1,"evaluator_type":2,"evaluator_content":{"code_evaluator":{"code_content":"print(1)","language_type":"Python"}},"input_data":{"input_fields":{}}}`,
287+
handler: AsyncDebugEvaluator,
288+
wantStatus: http.StatusOK,
289+
},
290+
{
291+
name: "UpdateBuiltinEvaluatorTags tolerant body",
292+
body: `{"workspace_id":"x"}`,
293+
handler: UpdateBuiltinEvaluatorTags,
294+
wantStatus: http.StatusOK,
295+
},
296+
{
297+
name: "UpdateBuiltinEvaluatorTags ok",
298+
body: `{}`,
299+
handler: UpdateBuiltinEvaluatorTags,
300+
wantStatus: http.StatusOK,
301+
},
302+
}
303+
304+
for _, tt := range tests {
305+
tc := tt
306+
t.Run(tc.name, func(t *testing.T) {
307+
t.Parallel()
308+
c := newJSONCtxWithBody(tc.body)
309+
tc.handler(ctx, c)
310+
assert.Equal(t, tc.wantStatus, c.Response.StatusCode())
311+
})
312+
}
313+
}

0 commit comments

Comments
 (0)