Skip to content

Commit bd054de

Browse files
committed
PR feedback
Signed-off-by: Grant Linville <[email protected]>
1 parent c01de74 commit bd054de

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

components/script/useChatSocket.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,13 @@ const useChatSocket = (isEmpty?: boolean) => {
192192
}
193193

194194
let confirmMessage = `Proceed with calling the ${frame.tool.name} tool?`;
195-
if (
196-
!frame.tool.instructions?.startsWith('#!sys.openapi') &&
197-
frame.displayText
198-
) {
195+
if (frame.tool.instructions?.startsWith('#!sys.openapi')) {
196+
confirmMessage = `Proceed with running the following API operation (or allow all runs of this operation)?`;
197+
} else if (frame.displayText) {
199198
const tool = frame.tool?.name?.replace('sys.', '');
200199
confirmMessage = frame.tool?.source?.repo
201200
? `Proceed with running the following (or allow all calls from the **${trimRepo(frame.tool?.source.repo!.Root)}** repo)?`
202201
: `Proceed with running the following (or allow all **${tool}** calls)?`;
203-
} else if (frame.tool.instructions?.startsWith('#!sys.openapi')) {
204-
confirmMessage = `Proceed with running the following API operation (or allow all runs of this operation)?`;
205202
}
206203

207204
const form = (
@@ -276,10 +273,10 @@ const useChatSocket = (isEmpty?: boolean) => {
276273

277274
if (frame.tool.instructions?.startsWith('#!sys.openapi')) {
278275
// If the tool is an OpenAPI tool to list operations or get the schema for an operation, allow it.
276+
const instructions = frame.tool.instructions.split(' ');
279277
if (
280-
frame.tool.instructions?.split(' ').length > 2 &&
281-
(frame.tool.instructions?.split(' ')[1] == 'list' ||
282-
frame.tool.instructions?.split(' ')[1] == 'get-schema')
278+
instructions.length > 2 &&
279+
(instructions[1] == 'list' || instructions[1] == 'get-schema')
283280
) {
284281
return true;
285282
}

0 commit comments

Comments
 (0)