Skip to content

Commit

Permalink
Merge branch 'main' into staging/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-cohere authored Aug 20, 2024
2 parents 0bff3de + 821f5f8 commit 3263183
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
};

export const UpdateAgent: React.FC<Props> = ({ agent }) => {
const { error, success } = useNotify();
const { error, info } = useNotify();
const { open, close } = useContextStore();

const { mutateAsync: updateAgent } = useUpdateAgent();
Expand Down Expand Up @@ -56,7 +56,7 @@ export const UpdateAgent: React.FC<Props> = ({ agent }) => {
request: { ...fields, tools_metadata },
agentId: agent.id,
});
success(`Updated ${newAgent?.name}`);
info(`Updated ${newAgent?.name}`);
} catch (e) {
setIsSubmitting(false);
error(`Failed to update ${agent?.name}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const DataSourceMenu: React.FC<Props> = ({ agent, tools }) => {

const { text, contrastText, border, bg } = useBrandedColors(agent?.id);

const isBaseAgent = checkIsBaseAgent(agent);
return (
<Popover className="relative">
<PopoverButton
Expand All @@ -49,7 +50,7 @@ export const DataSourceMenu: React.FC<Props> = ({ agent, tools }) => {
as="span"
className={cn('font-medium', text, { [contrastText]: open })}
>
Tools: {paramsTools?.length ?? 0}
Tools: {isBaseAgent ? paramsTools?.length ?? 0 : availableTools.length ?? 0}
</Text>
)}
</PopoverButton>
Expand Down Expand Up @@ -110,7 +111,7 @@ export const DataSourceMenu: React.FC<Props> = ({ agent, tools }) => {
<Text as="span">{tool.display_name}</Text>
</div>
</div>
{checkIsBaseAgent(agent) && (
{isBaseAgent && (
<Switch
theme="evolved-blue"
checked={!!paramsTools?.find((t) => t.name === tool.name)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ToastNotification: React.FC<Props> = ({ position = 'bottom-right' }
classNames: {
cancelButton: '!text-volcanic-60 dark:!text-marble-950 !text-p-lg !ml-auto',
error: 'bg-mushroom-800 text-volcanic-60 dark:bg-volcanic-300 dark:text-marble-950',
info: 'bg-mushroom-600 text-volcanic-60',
},
}}
pauseWhenPageIsHidden
Expand All @@ -48,6 +49,9 @@ export const ToastNotification: React.FC<Props> = ({ position = 'bottom-right' }
className="h-4 w-4 fill-danger-350 dark:fill-danger-500"
/>
),
info: (
<Icon name="information" className="h-4 w-4 fill-volcanic-60 dark:fill-volcanic-60" />
),
}}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/assistants_web/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const TOOL_ID_TO_DISPLAY_INFO: { [id: string]: { icon: IconName } } = {
};

export const MAX_TIMEOUT_PREFETCH = 5000;
export const DEFAULT_AGENT_TOOLS = [TOOL_SEARCH_FILE_ID, TOOL_READ_DOCUMENT_ID];
export const DEFAULT_AGENT_TOOLS = [TOOL_SEARCH_FILE_ID, TOOL_READ_DOCUMENT_ID, TOOL_WEB_SCRAPE_ID];

export type COHERE_BRANDED_COLORS =
| 'blue'
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/assistants_web/src/hooks/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const useNotify = () => {
duration: Infinity,
cancel: { label: 'x', onClick: () => toast.dismiss() },
});

const info = (message: string) => toast.info(message, { duration: 5000 });
const dismiss = (id: string | number) => toast.dismiss(id);

return { error, dismiss };
return { error, info, dismiss };
};

0 comments on commit 3263183

Please sign in to comment.