Skip to content

Commit 7d4a67a

Browse files
feat(devops): use golang code in debug input
1 parent 0b9e851 commit 7d4a67a

File tree

10 files changed

+975
-65
lines changed

10 files changed

+975
-65
lines changed

devops/internal/apihandler/debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func StreamDebugRun(res http.ResponseWriter, req *http.Request) {
136136
FromNode: rs.FromNode,
137137
}
138138

139-
debugID, stateCh, errCh, err := service.DebugSVC.DebugRun(ctx, m, rs.Input)
139+
debugID, stateCh, errCh, err := service.DebugSVC.DebugRun(ctx, m, rs.Input, rs.InputFormat)
140140
if err != nil {
141141
log.Errorf(err.Error())
142142
return

devops/internal/apihandler/debug_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (d *debugTestSuite) Test_DebugRun() {
158158

159159
stateCh := make(chan *model.NodeDebugState, 100)
160160
errCh := make(chan error, 1)
161-
d.mockDebugSVC.EXPECT().DebugRun(gomock.Any(), gomock.Any(), gomock.Any()).
161+
d.mockDebugSVC.EXPECT().DebugRun(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
162162
Return("mock_debug_id", stateCh, errCh, nil).Times(1)
163163

164164
stateCh <- &model.NodeDebugState{

devops/internal/apihandler/types/debug.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ type CreateDebugThreadResponse struct {
3232
}
3333

3434
type DebugRunRequest struct {
35-
FromNode string `json:"from_node"`
36-
Input string `json:"input"` // mock input data after json marshal
37-
LogID string `json:"log_id"`
35+
FromNode string `json:"from_node"`
36+
Input string `json:"input"` // mock input data after json marshal
37+
LogID string `json:"log_id"`
38+
InputFormat InputFormat `json:"input_format"`
3839
}
3940

4041
type DebugRunEventType string
@@ -114,3 +115,10 @@ func (d DebugRunEventMsg) JsonBytes() []byte {
114115
type ListInputTypesResponse struct {
115116
Types []*devmodel.JsonSchema `json:"types,omitempty"`
116117
}
118+
119+
type InputFormat int
120+
121+
const (
122+
InputFormatOfCode InputFormat = 0
123+
InputFormatOfJson InputFormat = 1
124+
)

devops/internal/mock/container_mock.go

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

devops/internal/mock/debug_run_mock.go

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

0 commit comments

Comments
 (0)