utils.js: add date to user prompt - #364
Conversation
|
anthropic debug - [puLL-Merge] - brave/pull-merge@364 Diffdiff --git src/utils.js src/utils.js
index ea52869..f3b2b81 100644
--- src/utils.js
+++ src/utils.js
@@ -32,7 +32,8 @@ export async function explainPatchHelper (patchBody, owner, repo, models, debug,
let model = null
let response = null
- const userPrompt = `Repository: https://github.com/${owner}/${repo}\n\nThis is the PR diff\n\`\`\`\n${patchBody}\n\`\`\``
+ const date = new Date().toISOString().split('T')[0]
+ const userPrompt = `Repository: https://github.com/${owner}/${repo}\nDate: ${date}\n\nThis is the PR diff\n\`\`\`\n${patchBody}\n\`\`\``
if (debug) {
console.log(`user_prompt:\n\n${userPrompt}`)
DescriptionThis PR adds the current date (in ISO format, date-only) to the user prompt that is sent when explaining a patch. The date is formatted as ChangesChanges
sequenceDiagram
participant Caller
participant explainPatchHelper
participant Date as Date API
participant Model as LLM
Caller->>explainPatchHelper: patchBody, owner, repo, models, debug
explainPatchHelper->>Date: new Date().toISOString().split('T')[0]
Date-->>explainPatchHelper: "YYYY-MM-DD"
explainPatchHelper->>explainPatchHelper: Construct userPrompt with repo, date, and diff
explainPatchHelper->>Model: Send prompt
Model-->>explainPatchHelper: Response
explainPatchHelper-->>Caller: Return response
|
|
openai debug - [puLL-Merge] - brave/pull-merge@364 Diffdiff --git src/utils.js src/utils.js
index ea52869..f3b2b81 100644
--- src/utils.js
+++ src/utils.js
@@ -32,7 +32,8 @@ export async function explainPatchHelper (patchBody, owner, repo, models, debug,
let model = null
let response = null
- const userPrompt = `Repository: https://github.com/${owner}/${repo}\n\nThis is the PR diff\n\`\`\`\n${patchBody}\n\`\`\``
+ const date = new Date().toISOString().split('T')[0]
+ const userPrompt = `Repository: https://github.com/${owner}/${repo}\nDate: ${date}\n\nThis is the PR diff\n\`\`\`\n${patchBody}\n\`\`\``
if (debug) {
console.log(`user_prompt:\n\n${userPrompt}`)
DescriptionThis PR modifies the Possible IssuesNone Security HotspotsNone Privacy HotspotsNone ChangesChanges
sequenceDiagram
participant User
participant explainPatchHelper
participant Logger (if debug)
User->>explainPatchHelper: Call explainPatchHelper
explainPatchHelper->>explainPatchHelper: Compute current date
explainPatchHelper->>explainPatchHelper: Format userPrompt including date
alt debug is true
explainPatchHelper->>Logger: Log user_prompt
end
explainPatchHelper->>User: Return response
|
|
bedrock debug - [puLL-Merge] - brave/pull-merge@364 Diffdiff --git src/utils.js src/utils.js
index ea52869..f3b2b81 100644
--- src/utils.js
+++ src/utils.js
@@ -32,7 +32,8 @@ export async function explainPatchHelper (patchBody, owner, repo, models, debug,
let model = null
let response = null
- const userPrompt = `Repository: https://github.com/${owner}/${repo}\n\nThis is the PR diff\n\`\`\`\n${patchBody}\n\`\`\``
+ const date = new Date().toISOString().split('T')[0]
+ const userPrompt = `Repository: https://github.com/${owner}/${repo}\nDate: ${date}\n\nThis is the PR diff\n\`\`\`\n${patchBody}\n\`\`\``
if (debug) {
console.log(`user_prompt:\n\n${userPrompt}`)
DescriptionThis PR updates the ChangesChangessrc/utils.js:
sequenceDiagram
participant App
participant explainPatchHelper
participant Date
participant model
App->>explainPatchHelper: Call with patchBody, owner, repo, models, etc.
explainPatchHelper->>Date: new Date().toISOString()
Date-->>explainPatchHelper: Return ISO date string
explainPatchHelper->>explainPatchHelper: Split date at 'T' and take first part
explainPatchHelper->>explainPatchHelper: Format userPrompt with repository and date
Note over explainPatchHelper: If debug is true
explainPatchHelper->>Console: Log user_prompt
explainPatchHelper->>model: Send formatted prompt with date
model-->>explainPatchHelper: Return response
explainPatchHelper-->>App: Return model response
|
No description provided.