MCPcopy Create free account
hub / github.com/browserwing/browserwing / Update

Method Update

backend/sdk/script.go:132–157  ·  view source on GitHub ↗

Update 更新脚本

(ctx context.Context, scriptID string, script *Script)

Source from the content-addressed store, hash-verified

130
131// Update 更新脚本
132func (sc *ScriptClient) Update(ctx context.Context, scriptID string, script *Script) error {
133 if sc.client.db == nil {
134 return fmt.Errorf("database not initialized")
135 }
136
137 // 确保 ID 一致
138 script.ID = scriptID
139
140 // 转换为内部模型
141 dbScript := &models.Script{
142 ID: script.ID,
143 Name: script.Name,
144 Description: script.Description,
145 URL: script.URL,
146 Actions: script.Actions,
147 Tags: script.Tags,
148 Group: script.Group,
149 }
150
151 // 更新到数据库
152 if err := sc.client.db.UpdateScript(dbScript); err != nil {
153 return fmt.Errorf("failed to update script: %w", err)
154 }
155
156 return nil
157}
158
159// Delete 删除脚本
160func (sc *ScriptClient) Delete(ctx context.Context, scriptID string) error {

Callers 15

NewBoltDBFunction · 0.45
SaveCookiesMethod · 0.45
DeleteCookiesMethod · 0.45
SaveScriptMethod · 0.45
DeleteScriptMethod · 0.45
SaveLLMConfigMethod · 0.45
DeleteLLMConfigMethod · 0.45
ClearDefaultLLMConfigMethod · 0.45
SaveBrowserConfigMethod · 0.45
DeleteBrowserConfigMethod · 0.45
SavePromptMethod · 0.45
DeletePromptMethod · 0.45

Calls 1

UpdateScriptMethod · 0.45

Tested by

no test coverage detected