Skip to content

Commit 5815d06

Browse files
authored
Merge pull request #7 from JawherKl/feature/7-update-api-work
update analyze and search api
2 parents bad17b1 + 722d1b9 commit 5815d06

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/controllers/analyzeController.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { analyzeData } from "../services/analyzeService.mjs";
22

33
export async function analyzeText(req, res) {
44
try {
5-
const { text } = req.body;
6-
const analysis = await analyzeData(text);
5+
const { text, model } = req.body;
6+
const analysis = await analyzeData(text, model);
77
res.json({ analysis });
88
} catch (error) {
99
res.status(500).json({ error: error.message });

src/services/analyzeService.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import openai from "../config/openAIConfig.mjs";
22

3-
export async function analyzeData(text) {
3+
export async function analyzeData(text, model) {
44
try {
55
const completion = await openai.chat.completions.create({
6-
model: "gpt-4-turbo",
6+
model: model || "gpt-4o-mini",
77
messages: [
88
{
99
role: "system",

src/services/searchService.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export async function semanticSearch(query, model) {
88

99
try {
1010
const completion = await openai.chat.completions.create({
11-
model: model || "gpt-4-turbo",
11+
model: model || "gpt-4o-mini",
1212
messages: [
1313
{
1414
role: "system",

0 commit comments

Comments
 (0)