refactor(runtime): replace RuntimeExecutor with direct use of executor.Service
This commit is contained in:
@@ -3,12 +3,11 @@ package runtime
|
||||
import (
|
||||
"context"
|
||||
|
||||
runtimeeino "cs-agent/internal/ai/infra/eino"
|
||||
"cs-agent/internal/ai/runtime/executor"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
runtime *runtimeeino.RuntimeExecutor
|
||||
runtime *executor.Service
|
||||
catalog *toolCatalog
|
||||
prepare *prepareService
|
||||
}
|
||||
@@ -16,7 +15,7 @@ type Service struct {
|
||||
func NewService() *Service {
|
||||
catalog := newToolCatalog()
|
||||
return &Service{
|
||||
runtime: runtimeeino.NewRuntimeExecutor(),
|
||||
runtime: executor.NewService(),
|
||||
catalog: catalog,
|
||||
prepare: newPrepareService(catalog),
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package eino
|
||||
|
||||
import (
|
||||
"context"
|
||||
"cs-agent/internal/ai/runtime/executor"
|
||||
)
|
||||
|
||||
// TODO 这个不要了,直接使用executor不行吗?
|
||||
type RuntimeExecutor struct {
|
||||
inner *executor.Service
|
||||
}
|
||||
|
||||
func NewRuntimeExecutor() *RuntimeExecutor {
|
||||
return &RuntimeExecutor{
|
||||
inner: executor.NewService(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *RuntimeExecutor) ExecuteRun(ctx context.Context, req executor.RunInput) (*executor.RunResult, error) {
|
||||
if s == nil || s.inner == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return s.inner.ExecuteRun(ctx, executor.RunInput(req))
|
||||
}
|
||||
|
||||
func (s *RuntimeExecutor) ExecuteResume(ctx context.Context, req executor.ResumeInput) (*executor.RunResult, error) {
|
||||
if s == nil || s.inner == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return s.inner.ExecuteResume(ctx, executor.ResumeInput(req))
|
||||
}
|
||||
Reference in New Issue
Block a user