Skip to content

Commit 0b0c21c

Browse files
authored
Handle the case where agents are disabled when running at_help --all (#822)
1 parent 86f6247 commit 0b0c21c

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

ts/README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,13 @@ The follow set of functionality will need the services keys. Please read the lin
9292

9393
**Additional keys required for individual AppAgents** (Optional if not using these AppAgents)
9494

95-
| Requirements | Functionality | Variables | Instructions | Keyless Access Supported |
96-
| ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ------------------------ |
97-
| Bing Search API | Chat Lookup | BING_API_KEY | | No |
98-
| GPT-3.5 Turbo | Fast Chat Response<br>[Email](./packages/agents/email) content generation | AZURE_OPENAI_API_KEY_GPT_35_TURBO<br>AZURE_OPENAI_ENDPOINT_GPT_35_TURBO | | Yes |
99-
| [Spotify Web API](https://developer.spotify.com/documentation/web-api) | [Music player](./packages/agents/player/) | SPOTIFY_APP_CLI<br>SPOTIFY_APP_CLISEC<br>SPOTIFY_APP_PORT | [Music player setup](./packages/agents/player/README.md#application-keys) | No |
100-
| [Graph Application](https://developer.microsoft.com/en-us/graph) | [Calendar](./packages/agents/calendar/)/[Email](./packages/agents/email) | MSGRAPH_APP_CLIENTID<br>MSGRAPH_APP_CLIENTSECRET<br>MSGRAPH_APP_TENANTID | | No |
101-
| GPT-4o | [Browser](./packages/agents/browser/) - Crossword Page | AZURE_OPENAI_API_KEY_GPT_4_O<br>AZURE_OPENAI_ENDPOINT_GPT_4_O | | Yes |
102-
95+
| Requirements | Functionality | Variables | Instructions | Keyless Access Supported |
96+
| ---------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ------------------------ |
97+
| Bing Search API | Chat Lookup | BING_API_KEY | | No |
98+
| GPT-3.5 Turbo | Fast Chat Response<br>[Email](./packages/agents/email) content generation | AZURE_OPENAI_API_KEY_GPT_35_TURBO<br>AZURE_OPENAI_ENDPOINT_GPT_35_TURBO | | Yes |
99+
| [Spotify Web API](https://developer.spotify.com/documentation/web-api) | [Music player](./packages/agents/player/) | SPOTIFY_APP_CLI<br>SPOTIFY_APP_CLISEC<br>SPOTIFY_APP_PORT | [Music player setup](./packages/agents/player/README.md#application-keys) | No |
100+
| [Graph Application](https://developer.microsoft.com/en-us/graph) | [Calendar](./packages/agents/calendar/)/[Email](./packages/agents/email) | MSGRAPH_APP_CLIENTID<br>MSGRAPH_APP_CLIENTSECRET<br>MSGRAPH_APP_TENANTID | | No |
101+
| GPT-4o | [Browser](./packages/agents/browser/) - Crossword Page | AZURE_OPENAI_API_KEY_GPT_4_O<br>AZURE_OPENAI_ENDPOINT_GPT_4_O | | Yes |
103102

104103
Other examples in the [example directory](./examples/) may have additional service keys requirements. See the README in those examples for more detail.
105104

ts/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"shell": "pnpm -C packages/shell run dev",
3838
"shell:test": "npx --prefix packages/shell playwright test simple.spec.ts",
3939
"test": "pnpm run test:local && pnpm run test:live",
40-
"test:live": "pnpm -r --no-sort --stream --workspace-concurrency=0 run test:live",
41-
"test:local": "pnpm -r --no-sort --stream --workspace-concurrency=0 run test:local"
40+
"test:live": "pnpm -r --no-sort --stream --workspace-concurrency=1 run test:live",
41+
"test:local": "pnpm -r --no-sort --stream --workspace-concurrency=1 run test:local"
4242
},
4343
"devDependencies": {
4444
"@fluidframework/build-tools": "^0.54.0",

ts/packages/dispatcher/src/context/system/handlers/helpCommandHandler.ts

+19-12
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,26 @@ export class HelpCommandHandler implements CommandHandler {
5353
const agentNames: string[] =
5454
context.sessionContext.agentContext.agents.getAppAgentNames();
5555
for (let i = 0; i < agentNames.length; i++) {
56-
const agent =
57-
context.sessionContext.agentContext.agents.getAppAgent(
58-
agentNames[i],
59-
);
56+
try {
57+
const agent =
58+
context.sessionContext.agentContext.agents.getAppAgent(
59+
agentNames[i],
60+
);
6061

61-
if (
62-
agent !== undefined &&
63-
agent.getCommands &&
64-
agentNames[i] == "system"
65-
) {
66-
printAllCommandsWithUsage(
67-
await agent.getCommands!(context.sessionContext),
68-
agentNames[i],
62+
if (
63+
agent !== undefined &&
64+
agent.getCommands &&
65+
agentNames[i] !== "system"
66+
) {
67+
printAllCommandsWithUsage(
68+
await agent.getCommands!(context.sessionContext),
69+
agentNames[i],
70+
context,
71+
);
72+
}
73+
} catch {
74+
displayResult(
75+
`Can't get commands for agent '${agentNames[i]}' because it is not enabled.`,
6976
context,
7077
);
7178
}

0 commit comments

Comments
 (0)