feat(config): Use toml instead of env
This commit is contained in:
parent
dd1ce4e324
commit
c6a5790d33
26 changed files with 799 additions and 596 deletions
|
@ -1,5 +1,7 @@
|
|||
import express from 'express';
|
||||
import imageSearchChain from '../agents/imageSearchAgent';
|
||||
import handleImageSearch from '../agents/imageSearchAgent';
|
||||
import { ChatOpenAI } from '@langchain/openai';
|
||||
import { getOpenaiApiKey } from '../config';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
|
@ -7,11 +9,13 @@ router.post('/', async (req, res) => {
|
|||
try {
|
||||
const { query, chat_history } = req.body;
|
||||
|
||||
const images = await imageSearchChain.invoke({
|
||||
query,
|
||||
chat_history,
|
||||
const llm = new ChatOpenAI({
|
||||
temperature: 0.7,
|
||||
openAIApiKey: getOpenaiApiKey(),
|
||||
});
|
||||
|
||||
const images = await handleImageSearch({ query, chat_history }, llm);
|
||||
|
||||
res.status(200).json({ images });
|
||||
} catch (err) {
|
||||
res.status(500).json({ message: 'An error has occurred.' });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue