File tree Expand file tree Collapse file tree 5 files changed +15
-77
lines changed Expand file tree Collapse file tree 5 files changed +15
-77
lines changed Original file line number Diff line number Diff line change 1
1
import { createContext , useContext } from 'react'
2
2
import { useSearchParams } from 'react-router-dom'
3
3
4
- export const EmbeddedContext = createContext ( false )
4
+ const EmbeddedContext = createContext ( false )
5
5
6
6
export const EmbeddedProvider = ( { children } ) => {
7
7
const [ searchParams ] = useSearchParams ( )
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -21,25 +21,24 @@ const connection = {
21
21
const vlmQueue = new Queue ( 'vlm-pdf-processing' , { connection } )
22
22
const vlmQueueEvents = new QueueEvents ( 'vlm-pdf-processing' , { connection } )
23
23
24
- const vlmWorker = new Worker ( 'vlm-pdf-processing' , async ( job : Job ) => {
25
- const { pdfBuffer } = job . data
26
- const result = await pdfToText ( pdfBuffer )
27
-
28
- return result
29
-
30
- } , { connection, autorun : false } )
31
-
32
- export const pdfToTextWithVLM = async (
33
- fileBuffer : Buffer
34
- ) => {
24
+ const vlmWorker = new Worker (
25
+ 'vlm-pdf-processing' ,
26
+ async ( job : Job ) => {
27
+ const { pdfBuffer } = job . data
28
+ const result = await pdfToText ( pdfBuffer )
29
+
30
+ return result
31
+ } ,
32
+ { connection, autorun : false } ,
33
+ )
34
+
35
+ export const pdfToTextWithVLM = async ( fileBuffer : Buffer ) => {
35
36
const job = await vlmQueue . add ( 'vlm-pdf-processing' , {
36
- pdfBuffer : fileBuffer
37
+ pdfBuffer : fileBuffer ,
37
38
} )
38
39
39
40
const result = await job . waitUntilFinished ( vlmQueueEvents )
40
41
return result
41
42
}
42
43
43
44
vlmWorker . run ( )
44
-
45
-
Original file line number Diff line number Diff line change 1
1
import crypto from 'crypto'
2
2
3
3
import { CustomMessage } from '../types'
4
- import { DEFAULT_MODEL , DEFAUL_CONTEXT_LIMIT , validModels } from '../../config'
5
- import { ChatInstance } from '../db/models'
4
+ import { DEFAUL_CONTEXT_LIMIT , validModels } from '../../config'
6
5
7
6
/**
8
7
* Filter out messages in a long conversation to save costs
@@ -18,17 +17,6 @@ export const getMessageContext = (messages: CustomMessage[]): CustomMessage[] =>
18
17
return systemMessages . concat ( latestMessages )
19
18
}
20
19
21
- export const getCourseModel = async ( courseId : string ) : Promise < string > => {
22
- const chatInstance = await ChatInstance . findOne ( {
23
- where : {
24
- courseId,
25
- } ,
26
- attributes : [ 'model' ] ,
27
- } )
28
-
29
- return chatInstance ?. model || DEFAULT_MODEL
30
- }
31
-
32
20
export const getAllowedModels = ( model : string ) : string [ ] => {
33
21
const allModels = validModels . map ( ( { name } ) => name )
34
22
You can’t perform that action at this time.
0 commit comments