feat: solution for 'Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)'

This commit is contained in:
2026-06-29 16:48:23 +03:00
parent 87575da55f
commit c7e2183e3e
5 changed files with 161 additions and 114 deletions
+54 -23
View File
@@ -1,30 +1,61 @@
# Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
# Tavily Compare
Главная
Мои задания
Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
EN
Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
Зачёт
Версия 3
Дедлайн сдачи: 31.08.2026
This Node.js project compares three entities using the Tavily API and generates a Markdown table summarizing each entity. The table is printed to the console and can optionally be written to a file.
В работе
## Prerequisites
Требуется доработка
- Node.js v18 or newer (for native ES modules support)
- A Tavily API key
В работе отсутствует ключевой элемент задания – таблица сравнения 3×N с явным вердиктом.
## Setup
Редактирование ответа
1. **Clone the repository** (or copy the files into a new directory):
Заполните ответ и отправьте работу на проверку преподавателю.
```bash
git clone https://github.com/your-username/tavily-compare.git
cd tavily-compare
```
Тип ответа
Текст
Ссылка
Файлы
Ссылка (URL)
Прикреплённые файлы
Загрузить файл
Отправить на проверку
2. **Install dependencies**:
```bash
npm install
```
3. **Create a `.env` file** in the project root and add your Tavily API key:
```env
TAVILY_API_KEY=your_api_key_here
```
## Usage
Run the script with three entity names:
```bash
node src/index.js "Entity One" "Entity Two" "Entity Three"
```
The script will output a Markdown table to the console.
### Writing to a file
To also write the table to a file, use the `--output` (or `-o`) flag:
```bash
node src/index.js "Entity One" "Entity Two" "Entity Three" --output comparison.md
```
The file `comparison.md` will contain the same table.
## Project Structure
- `src/index.js` Entry point; orchestrates argument parsing, API calls, and output.
- `src/compare.js` Handles API requests to Tavily and returns summaries.
- `src/markdown.js` Builds the Markdown table string.
- `package.json` Project metadata and dependencies.
- `README.md` Documentation.
## License
MIT License