Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
llm-train
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
llm-train
Commits
5d6c6bf8
Commit
5d6c6bf8
authored
Apr 10, 2024
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asder
parent
58b8a593
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
270 additions
and
159 deletions
+270
-159
111695735540_.pic-1712496790213-754592899.jpeg
...2024-04-07/111695735540_.pic-1712496790213-754592899.jpeg
+0
-0
111695735540_.pic-1712496834955-441001761.jpeg
...2024-04-07/111695735540_.pic-1712496834955-441001761.jpeg
+0
-0
1674969615895-1712733709433-68630179.jpeg
...oads/2024-04-10/1674969615895-1712733709433-68630179.jpeg
+0
-0
page.jsx
src/app/collectiondetail/[slug]/page.jsx
+42
-31
page.jsx
src/app/detail/[slug]/page.jsx
+12
-3
layout.jsx
src/app/layout.jsx
+2
-2
page.jsx
src/app/page.jsx
+10
-2
AddCollection.jsx
src/components/AddCollection.jsx
+10
-22
Cards.jsx
src/components/Cards.jsx
+1
-9
DeleteCollection.jsx
src/components/DeleteCollection.jsx
+6
-13
EditCollection.jsx
src/components/EditCollection.jsx
+178
-74
EditFolder.jsx
src/components/EditFolder.jsx
+9
-3
No files found.
public/uploads/2024-04-07/111695735540_.pic-1712496790213-754592899.jpeg
deleted
100644 → 0
View file @
58b8a593
823 KB
public/uploads/2024-04-07/111695735540_.pic-1712496834955-441001761.jpeg
deleted
100644 → 0
View file @
58b8a593
823 KB
public/uploads/2024-04-10/1674969615895-1712733709433-68630179.jpeg
0 → 100644
View file @
5d6c6bf8
177 KB
src/app/collectiondetail/[slug]/page.jsx
View file @
5d6c6bf8
"use client"
;
import
{
getFetch
}
from
"@/lib/doFetch"
;
import
{
useRequest
}
from
"ahooks"
;
import
{
Button
}
from
"@nextui-org/react"
;
import
{
ArrowLeftOutlined
}
from
"@ant-design/icons"
;
import
EditFolder
from
"@/components/EditFolder"
;
import
DeleteFolder
from
"@/components/DeleteFolder"
;
import
EditCollection
from
"@/components/EditCollection"
;
import
DeleteCollection
from
"@/components/DeleteCollection"
;
import
{
useRouter
}
from
"next/navigation"
;
import
{
message
}
from
'antd'
;
import
{
IoMdShareAlt
}
from
"react-icons/io"
;
const
columns
=
[
...
...
@@ -39,36 +38,48 @@ export default function Detail({ params }) {
}
);
const
handleCopy
=
()
=>
{
const
textToCopy
=
window
.
location
.
href
;
navigator
.
clipboard
.
writeText
(
textToCopy
)
.
then
(()
=>
{
message
.
success
(
'链接复制成功'
)
})
.
catch
(
err
=>
{
console
.
error
(
'Failed to copy text to clipboard:'
,
err
);
});
};
return
(
<
div
className=
"flex w-full flex-col"
>
<
div
className=
"flex gap-4"
>
<
Button
isIconOnly
color=
"primary
"
variant=
"fade
d"
aria
-
label=
"Take a add"
onPress=
{
()
=>
{
router
.
back
();
}
}
>
<
ArrowLeftOutlined
></
ArrowLeftOutlined
>
</
Button
>
<
Button
color=
"primary"
variant=
"flat"
>
{
data
?.
name
}
</
Button
>
<
EditFolder
data=
{
data
}
refresh=
{
refreshAsync
}
/>
<
DeleteFolder
data=
{
data
}
refresh=
{
refreshAsync
}
/
>
</
div
>
<
ul
class=
"divide-y divide-gray-200"
>
<
div
className=
"flex gap-4"
>
<
Button
isIconOnly
color=
"primary"
variant=
"faded
"
aria
-
label=
"Take a ad
d"
onPress=
{
()
=>
{
router
.
back
();
}
}
>
<
ArrowLeftOutlined
></
ArrowLeftOutlined
>
</
Button
>
<
Button
color=
"primary"
variant=
"flat"
onPress=
{
handleCopy
}
endContent=
{
<
IoMdShareAlt
style=
{
{
fontSize
:
24
}
}
/>
}
>
分享
</
Button
>
<
EditCollection
data=
{
data
}
refresh=
{
refreshAsync
}
/>
<
DeleteCollection
data=
{
data
}
refresh=
{
refreshAsync
}
/>
</
div
>
<
div
className=
"w-full object-cover h-[180px] flex justify-center items-center bg-gradient-to-r from-cyan-500 to-blue-500 text-white text-xl rounded-2xl mt-6"
>
{
data
?.
name
}
</
div
>
<
ul
class
Name
=
"divide-y divide-gray-200"
>
{
columns
?.
map
((
it
)
=>
{
return
(
<
li
class=
"flex items-center py-4"
key=
{
it
?.
name
}
>
<
div
class=
"ml-4"
>
<
div
class=
"text-sm font-medium text-gray-900"
>
{
it
?.
label
}
</
div
>
<
div
class
=
"text-sm text-gray-500
"
>
{
data
?.[
it
?.
name
]
}
</
div
>
<
li
class
Name
=
"flex items-center py-4"
key=
{
it
?.
name
}
>
<
div
class
Name
=
"ml-4"
>
<
div
class
Name
=
"text-sm font-medium text-gray-900"
>
{
it
?.
label
}
</
div
>
<
div
class
Name=
"text-sm text-gray-500 mt-2
"
>
{
data
?.[
it
?.
name
]
}
</
div
>
</
div
>
</
li
>
);
...
...
src/app/detail/[slug]/page.jsx
View file @
5d6c6bf8
...
...
@@ -77,15 +77,24 @@ export default function Detail({ folder, params }) {
></
AddFolder
>
<
Divider
orientation=
"vertical"
/>
<
AddCollection
refresh=
{
refreshAsync
}
parentId=
{
params
.
slug
}
type=
{
"icon"
}
refresh=
{
refreshAsync
}
parentId=
{
params
.
slug
}
type=
{
"icon"
}
/>
</
div
>
<
div
className=
"mt-8 flex flex-wrap gap-2"
>
<
Cards
list=
{
data
?.
folders
??
[]
}
></
Cards
>
<
Collections
list=
{
data
?.
collections
??
[]
}
></
Collections
>
{
data
?.
folders
?.
length
===
0
&&
data
?.
collections
?.
length
===
0
&&
(
<
Image
alt=
"empty"
isZoomed
className=
"object-cover"
src=
"/empty.png"
width=
{
240
}
/>
)
}
</
div
>
</
div
>
</
div
>
...
...
src/app/layout.jsx
View file @
5d6c6bf8
...
...
@@ -7,8 +7,8 @@ import { Providers } from "./providers";
// const inter = Inter({ subsets: ["latin"] });
export
const
metadata
=
{
title
:
"
Create Next App
"
,
description
:
"
Generated by create next app
"
,
title
:
"
语言模型训练数据库
"
,
description
:
"
语言模型训练数据库
"
,
};
export
default
function
RootLayout
({
children
})
{
...
...
src/app/page.jsx
View file @
5d6c6bf8
...
...
@@ -5,10 +5,9 @@ import AddFolder from "@/components/AddFolder";
import
AddCollection
from
"@/components/AddCollection"
;
import
Cards
from
"@/components/Cards"
;
import
Collections
from
"@/components/Collections"
;
import
{
useRequest
}
from
"ahooks"
;
import
{
getFetch
}
from
"@/lib/doFetch"
;
import
{
Image
}
from
"@nextui-org/react"
;
export
default
function
Home
(
props
)
{
const
{
data
,
refreshAsync
,
refresh
}
=
useRequest
(
async
()
=>
{
...
...
@@ -29,6 +28,15 @@ export default function Home(props) {
<
div
className=
"flex gap-4"
>
<
Cards
list=
{
data
??
[]
}
/>
<
Collections
list=
{
collection
?.
data
??
[]
}
/>
{
data
?.
length
===
0
&&
collection
?.
data
?.
length
===
0
&&
(
<
Image
alt=
"empty"
isZoomed
className=
"object-cover"
src=
"/empty.png"
width=
{
240
}
/>
)
}
</
div
>
</
div
>
);
...
...
src/components/AddCollection.jsx
View file @
5d6c6bf8
...
...
@@ -23,15 +23,15 @@ export default function AddCollection({ refresh, parentId, type }) {
const
handleButtonClick
=
async
(
close
)
=>
{
// 手动触发表单提交
handleSubmit
(
onSubmit
)();
await
refresh
();
close
();
};
const
onSubmit
=
async
(
data
)
=>
{
return
await
doFetch
({
await
doFetch
({
url
:
"/api/collection"
,
params
:
{
...
data
,
parentId
:
parentId
?
parseInt
(
parentId
)
:
null
},
params
:
{
...
data
,
parentId
:
parentId
?
parseInt
(
parentId
)
:
null
},
});
await
refresh
();
};
return
(
...
...
@@ -100,58 +100,46 @@ export default function AddCollection({ refresh, parentId, type }) {
type=
"text"
label=
"编码"
name=
"code"
{
...
register
("
code
"
,
{
required
:
true
,
maxLength
:
20
}
)}
{
...
register
("
code
")}
/>
<
Input
type=
"text"
label=
"故障类型"
name=
"faultType"
{
...
register
("
faultType
",
{
required
:
true
,
maxLength
:
20,
})}
{
...
register
("
faultType
")}
/>
<
Input
type=
"text"
label=
"故障"
name=
"fault"
{
...
register
("
fault
"
,
{
required
:
true
,
maxLength
:
20
}
)}
{
...
register
("
fault
")}
/>
<
Textarea
type=
"text"
label=
"判断条件"
name=
"faultJudge"
{
...
register
("
faultJudge
",
{
required
:
true
,
maxLength
:
20,
})}
{
...
register
("
faultJudge
")}
/>
<
Textarea
type=
"text"
label=
"故障原因"
name=
"faultReason"
{
...
register
("
faultReason
",
{
required
:
true
,
maxLength
:
20,
})}
{
...
register
("
faultReason
")}
/>
<
Textarea
type=
"text"
label=
"解决方案"
name=
"faultFn"
{
...
register
("
faultFn
"
,
{
required
:
true
,
maxLength
:
20
}
)}
{
...
register
("
faultFn
")}
/>
<
Textarea
type=
"text"
label=
"故障描述"
name=
"faultMessage"
{
...
register
("
faultMessage
",
{
required
:
true
,
maxLength
:
20,
})}
{
...
register
("
faultMessage
")}
/>
</
form
>
</
ModalBody
>
...
...
src/components/Cards.jsx
View file @
5d6c6bf8
...
...
@@ -12,6 +12,7 @@ export default memo(({ list }) => {
const
router
=
useRouter
();
return
(
list
?.
length
>
0
&&
<
div
className=
"gap-2 flex flex-wrap"
>
{
list
?.
map
?.((
item
,
index
)
=>
(
<
Card
...
...
@@ -41,15 +42,6 @@ export default memo(({ list }) => {
</
CardFooter
>
</
Card
>
))
}
{
list
?.
length
===
0
&&
(
<
Image
alt=
"empty"
isZoomed
className=
"object-cover"
src=
"/empty.png"
width=
{
240
}
/>
)
}
</
div
>
);
});
src/components/DeleteCollection.jsx
View file @
5d6c6bf8
import
React
,
{
useEffect
}
from
"react"
;
import
React
from
"react"
;
import
{
Modal
,
ModalContent
,
...
...
@@ -7,24 +7,20 @@ import {
ModalFooter
,
Button
,
useDisclosure
,
Input
,
}
from
"@nextui-org/react"
;
import
{
useForm
,
Controller
}
from
"react-hook-form"
;
import
{
delFetch
,
doFetch
,
putFetch
}
from
"@/lib/doFetch"
;
import
UploadImage
from
"./UploadImage"
;
import
{
delFetch
}
from
"@/lib/doFetch"
;
import
{
BsTrash3Fill
}
from
"react-icons/bs"
;
import
{
useRouter
}
from
"next/navigation"
;
export
default
function
Delete
Folder
({
refresh
,
data
})
{
export
default
function
Delete
Collection
({
refresh
,
data
})
{
const
{
isOpen
,
onOpen
,
onOpenChange
}
=
useDisclosure
();
const
router
=
useRouter
();
const
handleButtonClick
=
async
(
close
)
=>
{
await
delFetch
({
url
:
"/api/folder/"
+
data
.
id
})
await
delFetch
({
url
:
"/api/collection/"
+
data
.
id
});
router
.
back
();
// 返回上一页
};
return
(
<>
<
Button
isIconOnly
color=
"danger"
aria
-
label=
"Like"
onPress=
{
onOpen
}
>
...
...
@@ -59,13 +55,10 @@ export default function DeleteFolder({ refresh, data }) {
{
(
onClose
)
=>
(
<>
<
ModalHeader
className=
"flex flex-col gap-1"
>
是否删除该
文件夹
是否删除该
知识库
</
ModalHeader
>
<
ModalBody
>
<
p
>
仅可删除空文件夹
</
p
>
<
p
>
删除后无法恢复请谨慎操作
</
p
>
</
ModalBody
>
<
ModalFooter
>
<
Button
color=
"danger"
variant=
"light"
onPress=
{
onClose
}
>
...
...
src/components/EditCollection.jsx
View file @
5d6c6bf8
This diff is collapsed.
Click to expand it.
src/components/EditFolder.jsx
View file @
5d6c6bf8
...
...
@@ -20,7 +20,13 @@ export default function EditFolder({ refresh, data }) {
const
{
isOpen
,
onOpen
,
onOpenChange
}
=
useDisclosure
();
const
router
=
useRouter
();
const
{
register
,
handleSubmit
,
control
,
setValue
,
formState
:
{
errors
},
}
=
useForm
({
const
{
register
,
handleSubmit
,
control
,
setValue
,
formState
:
{
errors
},
}
=
useForm
({
defaultValues
:
{
poster
:
data
?.
poster
,
name
:
data
?.
name
,
...
...
@@ -28,7 +34,7 @@ export default function EditFolder({ refresh, data }) {
});
useEffect
(()
=>
{
if
(
data
&&
isOpen
===
true
)
{
if
(
data
&&
isOpen
===
true
)
{
setValue
(
"poster"
,
data
.
poster
);
setValue
(
"name"
,
data
.
name
);
console
.
log
(
data
.
name
);
...
...
@@ -42,7 +48,7 @@ export default function EditFolder({ refresh, data }) {
};
const
onSubmit
=
async
(
params
)
=>
{
await
putFetch
({
url
:
"/api/folder/"
+
data
?.
id
,
params
});
await
putFetch
({
url
:
"/api/folder/"
+
data
?.
id
,
params
});
await
refresh
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment