|
1 | 1 | import express from 'express'
|
2 | 2 | import { DEFAULT_TOKEN_LIMIT, FREE_MODEL, inProduction } from '../../../config'
|
| 3 | +import type { ChatMessage } from '../../../shared/llmTypes' |
| 4 | +import type { ResponseStreamEventData } from '../../../shared/types' |
3 | 5 | import { ChatInstance, Discussion, UserChatInstanceUsage } from '../../db/models'
|
4 | 6 | import { calculateUsage, checkCourseUsage, checkUsage, incrementCourseUsage, incrementUsage } from '../../services/chatInstances/usage'
|
| 7 | +import { createChatStream, streamChatResponse } from '../../services/langchain/chat' |
5 | 8 | import type { RequestWithUser } from '../../types'
|
6 | 9 | import { ApplicationError } from '../../util/ApplicationError'
|
7 | 10 | import logger from '../../util/logger'
|
8 | 11 | import getEncoding from '../../util/tiktoken'
|
9 |
| -import { getAllowedModels, getMessageContext, getModelContextLimit } from '../../util/util' |
| 12 | +import { getAllowedModels, getModelContextLimit } from '../../util/util' |
10 | 13 | import { parseFileAndAddToLastMessage } from './fileParsing'
|
11 | 14 | import { upload } from './multer'
|
12 |
| -import { type MessageType, PostStreamSchemaV3 } from './types' |
13 |
| -import { createChatStream, streamChatResponse } from '../../services/langchain/chat' |
14 |
| -import { IterableReadableStream } from '@langchain/core/utils/stream' |
15 |
| -import { AIMessageChunk } from '@langchain/core/messages' |
16 |
| -import { ChatMessage } from '../../../shared/llmTypes' |
17 |
| -import { ResponseStreamEventData } from '../../../shared/types' |
| 15 | +import { PostStreamSchemaV3 } from './types' |
18 | 16 |
|
19 | 17 | const router = express.Router()
|
20 | 18 |
|
|
0 commit comments