Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RAGchat-API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
zbhAI
RAGchat-API
Commits
0f5c632a
Commit
0f5c632a
authored
9 months ago
by
Embruch, Gerd
Browse files
Options
Downloads
Patches
Plain Diff
polishing
parent
1f26d15f
Branches
master
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
controllers/AI.js
+0
-2
0 additions, 2 deletions
controllers/AI.js
coverage/ragchat-api/routes/ai.js.html
+77
-74
77 additions, 74 deletions
coverage/ragchat-api/routes/ai.js.html
models/Chat.js
+1
-1
1 addition, 1 deletion
models/Chat.js
utils/handleAI.js
+0
-3
0 additions, 3 deletions
utils/handleAI.js
with
78 additions
and
80 deletions
controllers/AI.js
+
0
−
2
View file @
0f5c632a
...
@@ -121,9 +121,7 @@ export const getChat = async (req, res, next) => {
...
@@ -121,9 +121,7 @@ export const getChat = async (req, res, next) => {
*/
*/
export
const
getChats
=
async
(
req
,
res
,
next
)
=>
{
export
const
getChats
=
async
(
req
,
res
,
next
)
=>
{
try
{
try
{
// TODO sort chats by createdAt
const
chats
=
await
findRecords
(
Chat
,
{
createdBy
:
global
.
currentUserId
});
const
chats
=
await
findRecords
(
Chat
,
{
createdBy
:
global
.
currentUserId
});
// const chats = await Chat.find({ createdBy: global.currentUserId }).sort({ 'createdAt': 1 });
return
res
.
json
({
chats
});
return
res
.
json
({
chats
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
...
This diff is collapsed.
Click to expand it.
coverage/ragchat-api/routes/ai.js.html
+
77
−
74
View file @
0f5c632a
<!doctype html>
<!doctype html>
<html
lang=
"en"
>
<html
lang=
"en"
>
...
@@ -52,7 +51,8 @@
...
@@ -52,7 +51,8 @@
</div>
</div>
<p
class=
"quiet"
>
<p
class=
"quiet"
>
Press
<em>
n
</em>
or
<em>
j
</em>
to go to the next uncovered block,
<em>
b
</em>
,
<em>
p
</em>
or
<em>
k
</em>
for the previous block.
Press
<em>
n
</em>
or
<em>
j
</em>
to go to the next uncovered block,
<em>
b
</em>
,
<em>
p
</em>
or
<em>
k
</em>
for the
previous block.
</p>
</p>
<template
id=
"filterTemplate"
>
<template
id=
"filterTemplate"
>
<div
class=
"quiet"
>
<div
class=
"quiet"
>
...
@@ -348,10 +348,13 @@ router.post('/chat', verifyAccessToken, validate(chatSchema), checkRequestedMode
...
@@ -348,10 +348,13 @@ router.post('/chat', verifyAccessToken, validate(chatSchema), checkRequestedMode
* @header {authorization} Bearer [required] access token
* @header {authorization} Bearer [required] access token
* @return {object} list of found conversations, ordered by updated
* @return {object} list of found conversations, ordered by updated
*/
*/
// TODO sort chats by createdAt
router.get('/chats', verifyAccessToken, getChats);
router.get('/chats', verifyAccessToken, getChats);
export default router;
</pre></td></tr></table></pre>
export default router;
</pre>
</td>
</tr>
</table>
</pre>
<div
class=
'push'
></div>
<!-- for sticky footer -->
<div
class=
'push'
></div>
<!-- for sticky footer -->
</div>
<!-- /wrapper -->
</div>
<!-- /wrapper -->
...
@@ -369,5 +372,5 @@ export default router;</pre></td></tr></table></pre>
...
@@ -369,5 +372,5 @@ export default router;</pre></td></tr></table></pre>
<script
src=
"../../sorter.js"
></script>
<script
src=
"../../sorter.js"
></script>
<script
src=
"../../block-navigation.js"
></script>
<script
src=
"../../block-navigation.js"
></script>
</body>
</body>
</html>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
models/Chat.js
+
1
−
1
View file @
0f5c632a
...
@@ -60,7 +60,7 @@ ChatSchema.pre('save', async function (next) {
...
@@ -60,7 +60,7 @@ ChatSchema.pre('save', async function (next) {
ChatSchema
.
pre
(
'
find
'
,
function
(
next
)
{
ChatSchema
.
pre
(
'
find
'
,
function
(
next
)
{
// set default sort
// set default sort
if
(
typeof
this
.
options
.
sort
===
'
undefined
'
)
{
if
(
typeof
this
.
options
.
sort
===
'
undefined
'
)
{
this
.
options
.
sort
=
{
createdAt
:
1
};
this
.
options
.
sort
=
{
createdAt
:
-
1
};
}
}
next
();
next
();
});
});
...
...
This diff is collapsed.
Click to expand it.
utils/handleAI.js
+
0
−
3
View file @
0f5c632a
...
@@ -189,16 +189,13 @@ export const chat = async (req, res, next) => {
...
@@ -189,16 +189,13 @@ export const chat = async (req, res, next) => {
// if history given
// if history given
if
(
invokeInput
.
chat_history
.
length
>
0
)
{
if
(
invokeInput
.
chat_history
.
length
>
0
)
{
// input into contextualized question
// input into contextualized question
console
.
log
(
'
contextualizing input
'
);
return
contextualizeQChain
;
return
contextualizeQChain
;
}
}
// simply return input if no history given
// simply return input if no history given
console
.
log
(
'
keeping input as is
'
);
return
invokeInput
.
input
;
return
invokeInput
.
input
;
}
}
}).
assign
({
}).
assign
({
docs
:
async
(
invokeInput
)
=>
{
docs
:
async
(
invokeInput
)
=>
{
console
.
log
(
'
question
'
,
invokeInput
.
question
);
// fetch question related docs from retriever
// fetch question related docs from retriever
return
await
retriever
.
invoke
(
invokeInput
.
question
);
return
await
retriever
.
invoke
(
invokeInput
.
question
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment