Skip to content

Commit d8c73f9

Browse files
authored
fix(toolkit): address UI bugs from 22/08/2024 (#732)
fix(toolkit): bugs 22082024
1 parent 0a7cba5 commit d8c73f9

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

src/interfaces/assistants_web/src/app/(main)/(chat)/Chat.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useEffect } from 'react';
55
import { Document, ManagedTool } from '@/cohere-client';
66
import { Conversation, ConversationError } from '@/components/Conversation';
77
import { TOOL_PYTHON_INTERPRETER_ID } from '@/constants';
8-
import { useAgent, useConversation, useListTools } from '@/hooks';
8+
import { useAgent, useAvailableTools, useConversation, useListTools } from '@/hooks';
99
import { useCitationsStore, useConversationStore, useParamsStore } from '@/stores';
1010
import { OutputFiles } from '@/stores/slices/citationsSlice';
1111
import {
@@ -24,6 +24,7 @@ const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({
2424
const { setConversation } = useConversationStore();
2525
const { addCitation, saveOutputFiles } = useCitationsStore();
2626
const { setParams, resetFileParams } = useParamsStore();
27+
const { availableTools } = useAvailableTools({ agent, managedTools: tools });
2728

2829
const {
2930
data: conversation,
@@ -39,9 +40,11 @@ const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({
3940

4041
const agentTools =
4142
agent?.tools &&
42-
((agent.tools
43+
(agent.tools
4344
.map((name) => (tools ?? [])?.find((t) => t.name === name))
44-
.filter((t) => t !== undefined) ?? []) as ManagedTool[]);
45+
.filter(
46+
(t) => t !== undefined && availableTools.some((at) => at.name === t?.name)
47+
) as ManagedTool[]);
4548

4649
const fileIds = conversation?.files.map((file) => file.id);
4750

@@ -53,7 +56,16 @@ const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({
5356
if (conversationId) {
5457
setConversation({ id: conversationId });
5558
}
56-
}, [agent, tools, conversation]);
59+
}, [
60+
agent,
61+
tools,
62+
conversation,
63+
availableTools,
64+
setParams,
65+
resetFileParams,
66+
setConversation,
67+
conversationId,
68+
]);
5769

5870
useEffect(() => {
5971
if (!conversation) return;

src/interfaces/assistants_web/src/app/(main)/edit/[agentId]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { NextPage } from 'next';
22

3-
import { UpdateAgent } from './UpdateAgent';
43
import { getCohereServerClient } from '@/server/cohereServerClient';
54

5+
import { UpdateAgent } from './UpdateAgent';
6+
67
type Props = {
78
params: {
89
agentId: string;

src/interfaces/assistants_web/src/components/Composer/DataSourceMenu.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const DataSourceMenu: React.FC<Props> = ({ agent, tools }) => {
2727
});
2828

2929
const { text, contrastText, border, bg } = useBrandedColors(agent?.id);
30-
3130
const isBaseAgent = checkIsBaseAgent(agent);
3231
return (
3332
<Popover className="relative">

src/interfaces/assistants_web/src/components/MessageRow/Citation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const Citation: React.FC<Props> = ({ generationId, citationKey, agentId }
3232
const safeUrl = getSafeUrl(document.url);
3333
const { text, lightText, fill, lightFill, dark, light } = useBrandedColors(agentId);
3434

35-
const brandedClassName = cn(text, lightText, dark(lightFill), light(fill));
35+
const brandedClassName = cn(dark(lightText), light(text), dark(lightFill), light(fill));
3636

3737
return (
3838
<div className="space-y-4">

src/interfaces/assistants_web/src/components/UI/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const getLabelStyles = (kind: ButtonKind, theme: ButtonTheme, disabled: boolean)
3333
theme === 'blue' ||
3434
theme === 'quartz' ||
3535
theme === 'evolved-blue' ||
36-
theme === 'evolved-quartz',
36+
theme === 'evolved-quartz' ||
37+
theme === 'mushroom',
3738
// dark mode
3839
'dark:text-volcanic-150 dark:fill-volcanic-150':
3940
theme === 'evolved-green' ||

src/interfaces/assistants_web/src/hooks/use-brandedColors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ const ASSISTANT_COLORS = [
1515
'quartz-500',
1616
'evolved-quartz-700',
1717
'evolved-mushroom-500',
18-
'mushroom-300',
18+
'mushroom-500',
1919
];
2020
const ASSISTANT_LIGHT_COLORS = [
2121
'green-800',
2222
'quartz-800',
2323
'evolved-quartz-900',
2424
'evolved-mushroom-800',
25-
'mushroom-600',
25+
'mushroom-700',
2626
];
2727
const ASSISTANT_CONTRAST_COLORS = [
2828
'marble-950',
2929
'marble-950',
3030
'marble-950',
3131
'volcanic-100',
32-
'mushroom-800',
32+
'mushroom-900',
3333
];
3434
const DEFAULT_COLOR = 'evolved-blue-500';
3535
const DEFAULT_LIGHT_COLOR = 'blue-800';

0 commit comments

Comments
 (0)