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

feat(ai-workspace-common): change arco modal #510

Merged
merged 3 commits into from
Feb 14, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ export const CanvasToolbar = memo<ToolbarProps>(({ onToolSelect }) => {
title: item.title,
entityId: item.id,
contentPreview: item?.contentPreview || contentPreview,
metadata:
item.domain === 'resource' ? { resourceType: item?.metadata?.resourceType } : {},
},
},
undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const ModelSelector = memo(
const { tokenUsage, isUsageLoading } = useSubscriptionUsage();

const modelList = useMemo(() => modelListData?.data, [modelListData?.data]);

const t1Disabled = useMemo(
() => tokenUsage?.t1CountUsed >= tokenUsage?.t1CountQuota && tokenUsage?.t1CountQuota >= 0,
[tokenUsage?.t1CountUsed, tokenUsage?.t1CountQuota],
Expand Down Expand Up @@ -393,6 +394,8 @@ export const ModelSelector = memo(
return <Skeleton className="w-28" active paragraph={false} />;
}

const remoteModel = modelList?.find((m) => m.name === model?.name);

return (
<Dropdown
menu={{
Expand All @@ -409,7 +412,7 @@ export const ModelSelector = memo(
<span className="text-xs flex items-center gap-1.5 text-gray-500 cursor-pointer transition-all duration-300 hover:text-gray-700">
<SelectedModelDisplay model={model} />
<IconDown />
{!model?.capabilities?.vision && isContextIncludeImage && (
{!remoteModel?.capabilities?.vision && isContextIncludeImage && (
<Tooltip title={t('copilot.modelSelector.noVisionSupport')}>
<IconError className="w-3.5 h-3.5 text-[#faad14]" />
</Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
border-radius: 8px;
}

.arco-modal-content {
.ant-modal-content {
width: 100%;
height: 100%;
padding: 0;
}

div:has(.arco-modal-content) {
div:has(.ant-modal-content) {
height: 100%;
}

.ant-modal-body {
height: 100%;
}
}
Expand Down Expand Up @@ -43,6 +47,10 @@
font-weight: bold;
}
}

.ant-menu-vertical {
border-inline-end: none;
}
}

.import-resource-right-panel {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Modal } from '@arco-design/web-react';
import { Menu, Divider, Splitter } from 'antd';
import { Menu, Divider, Splitter, Modal } from 'antd';
import { HiLink } from 'react-icons/hi';
import {
ImportResourceMenuItem,
Expand All @@ -13,7 +12,6 @@ import { useTranslation } from 'react-i18next';

import './index.scss';
import { useEffect } from 'react';
import { getPopupContainer } from '@refly-packages/ai-workspace-common/utils/ui';
import { getRuntime } from '@refly/utils/env';
import MultilingualSearch from '@refly-packages/ai-workspace-common/modules/multilingual-search';
import { TbClipboard, TbWorldSearch, TbBrowserPlus, TbFile } from 'react-icons/tb';
Expand Down Expand Up @@ -49,18 +47,17 @@ export const ImportResourceModal = () => {

return (
<Modal
visible={importResourceModalVisible}
open={importResourceModalVisible}
footer={null}
onCancel={() => {
setImportResourceModalVisible(false);
}}
getPopupContainer={getPopupContainer}
className="import-resource-modal"
height={'70%'}
width={'65%'}
style={{
height: '70%',
minHeight: 500,
maxHeight: 660,
width: '65%',
minWidth: '300px',
maxWidth: '1050px',
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const ImportFromText = () => {
entityId: data?.data?.resourceId,
contentPreview: data?.data?.contentPreview,
metadata: {
resourceType: 'pastedText',
resourceType: 'text',
},
},
position: insertNodePosition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const SubscribeModal = () => {
footer={null}
className="subscribe-modal !p-0"
onCancel={() => setVisible(false)}
zIndex={100}
>
<div className="w-full h-full overflow-auto flex flex-col items-center gap-3">
<div className="font-bold text-3xl m-auto flex items-center gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const domainToFetchData: Record<SearchDomain, DataFetcher> = {
id: item?.resourceId,
title: item?.title,
domain: 'resource',
metadata: {
resourceType: item?.resourceType,
},
snippets: [
{
text: item?.contentPreview,
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/en-US/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ const translations = {
},
resourceType: {
weblink: 'Web Link',
pastedText: 'Pasted Text',
text: 'Pasted Text',
file: 'File',
},
canvas: {
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/zh-Hans/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ const translations = {
},
resourceType: {
weblink: '网页链接',
pastedText: '粘贴文本',
text: '粘贴文本',
file: '文件',
},
canvas: {
Expand Down