OSSCA: customize prompt & set a completionOptions in Continue

2024. 10. 2. 03:34ยทWhat I Learn

1. Continue์—์„œ completionOption ์„ค์ •ํ•˜๊ธฐ

Continue์—์„œ completionOption ์„ค์ •ํ•˜๋Š” ๋ฐ์—๋Š” 2๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.

1-1. config.json > completionOption

์ „์—ญ์ ์œผ๋กœ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

์—ฌ๊ธฐ์„œ ์„ค์ •ํ•œ completionOption ๊ฐ’๋“ค์€ ๋ชจ๋ธ์— ์ƒ๊ด€์—†์ด Continue์—์„œ ๋ชจ๋“  ์ž‘์—…์— ๋™์ผํ•˜๊ฒŒ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

{
"completionOptions": {
"temperature": 0.7,
"topP": 0.9,
"maxTokens": 150
}
}

1-2. config.json > models > completionOptions

๋ชจ๋“  ๋ชจ๋ธ์— ๋Œ€ํ•œ ๊ธฐ๋ณธ๊ฐ’์ด ์•„๋‹ˆ๋ผ ํŠน์ • ๋ชจ๋ธ์— ๋Œ€ํ•œ ์„ค์ •์„ ๋ณ„๋„๋กœ ์ •์˜ํ•˜๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

e.g., Msty์™€ gpt-4o-mini์— ๊ฐ๊ฐ ๋‹ค๋ฅธ completionOptions ์„ค์ •์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ๋‹ค.

{
"models": [
{
"title": "Msty",
"provider": "msty",
"model": "deepseek-coder:6.7b",
"completionOptions": {
"temperature": 0.9,
"topP": 0.7,
"maxTokens": 100
}
},
{
"title": "GPT-4o Mini",
"provider": "openai",
"model": "gpt-4o-mini",
"completionOptions": {
"temperature": 0.6,
"topP": 0.8,
"maxTokens": 200
}
},
]
}

1-3. completionOptions

completionOptions๋Š” AI ๋ชจ๋ธ์ด ํ…์ŠคํŠธ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์ƒ์„ฑํ•  ํ…์ŠคํŠธ์˜ ์ฐฝ์˜์„ฑ, ๋‹ค์–‘์„ฑ, ์†๋„ ๋“ฑ์„ ์กฐ์ ˆํ•˜๋Š” ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค.

  • stream: ์ƒ์„ฑ๋œ ํ…์ŠคํŠธ๋ฅผ ํ•œ ๋ฒˆ์— ๋‹ค ์ถœ๋ ฅํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ๋ถ€๋ถ„์ ์œผ๋กœ ์‹ค์‹œ๊ฐ„ ์ŠคํŠธ๋ฆฌ๋ฐ ๋ฐฉ์‹์œผ๋กœ ์ถœ๋ ฅํ•˜๋„๋ก ์„ค์ •ํ•˜๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค. (true ๋˜๋Š” false๋กœ ์„ค์ • O)
  • temperature: ๊ฐ’์ด ๋†’์œผ๋ฉด ๋” ์ฐฝ์˜์ ์ด๊ณ  ์˜ˆ์ธกํ•˜๊ธฐ ์–ด๋ ค์šด ์ถœ๋ ฅ์ด ์ƒ์„ฑ๋˜๊ณ  ๊ฐ’์ด ๋‚ฎ์œผ๋ฉด ๋” ์ผ๊ด€์„ฑ ์žˆ๊ณ  ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค. (๊ฐ’์˜ ๋ฒ”์œ„๋Š” 0~1 ์‚ฌ์ด)
  • topP : ๋ชจ๋ธ์ด ๊ฐ€์žฅ ํ™•๋ฅ ์ด ๋†’์€ ๋ช‡ ๊ฐ€์ง€ ์„ ํƒ์ง€์— ์ง‘์ค‘ํ•˜๊ฒŒ ํ•˜๊ฑฐ๋‚˜, ๊ทธ ์ดํ•˜์˜ ์„ ํƒ์ง€๋ฅผ ๋ฐฐ์ œํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
  • topK: ๋ชจ๋ธ์ด ํ…์ŠคํŠธ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ๋Š” ํ›„๋ณด ํ† ํฐ์˜ ๊ฐœ์ˆ˜๋ฅผ ์ œํ•œํ•ฉ๋‹ˆ๋‹ค.
  • presencePenalty: ํŠน์ • ๋‹จ์–ด๊ฐ€ ์ด๋ฏธ ๋“ฑ์žฅํ–ˆ์„ ๋•Œ, ๋‹ค์‹œ ๊ทธ ๋‹จ์–ด๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋„๋ก ํŒจ๋„ํ‹ฐ๋ฅผ ๋ถ€๊ณผํ•˜๋Š” ์˜ต์…˜์ž…๋‹ˆ๋‹ค. ์ด ์„ค์ •์„ ํ†ตํ•ด ์ƒ์„ฑ๋œ ํ…์ŠคํŠธ์˜ ๋‹ค์–‘์„ฑ์„ ์ฆ๊ฐ€์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ’์ด ๋†’์„์ˆ˜๋ก ๋™์ผํ•œ ๋‹จ์–ด๊ฐ€ ๋ฐ˜๋ณต๋˜์ง€ ์•Š๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • frequencyPenalty: ํŠน์ • ๋‹จ์–ด๋‚˜ ํ† ํฐ์ด ์ž์ฃผ ๋“ฑ์žฅํ•  ๊ฒฝ์šฐ ํŒจ๋„ํ‹ฐ๋ฅผ ๋ถ€๊ณผํ•˜๋Š” ์„ค์ •์ž…๋‹ˆ๋‹ค. presencePenalty์™€ ์œ ์‚ฌํ•˜์ง€๋งŒ, ํŠน์ • ๋‹จ์–ด์˜ ๋“ฑ์žฅ ๋นˆ๋„๋ฅผ ๋‚ฎ์ถ”๋Š” ๋ฐ ์ดˆ์ ์ด ๋งž์ถฐ์ ธ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์„ค์ •์„ ์‚ฌ์šฉํ•˜๋ฉด ์ƒ์„ฑ๋œ ํ…์ŠคํŠธ์—์„œ ํŠน์ • ๋‹จ์–ด๊ฐ€ ์ง€๋‚˜์น˜๊ฒŒ ๋งŽ์ด ๋ฐ˜๋ณต๋˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • mirostat: Mirostat๋Š” ์ƒ์„ฑ๋œ ํ…์ŠคํŠธ์˜ ์•ˆ์ •์„ฑ๊ณผ ๋‹ค์–‘์„ฑ์„ ์กฐ์ •ํ•˜๋Š” ๊ณ ๊ธ‰ ์„ค์ •์ž…๋‹ˆ๋‹ค. Mirostat์€ ํ† ํฐ ์ƒ์„ฑ ์‹œ ์ ์‘ํ˜• ํ”ผ๋“œ๋ฐฑ ๋ฃจํ”„๋ฅผ ํ†ตํ•ด ๋ชจ๋ธ์ด ๋” ์ผ๊ด€๋œ ์‘๋‹ต์„ ์ƒ์„ฑํ•˜๋„๋ก ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค. ์ด ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋ฉด ์ƒ์„ฑ ๊ณผ์ •์—์„œ ๋ชจ๋ธ์ด ์˜ˆ์ธกํ•  ์ˆ˜ ์—†๋Š” ํŒจํ„ด์„ ์ค„์—ฌ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • stop: ํŠน์ • ํ† ํฐ์ด๋‚˜ ๋ฌธ์ž์—ด์ด ์ƒ์„ฑ๋˜๋ฉด ์ถœ๋ ฅ์„ ์ค‘๋‹จํ•˜๋„๋ก ํ•˜๋Š” ์„ค์ •์ž…๋‹ˆ๋‹ค.
  • maxTokens : ์ƒ์„ฑํ•  ์ตœ๋Œ€ ํ† ํฐ ์ˆ˜๋ฅผ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.
  • num_threads: ๋ชจ๋ธ์ด ํ…์ŠคํŠธ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” CPU ์Šค๋ ˆ๋“œ ์ˆ˜๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  • keepAlive : ๋กœ์ปฌ์—์„œ ๋ชจ๋ธ์„ ์‹คํ–‰ํ•  ๋•Œ, ์„ธ์…˜์„ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ์˜ต์…˜์ž…๋‹ˆ๋‹ค. ์ด ์„ค์ •์ด ํ™œ์„ฑํ™”๋˜๋ฉด ๋ชจ๋ธ์ด ์ผ์ • ์‹œ๊ฐ„ ๋™์•ˆ ์œ ํœด ์ƒํƒœ๋กœ ์žˆ๋”๋ผ๋„ ์ข…๋ฃŒ๋˜์ง€ ์•Š๊ณ  ๊ณ„์† ํ™œ์„ฑํ™”๋œ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

 

2. Custom slash commands

2-1. ๋‚ด์žฅ๋œ Slash (/) Command ๋ชฉ๋ก ํ›‘์–ด๋ณด๊ธฐ

Continue๋Š” ๋‹ค์Œ์˜ slashCommand ๋ช…๋ น์–ด๋ฅผ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

  • edit : ์„ ํƒ๋œ ์ฝ”๋“œ ๋ธ”๋Ÿญ์— ์ฃผ์–ด์ง„ ์ž…๋ ฅ์„ ๋ฐ˜์˜ํ•ด์„œ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
  • comment : ์„ ํƒ๋œ ์ฝ”๋“œ ๋ธ”๋Ÿญ์— ์ฃผ์„์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.
  • share : ํ˜„์žฌ Chat Session์„ ๋งˆํฌ๋‹ค์šด์œผ๋กœ ๋‚ด๋ณด๋ƒ…๋‹ˆ๋‹ค.
  • cmd : ์ฃผ์–ด์ง„ ์ž…๋ ฅ์— ๋งž๋Š” cmd ๋ช…๋ น์–ด๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
  • commit : git diff ์ œ๊ณต ์‹œ git commit ๋ฉ”์‹œ์ง€๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
  • http : ์‚ฌ์šฉ์ž ์ •์˜ ์Šฌ๋ž˜์‹œ ๋ช…๋ น์„ ์ž์‹ ์˜ HTTP ์—”๋“œํฌ์ธํŠธ์— ์ž‘์„ฑํ•˜๊ณ , ์„ค์ •ํ•œ ์—”๋“œํฌ์ธํŠธ์— ๋Œ€ํ•œ params ๊ฐ์ฒด์— URL์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  • issue : ์ƒ์„ฑํ•˜๋ ค๋Š” ์ด์Šˆ๋ฅผ ์„ค๋ช…ํ•˜๊ณ  Continue๋ฅผ ํด๋ฆญํ•˜๋ฉด ํฌ๋งท๋œ ์ œ๋ชฉ๊ณผ ๋ณธ๋ฌธ์ด ๋‚˜์˜ค๊ณ , ์ œ์ถœํ•  ์ˆ˜ ์žˆ๋„๋ก ์ดˆ์•ˆ ๋งํฌ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. (์ด์Šˆ๋ฅผ ์ƒ์„ฑํ•˜๋ ค๋Š” repo์˜ URL์„ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.)
  • so: ์งˆ๋ฌธ์— ๋Œ€ํ•œ ๋‹ต๋ณ€์„ StackOverflow์—์„œ ์ž๋™์œผ๋กœ ๋‹ต๋ณ€๊ณผ ๋งํฌ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
  • onBoard: ์ฃผ์š”ํ•œ ํด๋”๋ฅผ ์‹๋ณ„ํ•˜๊ณ , ๊ทธ ๋ชฉ์ ์„ ์„ค๋ช…ํ•˜๊ณ , ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋Š” ํŒจํ‚ค์ง€๋ฅผ ๊ฐ•์กฐํ•ด์„œ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

 

Continue์— ๋‚ด์žฅ๋œ ์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด config.json์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์„ค์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

{
"slashCommands": [
{
"name": "edit",
"description": "Edit selected code"
},
{
"name": "comment",
"description": "Write comments for the selected code"
},
{
"name": "share",
"description": "Export the current chat session to markdown"
},
{
"name": "cmd",
"description": "Generate a shell command"
},
{
"name": "commit",
"description": "Generate a git commit message"
},
{
"name": "http",
"description": "Does something custom",
"params": { "url": "<my server endpoint>" }
},
{
"name": "issue",
"description": "Generate a link to a drafted GitHub issue",
"params": { "repositoryUrl": "https://github.com/continuedev/continue" }
},
{
"name": "so",
"description": "Reference StackOverflow to answer the question"
},
{
"name": "onboard",
"description": "Familiarize yourself with the codebase"
}
]
}

 

