Feature/OpenAI Assistant V2 (#2258)

* add gpt4 turbo to assistant

* OpenAI Assistant V2

* update langfuse handler
This commit is contained in:
Henry Heng
2024-04-25 20:14:04 +01:00
committed by GitHub
parent 4782c0f6fc
commit 7360d1d9a6
25 changed files with 23422 additions and 17637 deletions
+21
View File
@@ -420,6 +420,11 @@ export class AnalyticHandler {
}
if (langfuseTraceClient) {
langfuseTraceClient.update({
input: {
text: input
}
})
const span = langfuseTraceClient.span({
name,
input: {
@@ -472,6 +477,14 @@ export class AnalyticHandler {
span.end({
output
})
const langfuseTraceClient = this.handlers['langFuse'].trace[returnIds['langFuse'].trace]
if (langfuseTraceClient) {
langfuseTraceClient.update({
output: {
output
}
})
}
if (shutdown) {
const langfuse: Langfuse = this.handlers['langFuse'].client
await langfuse.shutdownAsync()
@@ -513,6 +526,14 @@ export class AnalyticHandler {
error
}
})
const langfuseTraceClient = this.handlers['langFuse'].trace[returnIds['langFuse'].trace]
if (langfuseTraceClient) {
langfuseTraceClient.update({
output: {
error
}
})
}
if (shutdown) {
const langfuse: Langfuse = this.handlers['langFuse'].client
await langfuse.shutdownAsync()
+4 -2
View File
@@ -14,10 +14,10 @@ export const addBase64FilesToStorage = async (file: string, chatflowid: string,
const bf = Buffer.from(splitDataURI.pop() || '', 'base64')
const mime = splitDataURI[0].split(':')[1].split(';')[0]
const key = chatflowid + '/' + filename
const Key = chatflowid + '/' + filename
const putObjCmd = new PutObjectCommand({
Bucket,
Key: key,
Key,
ContentEncoding: 'base64', // required for binary data
ContentType: mime,
Body: bf
@@ -61,6 +61,7 @@ export const addFileToStorage = async (mime: string, bf: Buffer, fileName: strin
Body: bf
})
await s3Client.send(putObjCmd)
return 'FILE-STORAGE::' + fileName
} else {
const dir = path.join(getStoragePath(), ...paths)
if (!fs.existsSync(dir)) {
@@ -69,6 +70,7 @@ export const addFileToStorage = async (mime: string, bf: Buffer, fileName: strin
const filePath = path.join(dir, fileName)
fs.writeFileSync(filePath, bf)
return 'FILE-STORAGE::' + fileName
}
}