ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / prompts / node / inline / inlineChatGenerateMarkdownPrompt.tsx 135 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import { PromptElement , PromptElementProps , PromptReference , PromptSizing , SystemMessage , TextChunk , UserMessage } from '@vscode/prompt-tsx' ;
import type * as vscode from 'vscode' ;
import { IIgnoreService } from '../../../../platform/ignore/common/ignoreService' ;
import { isNotebookCellOrNotebookChatInput } from '../../../../util/common/notebooks' ;
import { illegalArgument } from
props
@ _ignoreService
@ _instantiationService
props
state sizing
context
context
languageId
languageId
isIgnored context
isIgnored
query history chatVariables
data
context
context
context
splitDoc splitDoc
splitDoc
line line data
data data data data data data data
uri vscode
code
references
state
isIgnored
isIgnored
fence
code
code
'../../../../util/vs/base/common/errors'
;
import
{ IInstantiationService }
from
'../../../../util/vs/platform/instantiation/common/instantiation'
;
import
{ GenericInlinePromptProps }
from
'../../../context/node/resolvers/genericInlineIntentInvocation'
;
import
{ SelectionSplitKind , SummarizedDocumentData , SummarizedDocumentWithSelection }
from
'../../../intents/node/testIntent/summarizedDocumentWithSelection'
;
import
{ EarlyStopping , LeadingMarkdownStreaming }
from
'../../../prompt/node/intents'
;
import
{ TextPieceClassifiers }
from
'../../../prompt/node/streamingEdits'
;
import
{ InstructionMessage }
from
'../base/instructionMessage'
;
import
{ LegacySafetyRules }
from
'../base/safetyRules'
;
import
{ Tag }
from
'../base/tag'
;
import
{ ChatToolReferences , ChatVariables , UserQuery }
from
'../panel/chatVariables'
;
import
{ HistoryWithInstructions }
from
'../panel/conversationHistory'
;
import
{ CustomInstructions }
from
'../panel/customInstructions'
;
import
{ SafePromptElement }
from
'../panel/safeElements'
;
import
{ SummarizedDocumentSplit }
from
'./promptingSummarizedDocument'
;
export
interface
InlineChatGenerateMarkdownPromptProps
extends
GenericInlinePromptProps
{
}
export
class
InlineChatGenerateMarkdownPrompt
extends
PromptElement< InlineChatGenerateMarkdownPromptProps>
{
constructor
(
:
InlineChatGenerateMarkdownPromptProps
,
IIgnoreService
private
readonly
:
IIgnoreService
,
IInstantiationService
private
readonly
:
IInstantiationService
,
)
{
super
(
)
;
}
async
render
(
:
void
,
:
PromptSizing
)
{
const
=
this
.
props
.
documentContext
;
const
document
=
.
document
;
const
=
document
.
languageId
;
if
(
isNotebookCellOrNotebookChatInput
(
this
.
props
.
documentContext
.
document
.
uri
)
)
{
throw
illegalArgument
(
'InlineChatGenerateMarkdownPrompt should not be used with a notebook!'
)
;
}
if
(
!==
'markdown'
)
{
throw
illegalArgument
(
'InlineChatGenerateMarkdownPrompt should only be used with markdown documents!'
)
;
}
const
=
await
this
.
_ignoreService
.
isCopilotIgnored
(
.
document
.
uri
)
;
if
(
)
{
return
< ignoredFiles value = { [ this . props . documentContext . document . uri ] } />
;
}
const
{
,
,
,
}
=
this
.
props
.
promptContext
;
const
=
await
this
.
_instantiationService
.
invokeFunction
(
SummarizedDocumentData
.
create
,
.
document
,
.
fileIndentInfo
,
.
wholeRange
,
SelectionSplitKind
.
OriginalEnd
)
;
const
replyInterpreterFn
=
(
:
SummarizedDocumentSplit
)
=>
.
createReplyInterpreter
(
LeadingMarkdownStreaming
.
Mute
,
EarlyStopping
.
None
,
.
insertStreaming
,
TextPieceClassifiers
.
createFencedBlockClassifier
(
MarkdownBlock
.
FenceSequence
)
,
=>
.
value
.
trim
(
)
!==
.
placeholderText
)
;
return
(
< >
{
}
< SystemMessage priority = { 1000 } >
You are an AI programming assistant.
< br />
When asked for your name, you must respond with "GitHub Copilot".
< br />
You are a world class markdown editor, very well versed in programming.
< br />
< LegacySafetyRules />
</ SystemMessage >
< HistoryWithInstructions inline = { true } historyPriority = { 700 } passPriority history = { history} >
< InstructionMessage priority = { 1000 } >
The user needs help to write some new markdown.
< br />
The markdown is always delimited by
{
MarkdownBlock
.
FenceSequence
}
.
< br />
{
.
hasContent
&&
< >
The user includes existing markdown and marks with
{
.
placeholderText
}
where the new code should go.
< br />
</ >
}
{
.
hasContent
&&
< >
DO NOT include the text "{data.placeholderText}" in your reply.
< br />
</ >
}
{
.
hasContent
&&
< >
DO NOT repeat any markdown from the user in your reply.
< br />
</ >
}
{
!
.
hasContent
&&
< >
Your answer must begin and end with
{
MarkdownBlock
.
FenceSequence
}
< br />
</ >
}
</ InstructionMessage >
</ HistoryWithInstructions >
< UserMessage priority = { 725 } >
< CustomInstructions languageId = { languageId} chatVariables = { chatVariables} />
</ UserMessage >
< ChatToolReferences priority = { 750 } promptContext = { this . props . promptContext } flexGrow = { 1 } embeddedInsideUserMessage = { false } />
< ChatVariables priority = { 750 } chatVariables = { chatVariables} embeddedInsideUserMessage = { false } />
< UserMessage priority = { 900 } flexGrow = { 2 } flexReserve = { sizing. endpoint . modelMaxPromptTokens / 3 } >
< SummarizedDocumentWithSelection
flexGrow = { 1 }
tokenBudget = { 'usePromptSizingBudget' }
documentData = { data}
createReplyInterpreter = { replyInterpreterFn}
/>
< Tag name = ' userPrompt' >
< UserQuery chatVariables = { chatVariables} query = { query} />
<br />
</ Tag >
{
.
hasContent
&&
< >
Remember to start and end your answer with
{
MarkdownBlock
.
FenceSequence
}
. The markdown that would fit at
{
.
placeholderText
}
is:
</ >
}
</ UserMessage >
</ >
)
;
}
}
export
type
MarkdownBlockProps
=
PromptElementProps
<
{
:
.
Uri
|
null
;
:
string
;
?
:
PromptReference
[
]
;
}
>
;
export
class
MarkdownBlock
extends
SafePromptElement< MarkdownBlockProps>
{
public
static
FenceSequence
=
` -+-+-+-+-+ `
;
async
render
(
:
void
)
{
const
=
this
.
props
.
uri
?
await
this
.
_ignoreService
.
isCopilotIgnored
(
this
.
props
.
uri
)
:
false
;
if
(
)
{
return
this
.
_handleFoulPrompt
(
)
;
}
const
=
MarkdownBlock
.
FenceSequence
;
const
=
` ${ fence} \n ${ this . props. code} \n ${ fence} `
;
return
< TextChunk >
{
}
</ TextChunk >
;
}
}