Skip to content

Commit

Permalink
Resolve coral_web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tianjing-li committed Oct 28, 2024
1 parent e8b5e19 commit 0a9e8a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/coral_web/src/app/(main)/(chat)/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Chat: React.FC<{ agentId?: string; conversationId?: string }> = ({

const agentTools = (agent?.tools
.map((name) => (tools ?? [])?.find((t) => t.name === name))
.filter((t) => t !== undefined) ?? []) as ToolDefinition[];
.filter((t) => t !== undefined) ?? []) as ManagedTool[];

setParams({
tools: agentTools,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useClickOutside } from '@react-hookz/web';
import { uniq, uniqBy } from 'lodash';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';

import { ToolDefinition } from '@/cohere-client';
import { ManagedTool } from '@/cohere-client';
import { ListboxOption, ListboxOptions } from '@/components/Conversation/Composer/ListboxOptions';
import { IconButton } from '@/components/IconButton';
import { IconName, Text } from '@/components/Shared';
Expand Down Expand Up @@ -118,7 +118,7 @@ export const DataSourceMenu: React.FC<Props> = ({
switch (value.type) {
case TagType.TOOL: {
setParams({
tools: uniqBy([...(tools ?? []), value.tag.getValue() as ToolDefinition], 'name'),
tools: uniqBy([...(tools ?? []), value.tag.getValue() as ManagedTool], 'name'),
});
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/coral_web/src/hooks/tags.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo, useState } from 'react';

import { ToolDefinition } from '@/cohere-client';
import { ManagedTool } from '@/cohere-client';
import { Tag } from '@/components/Conversation/Composer/DataSourceMenu';
import { TOOL_FALLBACK_ICON, TOOL_ID_TO_DISPLAY_INFO } from '@/constants';
import { useListFiles } from '@/hooks/files';
Expand Down Expand Up @@ -28,7 +28,7 @@ export const useDataSourceTags = ({ requiredTools }: { requiredTools?: string[]

return requiredTools
.map((rt) => availableTools.find((t) => t.name === rt))
.filter((t) => !!t) as ToolDefinition[];
.filter((t) => !!t) as ManagedTool[];
}, [tools, requiredTools]);

const filteredFileIdTags: Tag[] = useMemo(
Expand Down

0 comments on commit 0a9e8a4

Please sign in to comment.