1212 * @param {string } userRequest - ์ฌ์ฉ์์ ๊ตฌ์ฒด์ ์ธ ์์ฒญ (์ ํ์ฌํญ)
1313 * @returns {Promise<string> } AI๊ฐ ์์ฑํ ๋ฆฌ๋ทฐ ๋๊ธ (๋งํฌ๋ค์ด)
1414 */
15- export async function generateCodeReview ( prDiff , prTitle , prBody , apiKey , userRequest = null ) {
16- const systemPrompt = `๋น์ ์ ๋ฆฌํธ์ฝ๋ ์คํฐ๋ ๊ทธ๋ฃน์ AI ์ฝ์น์
๋๋ค.
15+ export async function generateCodeReview (
16+ prDiff ,
17+ prTitle ,
18+ prBody ,
19+ apiKey ,
20+ userRequest = null
21+ ) {
22+ // userRequest๊ฐ ์์ผ๋ฉด Q&A ๋ชจ๋, ์์ผ๋ฉด ์ ์ฒด ๋ฆฌ๋ทฐ ๋ชจ๋
23+ const systemPrompt = userRequest
24+ ? `๋น์ ์ ๋ฆฌํธ์ฝ๋ ์คํฐ๋ ๊ทธ๋ฃน์ AI ์ฝ์น์
๋๋ค.
25+ ์ฌ์ฉ์๊ฐ PR์ ์ฝ๋์ ๋ํด ๊ตฌ์ฒด์ ์ธ ์ง๋ฌธ์ ํ์ต๋๋ค.
26+ PR์ ์ฝ๋ ๋ณ๊ฒฝ ์ฌํญ์ ์ฐธ๊ณ ํ์ฌ ์ฌ์ฉ์์ ์ง๋ฌธ์ ๋ช
ํํ๊ณ ๋์์ด ๋๋ ๋ต๋ณ์ ์ ๊ณตํ์ธ์.
27+
28+ ๋ต๋ณ ์:
29+ โข ์ฌ์ฉ์์ ์ง๋ฌธ์ ์ง์ ์ ์ผ๋ก ๋ต๋ณํ์ธ์
30+ โข ์ฝ๋์ ํด๋น ๋ถ๋ถ์ ๊ตฌ์ฒด์ ์ผ๋ก ์ธ๊ธํ์ธ์
31+ โข ํ์ํ๋ฉด ์์๋ ๊ฐ์ ๋ฐฉ๋ฒ์ ์ ์ํ์ธ์
32+ โข ๊ฒฉ๋ ค์ ํ์ต์ด ๋๋ ํผ๋๋ฐฑ์ ํจ๊ป ์ฃผ์ธ์
33+
34+ 300 ๊ธ์๋ฅผ ์ด๊ณผํ์ง ๋ง์์ฃผ์ธ์.`
35+ : `๋น์ ์ ๋ฆฌํธ์ฝ๋ ์คํฐ๋ ๊ทธ๋ฃน์ AI ์ฝ์น์
๋๋ค.
1736์๋ ์ฝ๋ ๋ณ๊ฒฝ ์ฌํญ์ ๋ฆฌ๋ทฐํ๊ณ ๊ฑด์ค์ ์ธ ํผ๋๋ฐฑ์ ์ ๊ณตํ์ธ์.
1837
1938๋ฆฌ๋ทฐ ์ ์๋ ํญ๋ชฉ์ ์ง์คํฉ๋๋ค:
@@ -23,27 +42,27 @@ export async function generateCodeReview(prDiff, prTitle, prBody, apiKey, userRe
2342 โข ์ฝ๋์ ๊ฐ๋
์ฑ ๋ฐ ์คํ์ผ, ๋ฒ ์คํธ ํ๋ํฐ์ค ์ค์ ์ฌ๋ถ
2443 โข ์ ์ฌ์ ์ธ ๋ฒ๊ทธ ๋๋ ๊ฐ์ ๊ฐ๋ฅ์ฑ
2544
26- ๋จ์ํ ์ง์ ๋ง ํ์ง ๋ง๊ณ , ๊ฒฉ๋ ค์ ํ์ต์ด ๋๋ ํผ๋๋ฐฑ์ ํจ๊ป ์ฃผ์ธ์.
45+ ๋จ์ํ ์ง์ ๋ง ํ์ง ๋ง๊ณ , ๊ฒฉ๋ ค์ ํ์ต์ด ๋๋ ํผ๋๋ฐฑ์ ํจ๊ป ์ฃผ์ธ์.
2746ํด๋น ์ฌํญ์๋ ํญ๋ชฉ์ ์๋ตํ๊ณ ์์ฐ์ค๋ฝ๊ฒ ์์ฑํ์ธ์.
2847300 ๊ธ์๋ฅผ ์ด๊ณผํ์ง ๋ง์์ฃผ์ธ์.
2948` ;
3049
31- let userPrompt = `# PR Title
50+ let userPrompt = `# PR ์ ๋ชฉ
3251${ prTitle }
3352
34- # PR Description
35- ${ prBody || "No description provided " }
53+ # PR ์ค๋ช
54+ ${ prBody || "์ค๋ช
์์ " }
3655
37- # Code Changes
56+ # ์ฝ๋ ๋ณ๊ฒฝ์ฌํญ
3857\`\`\`diff
3958${ prDiff }
4059\`\`\`
4160` ;
4261
4362 if ( userRequest ) {
44- userPrompt += `\n# User's Specific Request \n${ userRequest } \n\nPlease review this pull request, focusing on the user's specific request. ` ;
63+ userPrompt += `\n# ์ฌ์ฉ์ ์ง๋ฌธ \n${ userRequest } ` ;
4564 } else {
46- userPrompt += `\nPlease review this pull request .` ;
65+ userPrompt += `\n์ด PR์ ๋ฆฌ๋ทฐํด์ฃผ์ธ์ .` ;
4766 }
4867
4968 const response = await fetch ( "https://api.openai.com/v1/chat/completions" , {
0 commit comments