Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
a70d2aa9
authored
Jun 28, 2025
by
Archer
Committed by
GitHub
Jun 28, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: input modal (#5108)
* fix: input modal * fix: input modal * fix: chat logs count
parent
8e18562c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
47 deletions
+64
-47
docSite/content/zh-cn/docs/development/upgrading/4914.md
+2
-0
packages/service/core/chat/chatItemSchema.ts
+1
-3
projects/app/src/pageComponents/dataset/detail/InputDataModal.tsx
+26
-39
projects/app/src/pages/api/core/app/getChatLogs.ts
+35
-5
No files found.
docSite/content/zh-cn/docs/development/upgrading/4914.md
View file @
a70d2aa9
...
@@ -38,3 +38,4 @@ weight: 786
...
@@ -38,3 +38,4 @@ weight: 786
1.
知识库数据输入,识别 QA 模式错误。
1.
知识库数据输入,识别 QA 模式错误。
2.
知识库标签条件冲突。
2.
知识库标签条件冲突。
3.
对话日志点赞点踩统计。
\ No newline at end of file
packages/service/core/chat/chatItemSchema.ts
View file @
a70d2aa9
...
@@ -64,9 +64,7 @@ const ChatItemSchema = new Schema({
...
@@ -64,9 +64,7 @@ const ChatItemSchema = new Schema({
memories
:
Object
,
memories
:
Object
,
errorMsg
:
String
,
errorMsg
:
String
,
userGoodFeedback
:
String
,
userGoodFeedback
:
String
,
userBadFeedback
:
{
userBadFeedback
:
String
,
type
:
String
},
customFeedbacks
:
[
String
],
customFeedbacks
:
[
String
],
adminFeedback
:
{
adminFeedback
:
{
type
:
{
type
:
{
...
...
projects/app/src/pageComponents/dataset/detail/InputDataModal.tsx
View file @
a70d2aa9
...
@@ -76,58 +76,47 @@ const InputDataModal = ({
...
@@ -76,58 +76,47 @@ const InputDataModal = ({
});
});
const
imagePreivewUrl
=
watch
(
'imagePreivewUrl'
);
const
imagePreivewUrl
=
watch
(
'imagePreivewUrl'
);
const
{
data
:
collection
=
defaultCollectionDetail
}
=
useRequest2
(
const
{
data
:
collection
=
defaultCollectionDetail
,
loading
:
initLoading
}
=
useRequest2
(
()
=>
getDatasetCollectionById
(
collectionId
),
{
manual
:
false
,
refreshDeps
:
[
collectionId
],
onSuccess
(
res
)
{
if
(
res
.
type
===
DatasetCollectionTypeEnum
.
images
)
{
setCurrentTab
(
TabEnum
.
image
);
}
}
}
);
// Get data
const
{
data
:
dataItem
,
loading
:
isFetchingData
}
=
useRequest2
(
async
()
=>
{
async
()
=>
{
if
(
dataId
)
return
getDatasetDataItemById
(
dataId
);
const
[
collection
,
dataItem
]
=
await
Promise
.
all
([
return
null
;
getDatasetCollectionById
(
collectionId
),
},
...(
dataId
?
[
getDatasetDataItemById
(
dataId
)]
:
[])
{
]);
manual
:
false
,
refreshDeps
:
[
dataId
],
if
(
dataItem
)
{
onSuccess
(
res
)
{
setCurrentTab
(
dataItem
?.
a
?
TabEnum
.
qa
:
TabEnum
.
chunk
);
if
(
res
)
{
reset
({
reset
({
q
:
res
.
q
||
''
,
q
:
dataItem
.
q
||
''
,
a
:
res
.
a
||
''
,
a
:
dataItem
.
a
||
''
,
imagePreivewUrl
:
res
.
imagePreivewUrl
,
imagePreivewUrl
:
dataItem
.
imagePreivewUrl
,
indexes
:
res
.
indexes
.
map
((
item
)
=>
({
indexes
:
dataItem
.
indexes
.
map
((
item
)
=>
({
...
item
,
...
item
,
fold
:
true
fold
:
true
}))
}))
});
});
}
else
if
(
defaultValue
)
{
}
else
if
(
defaultValue
)
{
setCurrentTab
(
defaultValue
?.
a
?
TabEnum
.
qa
:
TabEnum
.
chunk
);
reset
({
reset
({
q
:
defaultValue
.
q
||
''
,
q
:
defaultValue
.
q
||
''
,
a
:
defaultValue
.
a
||
''
,
a
:
defaultValue
.
a
||
''
,
imagePreivewUrl
:
defaultValue
.
imagePreivewUrl
imagePreivewUrl
:
defaultValue
.
imagePreivewUrl
});
});
}
else
{
setCurrentTab
(
TabEnum
.
chunk
);
}
}
},
onError
(
err
)
{
// Forcus reset to image tab
onClose
();
if
(
collection
.
type
===
DatasetCollectionTypeEnum
.
images
)
{
setCurrentTab
(
TabEnum
.
image
);
}
}
return
collection
;
},
{
manual
:
false
,
refreshDeps
:
[
collectionId
,
dataId
,
defaultValue
]
}
}
);
);
useEffect
(()
=>
{
if
(
currentTab
||
!
dataItem
)
return
;
setCurrentTab
(
dataItem
.
a
?
TabEnum
.
qa
:
TabEnum
.
chunk
);
},
[
collection
,
dataItem
,
currentTab
]);
// Import new data
// Import new data
const
{
runAsync
:
sureImportData
,
loading
:
isImporting
}
=
useRequest2
(
const
{
runAsync
:
sureImportData
,
loading
:
isImporting
}
=
useRequest2
(
async
(
e
:
InputDataType
)
=>
{
async
(
e
:
InputDataType
)
=>
{
...
@@ -138,7 +127,7 @@ const InputDataModal = ({
...
@@ -138,7 +127,7 @@ const InputDataModal = ({
q
:
e
.
q
,
q
:
e
.
q
,
a
:
currentTab
===
TabEnum
.
qa
?
e
.
a
:
''
,
a
:
currentTab
===
TabEnum
.
qa
?
e
.
a
:
''
,
// Contains no default index
// Contains no default index
indexes
:
e
.
indexes
.
filter
((
item
)
=>
!!
item
.
text
?.
trim
())
indexes
:
e
.
indexes
?.
filter
((
item
)
=>
!!
item
.
text
?.
trim
())
||
[]
};
};
const
dataId
=
await
postInsertData2Dataset
(
postData
);
const
dataId
=
await
postInsertData2Dataset
(
postData
);
...
@@ -194,8 +183,6 @@ const InputDataModal = ({
...
@@ -194,8 +183,6 @@ const InputDataModal = ({
}
}
);
);
const
isLoading
=
isFetchingData
;
const
icon
=
useMemo
(
const
icon
=
useMemo
(
()
=>
getCollectionIcon
({
type
:
collection
.
type
,
name
:
collection
.
sourceName
}),
()
=>
getCollectionIcon
({
type
:
collection
.
type
,
name
:
collection
.
sourceName
}),
[
collection
]
[
collection
]
...
@@ -240,7 +227,7 @@ const InputDataModal = ({
...
@@ -240,7 +227,7 @@ const InputDataModal = ({
<
MyBox
<
MyBox
display=
{
'flex'
}
display=
{
'flex'
}
flexDir=
{
'column'
}
flexDir=
{
'column'
}
isLoading=
{
i
s
Loading
}
isLoading=
{
i
nit
Loading
}
h=
{
'100%'
}
h=
{
'100%'
}
py=
{
[
6
,
'1.5rem'
]
}
py=
{
[
6
,
'1.5rem'
]
}
>
>
...
...
projects/app/src/pages/api/core/app/getChatLogs.ts
View file @
a70d2aa9
...
@@ -86,14 +86,44 @@ async function handler(
...
@@ -86,14 +86,44 @@ async function handler(
$group
:
{
$group
:
{
_id
:
null
,
_id
:
null
,
messageCount
:
{
$sum
:
1
},
messageCount
:
{
$sum
:
1
},
goodFeedback
:
{
$sum
:
{
$cond
:
[{
$eq
:
[
'$userGoodFeedback'
,
true
]
},
1
,
0
]
}
},
goodFeedback
:
{
badFeedback
:
{
$sum
:
{
$cond
:
[{
$eq
:
[
'$userBadFeedback'
,
true
]
},
1
,
0
]
}
},
$sum
:
{
$cond
:
[
{
$ifNull
:
[
'$userGoodFeedback'
,
false
]
},
1
,
0
]
}
},
badFeedback
:
{
$sum
:
{
$cond
:
[
{
$ifNull
:
[
'$userBadFeedback'
,
false
]
},
1
,
0
]
}
},
customFeedback
:
{
customFeedback
:
{
$sum
:
{
$sum
:
{
$cond
:
[{
$gt
:
[{
$size
:
{
$ifNull
:
[
'$customFeedbacks'
,
[]]
}
},
0
]
},
1
,
0
]
$cond
:
[{
$gt
:
[{
$size
:
{
$ifNull
:
[
'$customFeedbacks'
,
[]]
}
},
0
]
},
1
,
0
]
}
}
},
},
adminMark
:
{
$sum
:
{
$cond
:
[{
$eq
:
[
'$adminFeedback'
,
true
]
},
1
,
0
]
}
}
adminMark
:
{
$sum
:
{
$cond
:
[
{
$ifNull
:
[
'$adminFeedback'
,
false
]
},
1
,
0
]
}
}
}
}
}
}
],
],
...
@@ -140,9 +170,9 @@ async function handler(
...
@@ -140,9 +170,9 @@ async function handler(
),
),
MongoChat
.
countDocuments
(
where
,
{
...
readFromSecondary
})
MongoChat
.
countDocuments
(
where
,
{
...
readFromSecondary
})
]);
]);
console
.
log
(
list
);
const
listWithSourceMember
=
await
addSourceMember
({
const
listWithSourceMember
=
await
addSourceMember
({
list
:
list
list
});
});
const
listWithoutTmbId
=
list
.
filter
((
item
)
=>
!
item
.
tmbId
);
const
listWithoutTmbId
=
list
.
filter
((
item
)
=>
!
item
.
tmbId
);
...
...
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