์•„๋ž˜๋Š” /edit์™€ /comment์˜ ์‚ฌ์šฉ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

 

/edit

์›ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์งˆ๋ฌธ์— ์ถ”๊ฐ€(cmd + L)ํ•˜๊ณ  /edit ์„ ์‚ฌ์šฉํ•˜๋ฉด "Continue Diff" ๋ผ๋Š” ์ƒˆ๋กœ์šด ์ฐฝ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ช…๋ น์–ด์— ๋”ฐ๋ฅธ ๊ฒฐ๊ณผ๋ฌผ์„ ๋„์ถœํ•ฉ๋‹ˆ๋‹ค.

 

ํ•˜๋‹จ์˜ ๊ทธ๋ฆผ์—์„œ์™€ ๊ฐ™์ด ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ˆ˜๋ฝ ํ˜น์€ ๊ฑฐ์ ˆํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

/comment

ํŠน์ • ์ฝ”๋“œ๋ฅผ ์งˆ๋ฌธ์— ์ถ”๊ฐ€(cmd+L)ํ•˜๊ณ  /comment ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฃผ์„์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ฒฐ๊ณผ๋„ ์ˆ˜๋ฝ ํ˜น์€ ๊ฑฐ์ ˆํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

2-2. .prompt ํŒŒ์ผ

  1. ์›Œํฌ์ŠคํŽ˜์ด์Šค ์ตœ์ƒ๋‹จ์— .prompts/ ํด๋”๋ฅผ ์ง์ ‘ ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜, chat box ๋ฐ‘์˜ Build a custom prompt๋ฅผ ๋ˆ„๋ฅด๋ฉด ์›Œํฌ์ŠคํŽ˜์ด์Šค ์ตœ์ƒ๋‹จ์— .prompts๋ผ๋Š” ํด๋”๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
  2. .prompts ํด๋”์—์„œ ์ƒ์„ฑํ•œ .prompt ํŒŒ์ผ์˜ ์ด๋ฆ„์€ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด์˜ ์ด๋ฆ„์ด ๋ฉ๋‹ˆ๋‹ค.
    ( e.g., test.prompt ⇒ /test )
  3. ํŒŒ์ผ์— ํ”„๋กฌํ”„ํŠธ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋ฉด chat ํ™”๋ฉด์—์„œ ์Šฌ๋ž˜์‹œ(/)+ ํ”„๋กฌํ”„ํŠธํŒŒ์ผ๋ช… + ENTER๋ฅผ ํ†ตํ•ด ํ”„๋กฌํ”„ํŠธ์—์„œ ์ง€์‹œํ•œ ๋‚ด์šฉ์„ ๋”ฐ๋ฅด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ์€ ์ฝ”๋“œ ์ฝ”๋ฉ˜ํŠธ๋ฅผ ์œ„ํ•œ .prompt ํŒŒ์ผ์˜ ์ƒ˜ํ”Œ์ž…๋‹ˆ๋‹ค.

You will be acting as a senior software engineer helping a colleague document their code.

You will follow the guidelines for writing great code comments:
{{{ url "https://stackoverflow.blog/2021/12/23/best-practices-for-writing-code-comments/" }}}
---
Using this information, write a comment for the following code:
{{{ input }}}

.prompt ํŒŒ์ผ์„ ๊ตฌ์„ฑํ•  ํ˜•์‹

** ๊ณต์‹๋ฌธ์„œ์—์„œ ๋‹ค์Œ ํ˜•์‹์€ ์‹คํ—˜์ ์ด๋ฉฐ, ๋ณ€๊ฒฝ๋  ์ˆ˜๋„ ์žˆ๋‹ค๊ณ  ์„ค๋ช…ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

 

System ํƒœ๊ทธ

์‹œ์Šคํ…œ ๋ฉ”์„ธ์ง€๋ฅผ ํ†ตํ•ด ์‹œ์Šคํ…œ์—๊ฒŒ ์—ญํ• ์„ ๋ถ€์—ฌํ•ด์ฃผ๊ณ , ์ง€์‹œ, ์š”๊ตฌ์‚ฌํ•ญ์„ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.

{์‹œ์Šคํ…œ ๋ฉ”์‹œ์ง€ e.g., You will be acting as a senior software engineer ... }

 

์„œ๋ฌธ

temperature: 0.5
maxTokens: 4096
---
// <system>
// You are an expert programmer
// </system>

// ....

 

์„œ๋ฌธ์€ --- ๊ตฌ๋ถ„ ๊ธฐํ˜ธ ์œ„์—์„œ YAML ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•ด์„œ ๋ชจ๋ธ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค๋ฉด --- ๊ตฌ๋ถ„ ๊ธฐํ˜ธ๊นŒ์ง€ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ์ง€์›ํ•˜๋Š” ๋งค๊ฐœ๋ณ€์ˆ˜๋ช…์ž…๋‹ˆ๋‹ค.

  • name
  • temperature
  • topP
  • topK
  • minP
  • presencePenalty
  • frequencyPenalty
  • mirostat
  • stop
  • maxTokens
  • description

๋‚ด์žฅ ๋ณ€์ˆ˜

ํ˜„์žฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๊ธฐ๋ณธ ์ œ๊ณต ๋ณ€์ˆ˜๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • {{{ input }}} : ์Šฌ๋ž˜์‹œ ๋ช…๋ น๊ณผ ํ•จ๊ป˜ ์ „์†ก๋˜๋Š” ์‚ฌ์ด๋“œ๋ฐ”์˜ ์ž…๋ ฅ ์ƒ์ž์˜ ์ „์ฒด ํ…์ŠคํŠธ
  • {{{ currentFile }}} : ํ˜„์žฌ IDE์—์„œ ์—ด๋ ค ์žˆ๋Š” ํŒŒ์ผ
  • {{{ ./path/to/file.js }}} : ๋ชจ๋“  ํŒŒ์ผ์„ ์ง์ ‘ ์ฐธ์กฐ ๊ฐ€๋Šฅ

์•„๋ž˜๋Š” ๊ธฐ๋ณธ ์ œ๊ณต ๋ณ€์ˆ˜๋ฅผ ํ†ตํ•ด ํŒŒ์ผ์„ ์ฐธ์กฐํ•˜๋Š” ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

You are a senior ruby on rails giving expert advice.


Here is a summary of the provided Rails application:
Gemfile: {{{ ./Gemfile }}}
Schema: {{{ ./db/schema.rb }}}
---
Here is the question / code to give expert advice on.
{{{ input }}}

 

Context Provider

Config.json์— ์ถ”๊ฐ€ํ•œ ๋ชจ๋“  ์ปจํ…์ŠคํŠธ ๊ณต๊ธ‰์ž๋Š” ์ปจํ…์ŠคํŠธ ๊ณต๊ธ‰์ž์˜ ์ด๋ฆ„์„ ์‚ฌ์šฉํ•˜์—ฌ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž…๋ ฅ์„ ๋ฐ›๋Š” ์ปจํ…์ŠคํŠธ ๊ณต๊ธ‰์ž๋„ ์ง€์›๋ฉ๋‹ˆ๋‹ค.

  • {{{ terminal }}} : ๋‹จ๋ง๊ธฐ์˜ ๋‚ด์šฉ
  • {{{ url "https://github.com/continuedev/continue" }}} : URL์˜ ๋‚ด์šฉ

์•„๋ž˜๋Š” Context Provider์˜ ์ด๋ฆ„์„ ํ†ตํ•ด Context๋ฅผ ์ฐธ์กฐํ•˜๋Š” ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

You will be acting as a senior software engineer helping to debug
a terminal error.

Here is the error that the user received:
{{{ terminal }}}
Here is the documentation for Jest that you will use to help
the user troubleshoot the error:
{{{ docs "https://jestjs.io/docs/getting-started" }}}

 

2-3. ์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด๋ฅผ ์ปค์Šคํ…€ํ•˜๋Š” ๋ฒ•

 

