Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,6 +1,7 @@
import { useMemo } from 'react';

import { BasicModelConfigEditor } from '@cozeloop/prompt-components';
import { I18n } from '@cozeloop/i18n-adapter';
import { BasicCard } from '@cozeloop/components';
import { useModelList, useSpace } from '@cozeloop/biz-hooks-adapter';
import { type PromptRuntimeParam } from '@cozeloop/api-schema/evaluation';
Expand Down Expand Up @@ -47,7 +48,7 @@ export function EvaluateTargetPromptDynamicParams(
className="mt-4"
title={
<div>
覆盖 Prompt 模型配置{' '}
{I18n.t('dataset_ai_annotation_prompt_config_override')}{' '}
<Switch
size="small"
checked={!!props.value}
Expand Down Expand Up @@ -77,6 +78,7 @@ export function EvaluateTargetPromptDynamicParams(
json_value: JSON.stringify({ model_config: v }),
});
}}
onModelChange={props.onModelChange}
models={model.data?.models}
modelSelectProps={{
className: 'w-full',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useRef } from 'react';

import { useRequest } from 'ahooks';
import { I18n } from '@cozeloop/i18n-adapter';
import { type Version } from '@cozeloop/components';
import { useSpace } from '@cozeloop/biz-hooks-adapter';
import { type EvaluationSet } from '@cozeloop/api-schema/evaluation';
Expand Down Expand Up @@ -45,16 +46,16 @@ export const ExperimentModal = ({

return (
<Modal
title="确认用于实验的评测集版本"
title={I18n.t('confirm_evaluation_set_version')}
onOk={() => {
formRef.current?.submitForm();
}}
visible
width={600}
height={473}
onCancel={onCancel}
okText="确定"
cancelText="取消"
okText={I18n.t('confirm')}
cancelText={I18n.t('cancel')}
>
{loading ? (
<div className="flex justify-center items-center h-full">
Expand All @@ -74,7 +75,7 @@ export const ExperimentModal = ({
{({ formState }) => (
<>
<FormSelect
label="版本"
label={I18n.t('version')}
className="w-full"
extraTextPosition="bottom"
extraText={
Expand All @@ -84,20 +85,20 @@ export const ExperimentModal = ({
className="!coz-fg-secondary"
size="small"
>
当前草稿有修改未提交,已默认选择最新历史版本
{I18n.t('draft_unsubmitted_tip')}
</Typography.Text>
) : null
}
field="version_id"
rules={[{ required: true, message: '请选择版本' }]}
rules={[{ required: true, message: I18n.t('select_version') }]}
optionList={data?.map(item => ({
label: item.version,
value: item.id,
}))}
fieldStyle={{ paddingBottom: 8 }}
filter={true}
></FormSelect>
<Form.Slot label="版本说明">
<Form.Slot label={I18n.t('version_description')}>
<Typography.Text className="!coz-fg-primary">
{data?.find(item => item.id === formState?.values?.version_id)
?.description || '-'}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from 'react';

import { I18n } from '@cozeloop/i18n-adapter';
import { GuardPoint, Guard } from '@cozeloop/guard';
import { type Version } from '@cozeloop/components';
import { useNavigateModule } from '@cozeloop/biz-hooks-adapter';
Expand Down Expand Up @@ -34,7 +35,7 @@ export const useAddExperiment = ({
}}
disabled={!datasetDetail?.latest_version}
>
新建实验
{I18n.t('new_experiment')}
</Button>
</Guard>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames';
import { I18n } from '@cozeloop/i18n-adapter';
import { type FieldSchema } from '@cozeloop/api-schema/evaluation';
import { IconCozEqual } from '@coze-arch/coze-design/icons';
import { Tag, type TooltipProps, Typography } from '@coze-arch/coze-design';
Expand Down Expand Up @@ -40,7 +41,7 @@ export const peDataTypeMap = {
[PeDataType.Float]: 'Float',
// 多模态
[PeDataType.Image]: 'Image',
[PeDataType.Multipart]: '多模态',
[PeDataType.Multipart]: I18n.t('multimodal'),
};

export function ReadonlyItem({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react';

import { I18n } from '@cozeloop/i18n-adapter';
import {
type ColumnItem,
ColumnSelector,
Expand Down Expand Up @@ -94,7 +95,7 @@ export function ColumnsManage({
);

return (
<Tooltip theme="dark" content="列管理">
<Tooltip theme="dark" content={I18n.t('column_management')}>
<div>
<ColumnSelector
columns={options}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { I18n } from '@cozeloop/i18n-adapter';
import { handleCopy, IconButtonContainer } from '@cozeloop/components';
import { IconCozCopy } from '@coze-arch/coze-design/icons';
import { Tooltip } from '@coze-arch/coze-design';
Expand All @@ -13,7 +14,7 @@ export function CopyIcon({
onClick?: (e: React.MouseEvent) => void;
}) {
return (
<Tooltip content="复制" theme="dark">
<Tooltip content={I18n.t('copy')} theme="dark">
<div className={className}>
<IconButtonContainer
icon={<IconCozCopy />}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { I18n } from '@cozeloop/i18n-adapter';
import { IconCozLongArrowTopRight } from '@coze-arch/coze-design/icons';
import { Tag } from '@coze-arch/coze-design';

Expand All @@ -11,10 +12,10 @@ const NoVersionJumper = (props: NoVersionJumperProps) => {
return (
<div className="w-full flex flex-row items-center justify-between gap-1 pr-2">
<div className="flex flex-row items-center gap-3">
<div className="coz-fg-dim">{'草稿版本'}</div>
<div className="coz-fg-dim">{I18n.t('draft_version')}</div>
{isShowTag ? (
<Tag color="yellow" className="!h-5 !px-2 !py-[2px] rounded-[3px]">
{'修改未提交'}
{I18n.t('unsubmitted_changes')}
</Tag>
) : null}
</div>
Expand All @@ -24,7 +25,9 @@ const NoVersionJumper = (props: NoVersionJumperProps) => {
}}
className="flex-shrink-0 h-8 flex flex-row items-center cursor-pointer"
>
<div className="text-sm font-medium text-brand-9">{'去提交'}</div>
<div className="text-sm font-medium text-brand-9">
{I18n.t('to_submit')}
</div>
<IconCozLongArrowTopRight className="h-4 w-4 text-brand-9 ml-1" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames';
import { I18n } from '@cozeloop/i18n-adapter';
import { Tooltip } from '@coze-arch/coze-design';

export function OpenDetailText({
Expand All @@ -11,7 +12,7 @@ export function OpenDetailText({
text?: string;
}) {
return (
<Tooltip theme="dark" content="查看详情">
<Tooltip theme="dark" content={I18n.t('view_detail')}>
<div
className={classNames(
'flex-shrink-0 text-sm text-brand-9 font-normal cursor-pointer !p-[2px] ',
Expand All @@ -22,7 +23,7 @@ export function OpenDetailText({
window.open(url);
}}
>
{text || '查看详情'}
{text || I18n.t('view_detail')}
</div>
</Tooltip>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { I18n } from '@cozeloop/i18n-adapter';
import { IconCozRefresh } from '@coze-arch/coze-design/icons';
import { Button, Tooltip } from '@coze-arch/coze-design';

Expand All @@ -7,7 +8,7 @@ export function RefreshButton({
onRefresh: (() => void) | undefined;
}) {
return (
<Tooltip content="刷新" theme="dark">
<Tooltip content={I18n.t('refresh')} theme="dark">
<Button
color="primary"
icon={<IconCozRefresh />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState } from 'react';

import { cloneDeep } from 'lodash-es';
import { useUpdateEffect } from 'ahooks';
import { I18n } from '@cozeloop/i18n-adapter';
import { TooltipWhenDisabled } from '@cozeloop/components';
import {
type EvaluationSet,
Expand Down Expand Up @@ -46,7 +47,7 @@ export const DatasetAddItems = ({
const onDelete = (index: number) => {
const newItems = evaSetItems?.filter((_, i) => i !== index);
if (newItems.length === 0) {
Toast.error('至少保留一个数据项');
Toast.error(I18n.t('keep_at_least_one_data_item'));
return;
}
evalsetItemsField.setValue(newItems);
Expand All @@ -61,7 +62,7 @@ export const DatasetAddItems = ({
}, [expand]);
const onCopy = (index: number) => {
if (evaSetItems?.length >= 10) {
Toast.error('单次最多添加10条数据项');
Toast.error(I18n.t('cozeloop_open_evaluate_max_10_data_items_per_add'));
return;
}
const newItems = [
Expand Down Expand Up @@ -101,7 +102,7 @@ export const DatasetAddItems = ({
<div className="flex w-full justify-between items-center">
<div className="flex items-center gap-[4px]">
<Typography.Text className="!font-semibold">
{`数据项 ${index + 1}`}
{I18n.t('data_item')} {index + 1}
</Typography.Text>
{activeKey.includes(`${index}`) ? (
<IconCozArrowDown
Expand Down Expand Up @@ -151,7 +152,7 @@ export const DatasetAddItems = ({
</Collapse>
<TooltipWhenDisabled
theme="dark"
content="单次最多添加10条数据项"
content={I18n.t('cozeloop_open_evaluate_max_10_data_items_per_add')}
disabled={evaSetItems?.length >= 10}
>
<div>
Expand All @@ -170,7 +171,7 @@ export const DatasetAddItems = ({
elementFocus(`${DATASET_ADD_ITEM_PREFIX}-${evaSetItems?.length}`);
}}
>
添加数据项
{I18n.t('add_data_item')}
<Typography.Text className="ml-2 !coz-fg-dim" size="small">
{evaSetItems?.length}/10
</Typography.Text>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @coze-arch/max-line-per-function */
import { useRef, useState } from 'react';

import { I18n } from '@cozeloop/i18n-adapter';
import { GuardPoint, Guard } from '@cozeloop/guard';
import { ResizeSidesheet } from '@cozeloop/components';
import { useSpace } from '@cozeloop/biz-hooks-adapter';
Expand Down Expand Up @@ -36,8 +37,8 @@ export const DatasetAddItemsPanel = ({
const [loading, setLoading] = useState(false);
const defaultEvaSetItem = getDefaultEvaSetItem(datasetDetail, spaceID);
const { ExpandNode, expand } = useExpandButton({
shrinkTooltip: '折叠全部数据项',
expandTooltip: '展开全部数据项',
shrinkTooltip: I18n.t('collapse_all_data_items'),
expandTooltip: I18n.t('expand_all_data_items'),
});
const formApiRef = useRef<FormApi>();

Expand All @@ -54,7 +55,7 @@ export const DatasetAddItemsPanel = ({
const successCount = Object.keys(res?.added_items || {}).length;
if (res?.errors?.length && res?.errors?.length > 0) {
Modal.info({
title: '执行结果',
title: I18n.t('execution_result'),
width: 420,
content: (
<div className="mt-[20px]">
Expand All @@ -70,10 +71,12 @@ export const DatasetAddItemsPanel = ({
onOk: () => {
onOK();
},
okText: '已知晓',
okText: I18n.t('known'),
});
} else {
Toast.success(`成功添加${successCount}条数据`);
Toast.success(
`${I18n.t('cozeloop_open_evaluate_successfully_added_data_count', { successCount })}`,
);
onOK();
}
} catch (error) {
Expand Down Expand Up @@ -108,19 +111,20 @@ export const DatasetAddItemsPanel = ({
}}
disabled={loading}
>
添加
{I18n.t('add')}
</Button>
</Guard>
<Button color="primary" onClick={onCancel}>
取消
{I18n.t('cancel')}
</Button>
</div>
}
visible={true}
title={
<div className="flex items-center justify-between gap-2">
添加数据
{ExpandNode}
{I18n.t('cozeloop_open_evaluate_add_data_expandnode', {
ExpandNode,
})}
</div>
}
>
Expand Down Expand Up @@ -160,7 +164,7 @@ export const DatasetAddItemsPanel = ({
<Anchor.Link
key={index}
href={`#${DATASET_ADD_ITEM_PREFIX}-${index}`}
title={`数据项${index + 1}`}
title={`${I18n.t('cozeloop_open_evaluate_data_item_placeholder1', { placeholder1: index + 1 })}`}
/>
))}
</LoopAnchor>
Expand Down
Loading
Loading