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 / inlineChatEditCodePrompt.tsx 114 строк · изменён 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
import { PromptElement , PromptSizing , SystemMessage , UserMessage } from '@vscode/prompt-tsx' ;
import { ConfigKey , IConfigurationService } from '../../../../platform/configuration/common/configurationService' ;
import { IIgnoreService } from '../../../../platform/ignore/common/ignoreService' ;
import { KnownSources } from '../../../../platform/languageServer/common/languageContextService' ;
import { IParserService } from '../../../../platform/parser/node/parserService'
ignoreCustomInstructions
props
@ _ignoreService
@ _parserService
@ _experimentationService
@ _configurationService
props
state sizing
context
context
languageId
languageId
isIgnored
isIgnored
query history chatVariables
useProjectLabels
data context context
splitDoc splitDoc
splitDoc
line line data
languageId;
import
{ IExperimentationService }
from
'../../../../platform/telemetry/common/nullExperimentationService'
;
import
{ isNotebookCellOrNotebookChatInput }
from
'../../../../util/common/notebooks'
;
import
{ illegalArgument }
from
'../../../../util/vs/base/common/errors'
;
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
{ ProjectLabels }
from
'../panel/projectLabels'
;
import
{ LanguageServerContextPrompt }
from
'./languageServerContextPrompt'
;
import
{ SummarizedDocumentSplit }
from
'./promptingSummarizedDocument'
;
export
interface
InlineChatEditCodePromptProps
extends
GenericInlinePromptProps
{
readonly
?
:
boolean
;
}
export
class
InlineChatEditCodePrompt
extends
PromptElement< InlineChatEditCodePromptProps>
{
constructor
(
:
InlineChatEditCodePromptProps
,
IIgnoreService
private
readonly
:
IIgnoreService
,
IParserService
private
readonly
:
IParserService
,
IExperimentationService
private
readonly
:
IExperimentationService
,
IConfigurationService
private
readonly
:
IConfigurationService
,
)
{
super
(
)
;
}
async
render
(
:
void
,
:
PromptSizing
)
{
const
=
this
.
props
.
documentContext
;
const
document
=
.
document
;
const
=
document
.
languageId
;
if
(
isNotebookCellOrNotebookChatInput
(
document
.
uri
)
)
{
throw
illegalArgument
(
'InlineChatEditCodePrompt should not be used with a notebook!'
)
;
}
if
(
===
'markdown'
)
{
throw
illegalArgument
(
'InlineChatEditCodePrompt should not be used with a markdown document!'
)
;
}
const
=
await
this
.
_ignoreService
.
isCopilotIgnored
(
document
.
uri
)
;
if
(
)
{
return
< ignoredFiles value = { [ document . uri ] } />
;
}
const
{
,
,
,
}
=
this
.
props
.
promptContext
;
const
=
this
.
_configurationService
.
getExperimentBasedConfig
(
ConfigKey
.
Advanced
.
ProjectLabelsInline
,
this
.
_experimentationService
)
;
const
=
await
SummarizedDocumentData
.
create
(
this
.
_parserService
,
document
,
.
fileIndentInfo
,
.
wholeRange
,
SelectionSplitKind
.
Adjusted
)
;
const
replyInterpreterFactory
=
(
:
SummarizedDocumentSplit
)
=>
.
createReplyInterpreter
(
LeadingMarkdownStreaming
.
Mute
,
EarlyStopping
.
StopAfterFirstCodeBlock
,
.
replaceSelectionStreaming
,
TextPieceClassifiers
.
createCodeBlockClassifier
(
)
,
=>
.
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 expert in programming, and especially good at
{
}
.
< br />
< LegacySafetyRules />
</ SystemMessage >
< HistoryWithInstructions inline = { true } historyPriority = { 700 } passPriority history = { history} >
< InstructionMessage priority = { 1000 } >
Source code is always contained in ``` blocks.<br />
The user needs help to modify some code.<br />
{data.hasCodeWithoutSelection && <>The user includes existing code and marks with {data.placeholderText} where the selected code should go.<br /></>}
</InstructionMessage>
</HistoryWithInstructions>
{useProjectLabels && <ProjectLabels priority={600} embeddedInsideUserMessage={false} />}
<UserMessage>
{!this.props.ignoreCustomInstructions && <CustomInstructions priority={725} chatVariables={chatVariables} languageId={languageId} />}
<LanguageServerContextPrompt priority={700} document={document} position={context.selection.start} requestId={this.props.promptContext.requestId} source={KnownSources.chat} />
</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={replyInterpreterFactory}
/>
<Tag name='userPrompt'>
<UserQuery chatVariables={chatVariables} query={query} /><br />
</Tag>
{data.hasCodeWithoutSelection && <>The modified {data.placeholderText} code with ``` is:
</ >
}
</ UserMessage >
</ >
);
}
}