refactor(runtime): replace RuntimeExecutor with direct use of executor.Service
This commit is contained in:
@@ -3,12 +3,11 @@ package runtime
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
runtimeeino "cs-agent/internal/ai/infra/eino"
|
|
||||||
"cs-agent/internal/ai/runtime/executor"
|
"cs-agent/internal/ai/runtime/executor"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
runtime *runtimeeino.RuntimeExecutor
|
runtime *executor.Service
|
||||||
catalog *toolCatalog
|
catalog *toolCatalog
|
||||||
prepare *prepareService
|
prepare *prepareService
|
||||||
}
|
}
|
||||||
@@ -16,7 +15,7 @@ type Service struct {
|
|||||||
func NewService() *Service {
|
func NewService() *Service {
|
||||||
catalog := newToolCatalog()
|
catalog := newToolCatalog()
|
||||||
return &Service{
|
return &Service{
|
||||||
runtime: runtimeeino.NewRuntimeExecutor(),
|
runtime: executor.NewService(),
|
||||||
catalog: catalog,
|
catalog: catalog,
|
||||||
prepare: newPrepareService(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