์œ„์™€ ๊ฐ™์€ ๋‚ด์žฅ ์Šฌ๋ž˜์‹œ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒŒ ์•„๋‹ˆ๋ผ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ปค์Šคํ…€ํ•˜์—ฌ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ์ž ์ •์˜ ์Šฌ๋ž˜์‹œ ๋ช…๋ น์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‘ ๊ฐ€์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ์ž์—ฐ์–ด ํ”„๋กฌํ”„ํŠธ (customCommands ์†์„ฑ, config.json)
  • ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•ด ํ”„๋กฌํ”„ํŠธ (slashCommands ์†์„ฑ, config.ts)

customCommands(config.json)

config.json ํŒŒ์ผ์— customCommands ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์œผ๋กœ slash commands๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • name : ์Šฌ๋ž˜์‹œ ๋ช…๋ น์„ ํ˜ธ์ถœํ•˜๋Š” ๋ฐ ์ž…๋ ฅํ•  ์ด๋ฆ„
  • description : ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด์— ํ‘œ์‹œ๋˜๋Š” ์„ค๋ช…
  • prompt : Handlebars ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•œ ํ…œํ”Œ๋ฆฟ ์ž‘์„ฑ์„ ์ง€์›
  • input : ์Šฌ๋ž˜์‹œ ๋ช…๋ น์œผ๋กœ ์ž…๋ ฅํ•œ ์ถ”๊ฐ€ ์ž…๋ ฅ. ์˜ˆ๋ฅผ ๋“ค์–ด, ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด /test only write one test. input์—ฌ๊ธฐ only write one test์—๋Š” ๊ฐ•์กฐ ํ‘œ์‹œ๋œ ์ฝ”๋“œ ๋ธ”๋ก๋„ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
  • file name: ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋‚˜ ํ˜„์žฌ ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•œ ์ƒ๋Œ€ ๊ฒฝ๋กœ๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๋ชจ๋“  ํŒŒ์ผ์„ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ์˜ˆ์‹œ๋ฅผ ๋ณด๋ฉด ์ž์—ฐ์–ด๋กœ ์ž‘์„ฑ๋œ ๋ช…๋ น์–ด๋ฅผ ์ •์˜ํ•˜๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

customCommands=[{
"name": "check",
"description": "Check for mistakes in my code",
"prompt": "{{{ input }}}\n\nPlease read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found."
}]

์‚ฌ์šฉ์ž ์ง€์ • ๋ช…๋ น์€ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž์ฃผ ์žฌ์‚ฌ์šฉํ•  ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

 

Custom Slash Commands(config.ts)

 

customCommands๋กœ ์‚ฌ์šฉ์ž ์ง€์ • ๋ช…๋ น์„ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ํ•œ ๋‹จ๊ณ„ ๋” ๋‚˜์•„๊ฐ€๋ ค๋ฉด ์‘๋‹ต์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ์‚ฌ์šฉ์ž ์ง€์ • ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋ฅผ ์œ„ํ•ด์„œ๋Š” config.json ๋Œ€์‹  config.ts๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š”๋ฐ, ์ด๊ณณ์—์„œ slashCommands ๋ฐฐ์—ด์— ์ƒˆ๋กœ์šด slashCommand ๊ฐ์ฒด๋ฅผ slashCommands ๋ฐฐ์—ด์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

 

slashCommand ๊ฐ์ฒด์— ํ•„์š”ํ•œ ํ•ญ๋ชฉ

  • name : ์Šฌ๋ž˜์‹œ ๋ช…๋ น์„ ํ˜ธ์ถœํ•˜๋Š” ๋ฐ ์ž…๋ ฅํ•  ์ด๋ฆ„
  • description : ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด์— ํ‘œ์‹œ๋˜๋Š” ์„ค๋ช…

 

๋‹ค์Œ ์˜ˆ์‹œ๋ฅผ ๋ณด๋ฉด ์•Œ ์ˆ˜ ์žˆ๋“ฏ์ด, ์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ๋ช…๋ น์„ ์ •์˜ํ•˜๊ณ  ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. TS/JS ์ฝ”๋“œ๋กœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•˜๊ณ , ํŠน์ • ๋ช…๋ น์–ด(name)๊ฐ€ ์ž…๋ ฅ๋˜๋ฉด ํ•ด๋‹น ํ•จ์ˆ˜๊ฐ€ ์‹คํ–‰๋˜๋„๋ก ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

