Skip to content
Open
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
4 changes: 2 additions & 2 deletions front/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FRONTEND_DEPLOY_STAGE=DEVELOPMENT
NEXT_PUBLIC_EDITION=SELF_HOSTED
FRONTEND_CORE_API=https://10.210.0.49:5025/console/api
FRONTEND_APP_API=https://10.210.0.49:5025/api
FRONTEND_CORE_API=https://112.111.7.69:30382/console/api
FRONTEND_APP_API=https://112.111.7.69:30382/api

# SENTRY
NEXT_PUBLIC_SENTRY_DSN=
4 changes: 2 additions & 2 deletions front/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FRONTEND_DEPLOY_STAGE=DEVELOPMENT
NEXT_PUBLIC_EDITION=SELF_HOSTED
FRONTEND_CORE_API=https://10.210.0.49:5025/console/api
FRONTEND_APP_API=https://10.210.0.49:5025/api
FRONTEND_CORE_API=https://112.111.7.69:30382/console/api
FRONTEND_APP_API=https://112.111.7.69:30382/api

# SENTRY
NEXT_PUBLIC_SENTRY_DSN=
16 changes: 5 additions & 11 deletions front/app/(anotherLayout)/user/group/pageAiModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react'
import { Modal, Select, Table, message } from 'antd'
import PageAiCascader from './pageAiCascader'
import { getModelInfo, getModelListNew } from '@/infrastructure/api/modelWarehouse'
import { getAdjustList } from '@/infrastructure/api/prompt'
import { Service } from '@/infrastructure/api/generated'
type ModelItemType = {
id: string
model_type: string
Expand Down Expand Up @@ -67,7 +67,6 @@ type CascaderOptionType = {
const AiModel: React.FC<AiModelProps> = ({ open, onCancel, onOk, currentRecord }) => {
const [selectedServices, setSelectedServices] = useState<Record<string, string>>({})
const [selectedModels, setSelectedModels] = useState<Record<string, string[]>>({})
const [cascaderOptions, setCascaderOptions] = useState<CascaderOptionType[]>([])
const [cloudServiceOptions, setCloudServiceOptions] = useState<CascaderOptionType[]>([])
const [platformServiceOptions, setPlatformServiceOptions] = useState<CascaderOptionType[]>([])
const [modelData, setModelData] = useState<ModelItemType[]>([])
Expand Down Expand Up @@ -121,22 +120,18 @@ const AiModel: React.FC<AiModelProps> = ({ open, onCancel, onOk, currentRecord }
}
// 平台服务
const fetchPlatformData = async () => {
const url = '/infer-service/list'
const param: any = {
page: 1,
per_page: 9999,
user_id: [],
tenant: workspaceId,
}
try {
const res: any = await getAdjustList({
url,
body: param,
})
const res: any = await Service.postInferServiceList(param)

// 处理平台服务数据 - 数据在 res.result.result 中
if (res?.result?.result && Array.isArray(res.result.result)) {
const filteredResult = res.result.result.filter((item: any) => item.online_count > 0)
// 处理平台服务数据 - 数据在 res.data.result 中
if (res?.data?.result && Array.isArray(res.data.result)) {
const filteredResult = res.data.result.filter((item: any) => item.online_count > 0)
const options = filteredResult.map((item: any, index: number) => {
const option = {
value: item.id ? `${item.id}` : `service_${index}`,
Expand Down Expand Up @@ -198,7 +193,6 @@ const AiModel: React.FC<AiModelProps> = ({ open, onCancel, onOk, currentRecord }
const resetData = () => {
setSelectedServices({})
setSelectedModels({})
setCascaderOptions([])
setCloudServiceOptions([])
setPlatformServiceOptions([])
setModelData([])
Expand Down
10 changes: 5 additions & 5 deletions front/app/(appLayout)/datasets/datasetManager/EnhanceModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react'
import { Form, Input, Modal, Select } from 'antd'
import { createKnowledgeBase, updateKnowledgeBase } from '@/infrastructure/api/knowledgeBase'
import Toast from '@/app/components/base/flash-notice'
import { Service } from '@/infrastructure/api/generated'
import Toast, { ToastTypeEnum } from '@/app/components/base/flash-notice'
import { categoryItems } from '@/shared/utils'

const EnhanceModal = (props: any) => {
Expand All @@ -11,13 +11,13 @@ const EnhanceModal = (props: any) => {
const handleOk = async () => {
form.validateFields().then((values) => {
if (data) {
updateKnowledgeBase({ url: '/kb/update', body: { ...data, ...values } }).then((res) => {
Toast.notify({ type: 'success', message: '更新成功' })
Service.postKbUpdate({ ...data, ...values }).then((res: any) => {
Toast.notify({ type: ToastTypeEnum.Success, message: '更新成功' })
onSuccess(res.id, 'edit')
})
}
else {
createKnowledgeBase({ url: '/kb/create', body: values }).then((res) => {
Service.postKbCreate(values).then((res: any) => {
onSuccess(res.id, 'create')
onSuccess(res.id)
})
Expand Down
25 changes: 11 additions & 14 deletions front/app/(appLayout)/datasets/datasetManager/[id]/DataModal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import React, { useCallback, useEffect, useState } from 'react'
import { Form, Input, Modal, Radio, Select } from 'antd'
import { getScriptList, handleFile } from '@/infrastructure/api/knowledgeBase'
import Toast from '@/app/components/base/flash-notice'
import { Service } from '@/infrastructure/api/generated'
import Toast, { ToastTypeEnum } from '@/app/components/base/flash-notice'
import { tagList } from '@/app/components/tagSelect/ClassifyMode'
import { bindTags } from '@/infrastructure/api/tagManage'
import { noOnlySpacesRule } from '@/shared/utils'
Expand Down Expand Up @@ -59,7 +59,7 @@ const CleanModal = (props: any) => {
setLoading(true)
const values = await form.validateFields()
if (data) {
const { version, script_agent, data_set_script_id, agent, script_type, ...rest } = values
const { version: _version, script_agent, data_set_script_id, agent, script_type, ...rest } = values

// 构造请求参数
const requestData = {
Expand All @@ -77,11 +77,8 @@ const CleanModal = (props: any) => {
requestData.data_set_script_id = agent
}

const res: any = await handleFile({
url: '/data/version/clean_or_augment',
body: requestData,
})
Toast.notify({ type: 'success', message: '操作成功' })
const res: any = await Service.postDataVersionCleanOrAugment(requestData)
Toast.notify({ type: ToastTypeEnum.Success, message: '操作成功' })
onSuccess(res.id, 'edit')
}
}
Expand All @@ -94,7 +91,7 @@ const CleanModal = (props: any) => {
if (err instanceof Response && err.status === 423)
return

Toast.notify({ type: 'error', message: '操作失败,请重试' })
Toast.notify({ type: ToastTypeEnum.Error, message: '操作失败,请重试' })
}
finally {
setLoading(false)
Expand All @@ -108,22 +105,22 @@ const CleanModal = (props: any) => {
}

// 清空所有数据
const clearAllData = () => {
const clearAllData = useCallback(() => {
form.resetFields()
setProcessType('')
setProcessMethod('')
setScriptList([])
setAgentList([])
setLoading(false)
}
}, [form])

const getScriptListData = async (scriptType: string) => {
if (!scriptType) {
setScriptList([])
return
}
try {
const res: any = await getScriptList({ url: '/script/list_by_type', options: { params: { script_type: scriptType } } })
const res: any = await Service.getScriptListByType(scriptType)
setScriptList(res.map(item => ({ label: item.name, value: item.id })))
}
catch (error) {
Expand Down Expand Up @@ -192,7 +189,7 @@ const CleanModal = (props: any) => {
else {
data && form.setFieldsValue(data)
}
}, [visible, data, form])
}, [visible, data, form, clearAllData])

return (
<Modal title="数据处理" open={visible} onOk={handleOk} onCancel={handleCancel} cancelText='取消' okText='确定' confirmLoading={loading}>
Expand Down
23 changes: 8 additions & 15 deletions front/app/(appLayout)/datasets/scriptManager/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CreatorSelect from '@/app/components/tagSelect/creatorSelect'
import ClassifyMode, { tagList } from '@/app/components/tagSelect/ClassifyMode'
import Iconfont from '@/app/components/base/iconFont'
import useAuthPermissions from '@/shared/hooks/use-radio-auth'
import { createPrompt, deletePrompt } from '@/infrastructure/api/prompt'
import { Service } from '@/infrastructure/api/generated'
import { getDatasetListNew } from '@/infrastructure/api/data'
import { API_PREFIX } from '@/app-specs'
const { Dragger } = Upload
Expand Down Expand Up @@ -112,8 +112,7 @@ const ScriptManage = () => {
}
const handleDelete = async (e, id: any) => {
e.stopPropagation()
const url = '/script/delete'
const res: any = await deletePrompt({ url, body: { script_id: id } })
const res: any = await Service.postScriptDelete({ script_id: Number(id) })
if (res.code === 200) {
message.success('删除成功')
setPageOption({ ...pageOption, page: 1 })
Expand All @@ -135,19 +134,13 @@ const ScriptManage = () => {
setIsView(false)
return
}
let gUrl = ''
if (isEdit)
gUrl = '/script/update'
else
gUrl = '/script/create'

form.validateFields().then(async (values) => {
setBtnLoading(true)
try {
const res: any = await createPrompt({
url: gUrl,
body: { ...values, icon: '' },
})
const submitValues = { ...values, icon: '' }
const res: any = isEdit
? await Service.postScriptUpdate(submitValues)
: await Service.postScriptCreate(submitValues)
if (res?.name) {
message.success('保存成功')
form.resetFields()
Expand Down Expand Up @@ -354,7 +347,7 @@ const ScriptManage = () => {
</Form.Item>
<Input.Search allowClear onChange={onSearchChange} value={sValue} onSearch={onSearch} style={{ width: 270 }} placeholder='请输入关键字进行搜索' />
</div>
{loading && !list?.length
{(loading && !list?.length)
? <div className='flex justify-center items-center' style={{ height: '400px' }}>
<Spin size="large" tip="加载中..." />
</div>
Expand Down Expand Up @@ -449,7 +442,7 @@ const ScriptManage = () => {
{
validator: (_, value) => {
if (value && value.trim() === '')
return Promise.reject('简介不能为空格')
return Promise.reject(new Error('简介不能为空格'))

return Promise.resolve()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// padding-top: 1.5625vw;
height: auto;
// overflow-x: scroll;

.panelSty {
:global(.ant-collapse-header) {
background: #FFF !important;
Expand Down
Loading