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
ae2887e9
authored
Sep 11, 2023
by
Archer
Committed by
GitHub
Sep 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: file_id undefined bug (#275)
parent
79177660
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
client/src/pages/api/admin/initv44.ts
+11
-2
client/src/pages/api/openapi/plugin/vector.ts
+1
-0
client/src/service/pg.ts
+1
-1
No files found.
client/src/pages/api/admin/initv44.ts
View file @
ae2887e9
...
...
@@ -3,7 +3,9 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import
{
jsonRes
}
from
'@/service/response'
;
import
{
authUser
}
from
'@/service/utils/auth'
;
import
{
connectToDatabase
,
KB
}
from
'@/service/mongo'
;
import
{
KbTypeEnum
,
KbTypeMap
}
from
'@/constants/kb'
;
import
{
KbTypeEnum
}
from
'@/constants/kb'
;
import
{
PgClient
}
from
'@/service/pg'
;
import
{
PgTrainingTableName
}
from
'@/constants/plugin'
;
export
default
async
function
handler
(
req
:
NextApiRequest
,
res
:
NextApiResponse
)
{
try
{
...
...
@@ -22,7 +24,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
);
jsonRes
(
res
,
{});
const
response
=
await
PgClient
.
update
(
PgTrainingTableName
,
{
where
:
[[
'file_id'
,
'undefined'
]],
values
:
[{
key
:
'file_id'
,
value
:
''
}]
});
jsonRes
(
res
,
{
data
:
response
.
rowCount
});
}
catch
(
error
)
{
jsonRes
(
res
,
{
code
:
500
,
...
...
client/src/pages/api/openapi/plugin/vector.ts
View file @
ae2887e9
...
...
@@ -68,6 +68,7 @@ export async function getVector({
)
.
then
(
async
(
res
)
=>
{
if
(
!
res
.
data
?.
data
?.[
0
]?.
embedding
)
{
console
.
log
(
res
.
data
);
// @ts-ignore
return
Promise
.
reject
(
res
.
data
?.
err
?.
message
||
'Embedding API Error'
);
}
...
...
client/src/service/pg.ts
View file @
ae2887e9
...
...
@@ -179,7 +179,7 @@ export const insertKbItem = ({
{ key: 'user_id', value: userId },
{ key: 'kb_id', value: kbId },
{ key: 'source', value: item.source?.slice(0, 30)?.trim() || '' },
{ key: 'file_id', value: item.file_id },
{ key: 'file_id', value: item.file_id
|| ''
},
{ key: 'q', value: item.q.replace(/'/g, '"') },
{ key: 'a', value: item.a.replace(/'/g, '"') },
{ key: 'vector', value: `
[
$
{
item
.
vector
}]
` }
...
...
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