feat: add image generation sub-agent with confirmation and organize ADK example
This commit is contained in:
1 parent
86e86bc9fa
commit
dab8cbb55d
21 files changed
+1402
-181
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// checkpointStore 只保存当前终端进程中的暂停状态,退出后不再保留。
|
||||
type checkpointStore struct {
|
||||
mu sync.Mutex
|
||||
data map[string][]byte
|
||||
}
|
||||
|
||||
func (s *checkpointStore) Get(_ context.Context, id string) ([]byte, bool, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
data, ok := s.data[id]
|
||||
return data, ok, nil
|
||||
}
|
||||
|
||||
func (s *checkpointStore) Set(_ context.Context, id string, data []byte) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.data[id] = data
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *checkpointStore) Delete(_ context.Context, id string) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
delete(s.data, id)
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user