Skip to content

utils.js: add date to user prompt - #364

Merged
thypon merged 1 commit into
mainfrom
feature/add-date-to-prompt
Mar 9, 2026
Merged

utils.js: add date to user prompt#364
thypon merged 1 commit into
mainfrom
feature/add-date-to-prompt

Conversation

@thypon

@thypon thypon commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

anthropic debug - [puLL-Merge] - brave/pull-merge@364

Diff
diff --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}`)

Description

This 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 YYYY-MM-DD and inserted into the prompt right after the repository URL line. This provides temporal context to the model processing the PR diff.

Changes

Changes

  • src/utils.js
    • Added a new line that captures the current date as an ISO string truncated to the date portion (YYYY-MM-DD).
    • Modified the userPrompt template string to include a Date: field between the Repository: line and the PR diff block.
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
Loading

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

openai debug - [puLL-Merge] - brave/pull-merge@364

Diff
diff --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}`)

Description

This PR modifies the utils.js file to include the current date in the userPrompt string used in the explainPatchHelper function. This provides additional context by dating the generated prompt, which could be useful for logging, debugging, or other time-sensitive operations.

Possible Issues

None

Security Hotspots

None

Privacy Hotspots

None

Changes

Changes

  • src/utils.js
    • Line 33: Added the declaration of the date variable, which captures the current date in "YYYY-MM-DD" format.
    • Line 34: Updated the userPrompt string to include the Date: ${date} line, giving the prompt additional temporal context.
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
Loading

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

bedrock debug - [puLL-Merge] - brave/pull-merge@364

Diff
diff --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}`)

Description

This PR updates the explainPatchHelper function in src/utils.js to include the current date in the user prompt. The change adds an ISO-formatted date (YYYY-MM-DD) to the prompt that gets sent to the model when explaining a patch.

Changes

Changes

src/utils.js:

  • Added code to get the current date in ISO format (YYYY-MM-DD)
  • Added the date to the user prompt string that is sent to the model when explaining a patch
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
Loading

@thypon
thypon merged commit 5953823 into main Mar 9, 2026
6 of 7 checks passed
@thypon
thypon deleted the feature/add-date-to-prompt branch March 9, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant