mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-24 23:13:35 +08:00
fix: use toDateString() instead of toISOString() in system prompt to preserve caching
The editor context change in PR #6151 switched from Today's date (toDateString) to Current time (toISOString), which breaks prompt caching because the system prompt now changes every second instead of once per day. This changes it back to date-only format while keeping all other editor context improvements.
This commit is contained in:
@@ -6,9 +6,9 @@ export interface EditorContext {
|
||||
timezone?: string
|
||||
}
|
||||
|
||||
function formatTime(timezone?: string): string[] {
|
||||
function formatDate(timezone?: string): string[] {
|
||||
const now = new Date()
|
||||
const lines = [` Current time: ${now.toISOString()}`]
|
||||
const lines = [` Today's date: ${now.toDateString()}`]
|
||||
if (timezone) {
|
||||
const offset = -now.getTimezoneOffset()
|
||||
const sign = offset >= 0 ? "+" : "-"
|
||||
@@ -24,7 +24,7 @@ function formatTime(timezone?: string): string[] {
|
||||
* Returns an array of pre-formatted ` key: value` strings.
|
||||
*/
|
||||
export function editorContextEnvLines(ctx?: EditorContext): string[] {
|
||||
const lines = formatTime(ctx?.timezone)
|
||||
const lines = formatDate(ctx?.timezone)
|
||||
if (ctx?.shell) {
|
||||
lines.push(` Default shell: ${ctx.shell}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user