Skip to content

Commit ed20330

Browse files
committed
add 'configured' event at the end of model configuration phase
Currently when using models, the final message is 'confugiring' which could let users think the DMR configuration is still pending Signed-off-by: Guillaume Lours <[email protected]> # Conflicts: # pkg/api/event.go
1 parent 3853ad3 commit ed20330

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

pkg/api/event.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ const (
6767
StatusExported = "Exported"
6868
StatusDownloading = "Downloading"
6969
StatusDownloadComplete = "Download complete"
70+
StatusConfiguring = "Configuring"
71+
StatusConfigured = "Configured"
7072
)
7173

7274
// Resource represents status change and progress for a compose resource.

pkg/compose/model.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (m *modelAPI) PullModel(ctx context.Context, model types.ModelConfig, quiet
107107
events.On(api.Resource{
108108
ID: model.Name,
109109
Status: api.Working,
110-
Text: "Pulling",
110+
Text: api.StatusPulling,
111111
})
112112

113113
cmd := exec.CommandContext(ctx, m.path, "pull", model.Model)
@@ -161,7 +161,7 @@ func (m *modelAPI) ConfigureModel(ctx context.Context, config types.ModelConfig,
161161
events.On(api.Resource{
162162
ID: config.Name,
163163
Status: api.Working,
164-
Text: "Configuring",
164+
Text: api.StatusConfiguring,
165165
})
166166
// configure [--context-size=<n>] MODEL
167167
args := []string{"configure"}
@@ -174,7 +174,17 @@ func (m *modelAPI) ConfigureModel(ctx context.Context, config types.ModelConfig,
174174
if err != nil {
175175
return err
176176
}
177-
return cmd.Run()
177+
err = cmd.Run()
178+
if err != nil {
179+
events.On(errorEvent(config.Name, err.Error()))
180+
return err
181+
}
182+
events.On(api.Resource{
183+
ID: config.Name,
184+
Status: api.Done,
185+
Text: api.StatusConfigured,
186+
})
187+
return nil
178188
}
179189

180190
func (m *modelAPI) SetModelVariables(ctx context.Context, project *types.Project) error {

0 commit comments

Comments
 (0)