-
Notifications
You must be signed in to change notification settings - Fork 0
[#47] AI가 branch 조합의 충돌 해결 코드와 작업 순서를 제안한다 #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8da0c04
feat: branch 조합 상태별 AI prompt 구성
opficdev 553409d
feat: branch 조합별 OpenAI 응답 schema 추가
opficdev cb56613
feat: branch 조합 AI 응답 검증 추가
opficdev accda50
feat: branch 조합별 AI prediction 실행
opficdev 79e262f
fix: branch 조합 prompt의 순서 보존 지침 추가
opficdev a5f70cb
fix: AI 응답 식별자 공백 정규화
opficdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { | ||
| DEFAULT_AI_CLEAN_OVERLAP_SYSTEM_PROMPT, | ||
| DEFAULT_AI_CONFIRMED_CONFLICT_SYSTEM_PROMPT | ||
| } from "./predictionPairPromptTemplates.js" | ||
| import type { | ||
| AiPredictionPairEvidencePayload, | ||
| AiPredictionPrompt, | ||
| AiPredictionPromptBuildOptions | ||
| } from "./types.js" | ||
|
|
||
| // branch 조합의 deterministic 상태에 맞는 전용 prompt 구성 | ||
| export function build( | ||
| payload: AiPredictionPairEvidencePayload, | ||
| options: AiPredictionPromptBuildOptions = {} | ||
| ): AiPredictionPrompt { | ||
| const confirmedConflict = payload.targetStatus === "confirmed_conflict" | ||
|
|
||
| return { | ||
| systemPrompt: options.systemPrompt ?? (confirmedConflict | ||
| ? DEFAULT_AI_CONFIRMED_CONFLICT_SYSTEM_PROMPT | ||
| : DEFAULT_AI_CLEAN_OVERLAP_SYSTEM_PROMPT), | ||
| userPrompt: JSON.stringify(payload, null, 2), | ||
| responseShape: confirmedConflict | ||
| ? "predictionPairConfirmedConflict" | ||
| : "predictionPairCleanOverlap" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| // 확정 conflict의 원인, 반영 순서, 구체적인 patch를 요청하는 system prompt | ||
| export const DEFAULT_AI_CONFIRMED_CONFLICT_SYSTEM_PROMPT = [ | ||
| "You are Watcher's confirmed merge conflict resolution assistant.", | ||
| "Use only the provided branch pair evidence and code context.", | ||
| "Preserve the exact 'leftBranchName' and 'rightBranchName' from the input in the 'pair' object without swapping them.", | ||
| "Do not recalculate or overwrite the deterministic merge status or graph reasons.", | ||
| "Explain the confirmed conflict cause from the provided code only.", | ||
| "Recommend a merge or rebase order using only the two provided branch names.", | ||
| "Provide at least one concrete patch for files present in the evidence.", | ||
| "Do not invent APIs, files, behavior, or code outside the provided context.", | ||
| "Do not apply any patch or describe a patch as already applied.", | ||
| "Write summaries, reasons, steps, and patch reasons in Korean.", | ||
| "Return only JSON with this shape:", | ||
| "{", | ||
| " \"kind\": \"confirmed_conflict\",", | ||
| " \"pair\": {", | ||
| " \"leftBranchName\": string,", | ||
| " \"rightBranchName\": string", | ||
| " },", | ||
| " \"conflictCause\": {", | ||
| " \"summary\": string,", | ||
| " \"files\": string[]", | ||
| " },", | ||
| " \"integrationOrder\": {", | ||
| " \"strategy\": \"merge\" | \"rebase\",", | ||
| " \"firstBranchName\": string,", | ||
| " \"secondBranchName\": string,", | ||
| " \"reason\": string,", | ||
| " \"steps\": string[]", | ||
| " },", | ||
| " \"patches\": [{", | ||
| " \"filePath\": string,", | ||
| " \"patch\": string,", | ||
| " \"reason\": string", | ||
| " }]", | ||
| "}" | ||
| ].join("\n") | ||
|
|
||
| // clean overlap을 conflict로 단정하지 않고 예방 조치를 요청하는 system prompt | ||
| export const DEFAULT_AI_CLEAN_OVERLAP_SYSTEM_PROMPT = [ | ||
| "You are Watcher's clean merge overlap prevention assistant.", | ||
| "Use only the provided branch pair evidence and code context.", | ||
| "Preserve the exact 'leftBranchName' and 'rightBranchName' from the input in the 'pair' object without swapping them.", | ||
| "The provided merge status is clean and is not a confirmed conflict.", | ||
| "Do not recalculate or overwrite the deterministic merge status or graph reasons.", | ||
| "Do not claim that a conflict exists or will occur.", | ||
| "Explain only the potential interaction visible in the provided code.", | ||
| "Recommend a merge or rebase order using only the two provided branch names.", | ||
| "Provide at least one preventive action and do not provide patches.", | ||
| "Do not invent APIs, files, behavior, or code outside the provided context.", | ||
| "Write summaries, reasons, steps, titles, and descriptions in Korean.", | ||
| "Return only JSON with this shape:", | ||
|
opficdev marked this conversation as resolved.
|
||
| "{", | ||
| " \"kind\": \"clean_overlap\",", | ||
| " \"pair\": {", | ||
| " \"leftBranchName\": string,", | ||
| " \"rightBranchName\": string", | ||
| " },", | ||
| " \"overlapCause\": {", | ||
| " \"summary\": string,", | ||
| " \"files\": string[]", | ||
| " },", | ||
| " \"integrationOrder\": {", | ||
| " \"strategy\": \"merge\" | \"rebase\",", | ||
| " \"firstBranchName\": string,", | ||
| " \"secondBranchName\": string,", | ||
| " \"reason\": string,", | ||
| " \"steps\": string[]", | ||
| " },", | ||
| " \"preventiveActions\": [{", | ||
| " \"title\": string,", | ||
| " \"description\": string,", | ||
| " \"files\": string[]", | ||
| " }]", | ||
| "}" | ||
| ].join("\n") | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.