export function modifyConfig(config: Config): Config {
config.slashCommands?.push({
name: "commit",
description: "Write a commit message",
run: async function* (sdk) {
const diff = await sdk.ide.getDiff();
for await (const message of sdk.llm.streamComplete(
`${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`,
{
maxTokens: 20,
}
)) {
yield message;
}
},
});
return config;
}

 

์—ฌ๊ธฐ์„œ run์€ ๋น„๋™๊ธฐ ์ œ๋„ˆ๋ ˆ์ดํ„ฐ๋กœ, ๋ช…๋ น์–ด ์‹คํ–‰ ์ค‘ ์‹ค์‹œ๊ฐ„์œผ๋กœ ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ฒฐ๊ณผ๋ฅผ ์ŠคํŠธ๋ฆผ ํ˜•ํƒœ๋กœ UI์— ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ContinueSDK์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ํ™•์žฅ๋œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

'What I Learn' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

next-auth๋ฅผ ์‚ฌ์šฉํ•œ ์นด์นด์˜ค ๋กœ๊ทธ์ธ  (4) 2024.10.22
exclude a page from next.js root layout  (0) 2024.10.16
OSSCA : setting the Continue at vscode & Overview  (0) 2024.09.23
์ „์—ญ์—์„œ ๋ชจ๋‹ฌ ์ƒํƒœ๊ด€๋ฆฌํ•˜๊ธฐ (redux-toolkit)  (1) 2024.09.20
์‚ฌ์šฉ์ž ์ •์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ ๋ณ„์ด ๋ฐ˜์งโœจ๋ฐฐ๊ฒฝ ๋งŒ๋“ค๊ธฐ (tailwindCSS)  (1) 2024.09.14
'What I Learn' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
  • next-auth๋ฅผ ์‚ฌ์šฉํ•œ ์นด์นด์˜ค ๋กœ๊ทธ์ธ
  • exclude a page from next.js root layout
  • OSSCA : setting the Continue at vscode & Overview
  • ์ „์—ญ์—์„œ ๋ชจ๋‹ฌ ์ƒํƒœ๊ด€๋ฆฌํ•˜๊ธฐ (redux-toolkit)
nuew
nuew
๐Ÿคธ ์žฌ์ฃผ ๋„˜๋Š” ์ค‘
  • nuew
    bloggg. . .๐Ÿฆ–๐Ÿ’ฅ
    nuew
  • ์ „์ฒด
    ์˜ค๋Š˜
    ์–ด์ œ
    • ๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (88)
      • issue (10)
      • baekjoon (41)
      • lecture recap (11)
      • What I Learn (26)
      • retrospective (0)
      • maeil-mail (0)
  • ๋ธ”๋กœ๊ทธ ๋ฉ”๋‰ด

    • ํ™ˆ
    • ํƒœ๊ทธ
    • ๋ฐฉ๋ช…๋ก
  • ๋งํฌ

  • ๊ณต์ง€์‚ฌํ•ญ

  • ์ธ๊ธฐ ๊ธ€

  • ํƒœ๊ทธ

    ํ•œ์ž…ํฌ๊ธฐ๋กœ์ž˜๋ผ๋จน๋Š”ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ
    zustand
    ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ
    TypeScript
    ์ฝ”๋”ฉํ…Œ์ŠคํŠธ
    Baekjoon
    modal
    what i learn
    TailwindCSS
    ๋ฐฑ์ค€
    Algorithm
    ํ•œ์ž…ํฌ๊ธฐ๋กœ ์ž˜๋ผ๋จน๋Š” ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ
    Node.js
    JavaScript
    Study
    ์•Œ๊ณ ๋ฆฌ์ฆ˜
    issue
    js
    css
    media-query
  • ์ตœ๊ทผ ๋Œ“๊ธ€

  • ์ตœ๊ทผ ๊ธ€

  • hELLOยท Designed By์ •์ƒ์šฐ.v4.10.3
nuew
OSSCA: customize prompt & set a completionOptions in Continue
์ƒ๋‹จ์œผ๋กœ

ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”