Skip to content

Commit 0bb0ba5

Browse files
committed
Add AI content and proposed content tracking to file state objects across conflict and truncated handlers
1 parent 1d80ccc commit 0bb0ba5

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎apps/editor/src/commands/apply-chat-response-command/handlers/conflict-markers-handler.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ export const handle_conflict_markers = async (
140140
file_path: file.file_path,
141141
content: rename_source_content,
142142
workspace_name: file.workspace_name,
143-
file_path_to_restore: file.renamed_from
143+
file_path_to_restore: file.renamed_from,
144+
ai_content: file.content,
145+
proposed_content: new_content
144146
})
145147
} catch (error) {
146148
failed_files.push(file)
@@ -164,7 +166,9 @@ export const handle_conflict_markers = async (
164166
original_states.push({
165167
file_path: file.file_path,
166168
content: original_content,
167-
workspace_name: file.workspace_name
169+
workspace_name: file.workspace_name,
170+
ai_content: file.content,
171+
proposed_content: current_content
168172
})
169173

170174
Logger.info({
@@ -205,7 +209,8 @@ export const handle_conflict_markers = async (
205209
file_path: file.file_path,
206210
content: '',
207211
file_state: 'new',
208-
workspace_name: file.workspace_name
212+
workspace_name: file.workspace_name,
213+
proposed_content: content_to_write
209214
})
210215
} catch (error) {
211216
failed_files.push(file)
@@ -237,7 +242,9 @@ export const handle_conflict_markers = async (
237242
original_states.push({
238243
file_path: file.file_path,
239244
content: original_content,
240-
workspace_name: file.workspace_name
245+
workspace_name: file.workspace_name,
246+
ai_content: file.content,
247+
proposed_content: final_content
241248
})
242249
} catch (error: any) {
243250
Logger.error({

‎apps/editor/src/commands/apply-chat-response-command/handlers/truncated-handler.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ export const handle_truncated_edit = async (
104104
original_states.push({
105105
file_path: file.file_path,
106106
content: original_content,
107-
workspace_name: file.workspace_name
107+
workspace_name: file.workspace_name,
108+
ai_content: file.content,
109+
proposed_content: new_content
108110
})
109111

110112
Logger.info({

‎apps/editor/src/commands/apply-chat-response-command/response-processor.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ export const process_chat_response = async (
251251
if (result.diff_application_method && result.original_states) {
252252
for (const state of result.original_states) {
253253
state.diff_application_method = result.diff_application_method
254-
if (result.diff_application_method == 'search_and_replace') {
255-
state.ai_content = patch.content
256-
}
254+
state.ai_content = patch.content
257255
}
258256
}
259257
if (result.original_states) {

0 commit comments

Comments
 (0)