Skip to content

Commit fc88014

Browse files
committed
feat: add launch configuration for Go debugging and update job argument in worker
1 parent 2ed77ac commit fc88014

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}"
13+
}
14+
]
15+
}

worker.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func (w *DPromptsWorker) Timeout(job *river.Job[DPromptsJobArgs]) time.Duration
2626
return 5 * time.Minute
2727
}
2828

29-
3029
func (w *DPromptsWorker) Work(ctx context.Context, job *river.Job[DPromptsJobArgs]) error {
3130
log.Info().
3231
Str("job_id", strconv.FormatInt(job.ID, 10)).
@@ -40,8 +39,7 @@ func (w *DPromptsWorker) Work(ctx context.Context, job *river.Job[DPromptsJobArg
4039
}
4140
configPath := homeDir + string(os.PathSeparator) + ".dprompts.toml"
4241

43-
44-
response, err := CallOllama(job.Args.Message, configPath)
42+
response, err := CallOllama(job.Args.Prompt, configPath)
4543
if err != nil {
4644
log.Error().Err(err).Msg("Ollama call failed")
4745
return err
@@ -50,7 +48,6 @@ func (w *DPromptsWorker) Work(ctx context.Context, job *river.Job[DPromptsJobArg
5048
Str("job_id", strconv.FormatInt(job.ID, 10)).
5149
Msg("Ollama call successful, saving to DB")
5250

53-
5451
jsonResponse, err := json.Marshal(map[string]string{"response": response})
5552
if err != nil {
5653
log.Error().Err(err).Msg("Failed to marshal response as JSON")
@@ -67,7 +64,6 @@ func (w *DPromptsWorker) Work(ctx context.Context, job *river.Job[DPromptsJobArg
6764
return err
6865
}
6966

70-
7167
log.Info().
7268
Str("job_id", strconv.FormatInt(job.ID, 10)).
7369
Msg("Job completed and saved")

0 commit comments

Comments
 (0)