Skip to content

Commit fb038a0

Browse files
committed
Fix prompt tsx
1 parent f6b1318 commit fb038a0

1 file changed

Lines changed: 30 additions & 18 deletions

File tree

src/lm/participantsPrompt.tsx

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,41 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { AssistantMessage, BasePromptElementProps, PromptElement, UserMessage } from '@vscode/prompt-tsx';
6+
import { AssistantMessage, BasePromptElementProps, Chunk, PromptElement, PromptPiece, PromptSizing, UserMessage } from '@vscode/prompt-tsx';
77

88
interface ParticipantsPromptProps extends BasePromptElementProps {
99
readonly userMessage: string;
1010
}
1111

1212
export class ParticipantsPrompt extends PromptElement<ParticipantsPromptProps> {
13-
render() {
14-
return (
15-
<>
16-
<AssistantMessage>
17-
Instructions:<br />
18-
- The user will ask a question related to GitHub, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user's question.<br />
19-
- If you aren't sure which tool is relevant, you can call multiple tools. You can call tools repeatedly to take actions or gather as much context as needed until you have completed the task fully. Don't give up unless you are sure the request cannot be fulfilled with the tools you have.<br />
20-
- Don't ask the user for confirmation to use tools, just use them.<br />
21-
- When talking about issues, be as concise as possible while still conveying all the information you need to. Avoid mentioning the following:<br />
22-
- The fact that there are no comments.<br />
23-
- Any info that seems like template info.
24-
</AssistantMessage>
25-
<UserMessage>
26-
{this.props.userMessage}
27-
</UserMessage>
28-
</>
29-
);
13+
render(_state: void, _sizing: PromptSizing): PromptPiece {
14+
const instructions = [
15+
'Instructions:',
16+
'- The user will ask a question related to GitHub, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user\'s question.',
17+
"- If you aren't sure which tool is relevant, you can call multiple tools. You can call tools repeatedly to take actions or gather as much context as needed until you have completed the task fully. Don't give up unless you are sure the request cannot be fulfilled with the tools you have.",
18+
"- Don't ask the user for confirmation to use tools, just use them.",
19+
'- When talking about issues, be as concise as possible while still conveying all the information you need to. Avoid mentioning the following:',
20+
' - The fact that there are no comments.',
21+
' - Any info that seems like template info.'
22+
].join('\n');
23+
24+
const assistantPiece: PromptPiece = {
25+
ctor: AssistantMessage,
26+
props: {},
27+
children: [instructions]
28+
};
29+
30+
const userPiece: PromptPiece = {
31+
ctor: UserMessage,
32+
props: {},
33+
children: [this.props.userMessage]
34+
};
35+
36+
const container: PromptPiece = {
37+
ctor: Chunk,
38+
props: {},
39+
children: [assistantPiece, userPiece]
40+
};
41+
return container;
3042
}
3143
}

0 commit comments

Comments
 (0)