diff --git a/README.md b/README.md index 59b8232..8b362d6 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,66 @@ -# Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily) +# Tavily Comparison Project -Главная -Мои задания -Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily) -5Д -EN -Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily) -Зачёт -Версия 11 -Дедлайн сдачи: 31.08.2026 +This project demonstrates how to integrate the **Tavily API** to compare three entities. It performs a search query and summarizes the top results using the official Tavily SDK. -В работе +## Prerequisites -Требуется доработка +- Node.js (v18 or newer) +- A Tavily API key. Sign up at https://tavily.com and obtain your key. -В работе отсутствуют ключевые зависимости и функциональные элементы, указанные в задании. Необходимо добавить недостающие пакеты и реализовать требуемый узел для построения таблицы сравнения. +## Installation -Редактирование ответа +```bash +# Clone the repository +git clone https://git.brojs.ru/kuzakhmetovartur/povtornyy-ekzamen-2-sravnitelnyy-obzor-3.git +cd povtornyy-ekzamen-2-sravnitelnyy-obzor-3 -Заполните ответ и отправьте работу на проверку преподавате \ No newline at end of file +# Install dependencies +npm install +``` + +## Configuration + +Create a `.env` file in the project root with your Tavily API key: + +```env +TAVILY_API_KEY=your_api_key_here +``` + +## Usage + +Run the application: + +```bash +npm start +``` + +You should see output similar to: + +``` +[OtherService] Starting search for: Comparison of three entities +[OtherService] Results: +1. Title of first result + Summary of the first result. + +2. Title of second result + Summary of the second result. + +3. Title of third result + Summary of the third result. +``` + +## Project Structure + +- `src/index.js` – Entry point that starts the application. +- `src/app.js` – Orchestrates the main flow. +- `src/services/tavily.js` – Wrapper around the Tavily SDK. +- `src/services/otherService.js` – Simple logging utility. +- `package.json` – Project metadata and dependencies. + +## Notes + +- The application uses the official `tavily-sdk` package. +- No additional external services are used beyond Tavily. +- The code is written in ES modules (`"type": "module"` in `package.json`). + +Feel free to extend the project with more sophisticated logic or additional services as needed. \ No newline at end of file diff --git a/package.json b/package.json index 5a632ba..19e8c66 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,15 @@ { - "name": "comparison-table-app", + "name": "tavily-comparison", "version": "1.0.0", - "private": true, - "description": "React app that compares three entities using Tavily API", + "description": "Comparison of three entities using the Tavily API", "main": "src/index.js", + "type": "module", "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject" + "start": "node src/index.js", + "test": "echo \"No tests defined\"" }, "dependencies": { - "@tavily/tavily-api": "^1.0.0", - "axios": "^1.6.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-scripts": "5.0.1", - "react-table": "^7.8.0" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "tavily-sdk": "^1.0.0", + "dotenv": "^16.0.0" } } \ No newline at end of file diff --git a/src/App.js b/src/App.js index 2845373..0baec97 100644 --- a/src/App.js +++ b/src/App.js @@ -1,14 +1,12 @@ -import React from 'react'; -import ComparisonTable from './components/ComparisonTable'; -import './App.css'; +import { searchAndSummarize } from './services/tavily.js'; +import { logInfo } from './services/otherService.js'; -function App() { - return ( -