Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add title to setSuggestedPrompts utility #2308

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,20 @@ const config = {
redirects: [
{
to: '/getting-started',
from: ['/tutorial/getting-started','/tutorial/getting-started-http'],
from: ['/tutorial/getting-started', '/tutorial/getting-started-http'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukegalbraithrussell 👋🏼 When you make docs changes, make sure to run the linter so these aren't picked up by subsequent PRs. It'll help us keep the changes for each PR scoped to what they're actually about.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm i think maybe i ran the wrong linter because it changed all of this just in my last PR. (Most notably in that sidebar.js file -- I would never manually use double quotations willingly so i remember it changing them all). I'll figure out what happened

},
{
to: '/concepts/steps-from-apps',
from: [
'/concepts/creating-steps',
'/concepts/adding-editing-steps',
'/concepts/saving-steps',
'/concepts/executing-steps'
'/concepts/executing-steps',
],
},
{
to: '/concepts/actions',
from: [
'/concepts/action-listening',
'/concepts/action-responding'
],
from: ['/concepts/action-listening', '/concepts/action-responding'],
},
{
to: '/',
Expand Down
132 changes: 58 additions & 74 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,108 +2,92 @@
const sidebars = {
sidebarJSBolt: [
{
type: "doc",
id: "index",
label: "Bolt for JavaScript",
className: "sidebar-title",
type: 'doc',
id: 'index',
label: 'Bolt for JavaScript',
className: 'sidebar-title',
},
"getting-started",
'getting-started',
{
type: "category",
label: "Slack API calls",
items: ["concepts/message-sending", "concepts/web-api"],
type: 'category',
label: 'Slack API calls',
items: ['concepts/message-sending', 'concepts/web-api'],
},
{
type: "category",
label: "Events",
items: ["concepts/message-listening", "concepts/event-listening"],
type: 'category',
label: 'Events',
items: ['concepts/message-listening', 'concepts/event-listening'],
},
{
type: "category",
label: "App UI & Interactivity",
type: 'category',
label: 'App UI & Interactivity',
items: [
"concepts/acknowledge",
"concepts/shortcuts",
"concepts/commands",
"concepts/actions",
"concepts/creating-modals",
"concepts/updating-pushing-views",
"concepts/view-submissions",
"concepts/select-menu-options",
"concepts/publishing-views",
'concepts/acknowledge',
'concepts/shortcuts',
'concepts/commands',
'concepts/actions',
'concepts/creating-modals',
'concepts/updating-pushing-views',
'concepts/view-submissions',
'concepts/select-menu-options',
'concepts/publishing-views',
],
},
"concepts/custom-steps",
'concepts/custom-steps',
{
type: "category",
label: "App Configuration",
type: 'category',
label: 'App Configuration',
items: [
"concepts/socket-mode",
"concepts/error-handling",
"concepts/logging",
"concepts/custom-routes",
"concepts/deferring-initialization",
"concepts/receiver",
'concepts/socket-mode',
'concepts/error-handling',
'concepts/logging',
'concepts/custom-routes',
'concepts/deferring-initialization',
'concepts/receiver',
],
},
{
type: "category",
label: "Middleware & Context",
items: [
"concepts/global-middleware",
"concepts/listener-middleware",
"concepts/context",
],
type: 'category',
label: 'Middleware & Context',
items: ['concepts/global-middleware', 'concepts/listener-middleware', 'concepts/context'],
},
{
type: "category",
label: "Authorization & Security",
items: [
"concepts/authenticating-oauth",
"concepts/authorization",
"concepts/token-rotation",
],
type: 'category',
label: 'Authorization & Security',
items: ['concepts/authenticating-oauth', 'concepts/authorization', 'concepts/token-rotation'],
},
{
type: "category",
label: "Deployments",
items: ["deployments/aws-lambda", "deployments/heroku"],
type: 'category',
label: 'Deployments',
items: ['deployments/aws-lambda', 'deployments/heroku'],
},
{
type: "category",
label: "Migration Guides",
items: [
"migration/migration-v2",
"migration/migration-v3",
"migration/migration-v4",
],
type: 'category',
label: 'Migration Guides',
items: ['migration/migration-v2', 'migration/migration-v3', 'migration/migration-v4'],
},
{
type: "category",
label: "Legacy",
items: [
"legacy/hubot-migration",
"legacy/steps-from-apps",
"legacy/conversation-store",
],
type: 'category',
label: 'Legacy',
items: ['legacy/hubot-migration', 'legacy/steps-from-apps', 'legacy/conversation-store'],
},
{ type: "html", value: "<hr>" },
"reference",
{ type: "html", value: "<hr>" },
{ type: 'html', value: '<hr>' },
'reference',
{ type: 'html', value: '<hr>' },
{
type: "link",
label: "Release notes",
href: "https://github.com/slackapi/bolt-js/releases",
type: 'link',
label: 'Release notes',
href: 'https://github.com/slackapi/bolt-js/releases',
},
{
type: "link",
label: "Code on GitHub",
href: "https://github.com/SlackAPI/bolt-js",
type: 'link',
label: 'Code on GitHub',
href: 'https://github.com/SlackAPI/bolt-js',
},
{
type: "link",
label: "Contributors Guide",
href: "https://github.com/SlackAPI/bolt-js/blob/main/.github/contributing.md",
type: 'link',
label: 'Contributors Guide',
href: 'https://github.com/SlackAPI/bolt-js/blob/main/.github/contributing.md',
},
],
};
Expand Down
8 changes: 7 additions & 1 deletion src/Assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ type SetSuggestedPromptsFn = (
) => Promise<AssistantThreadsSetSuggestedPromptsResponse>;

interface SetSuggestedPromptsArguments {
/** @description Prompt suggestions that appear when opening assistant thread. */
prompts: [AssistantPrompt, ...AssistantPrompt[]];
/** @description Title for the prompts. */
title?: string;
misscoded marked this conversation as resolved.
Show resolved Hide resolved
}

interface AssistantPrompt {
/** @description Title of the prompt. */
title: string;
/** @description Message of the prompt. */
message: string;
}

Expand Down Expand Up @@ -345,11 +350,12 @@ function createSetSuggestedPrompts(args: AllAssistantMiddlewareArgs): SetSuggest
const { channelId: channel_id, threadTs: thread_ts } = extractThreadInfo(payload);

return (params: Parameters<SetSuggestedPromptsFn>[0]) => {
const { prompts } = params;
const { prompts, title } = params;
return client.assistant.threads.setSuggestedPrompts({
channel_id,
thread_ts,
prompts,
title,
});
};
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/Assistant.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe('Assistant class', () => {
const { enrichAssistantArgs } = await importAssistant();
const threadStartedArgs = enrichAssistantArgs(mockThreadContextStore, mockThreadStartedArgs);

await threadStartedArgs.setSuggestedPrompts({ prompts: [{ title: '', message: '' }] });
await threadStartedArgs.setSuggestedPrompts({ prompts: [{ title: '', message: '' }], title: '' });

sinon.assert.called(fakeClient.assistant.threads.setSuggestedPrompts);
});
Expand Down