https://github.com/zigaowang/zhidao-search-api
https://github.com/zigaowang/zhidao-search-api
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zigaowang/zhidao-search-api
- Owner: ZigaoWang
- License: gpl-3.0
- Created: 2025-03-30T05:53:25.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-03-31T03:57:26.000Z (6 months ago)
- Last Synced: 2025-06-10T09:03:52.662Z (4 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zhidao Search API
A Node.js API service for image search using Tavily API to provide images and supporting information for AI-generated reports.
## Setup
1. Clone the repository
2. Install dependencies:
```
npm install
```
3. Create a `.env` file in the root directory with:
```
TAVILY_API_KEY=your_tavily_api_key
PORT=3001
```## Usage
### Start the server
Development mode:
```
npm run dev
```Production mode:
```
npm start
```The server will run on `http://localhost:3001` by default.
### API Endpoints
#### Health Check
```
GET /health
```#### Search
```
POST /api/search
Content-Type: application/json{
"query": "your search topic"
}
```Example response:
```json
{
"results": [...],
"images": [
{
"url": "https://example.com/image.jpg",
"description": "Image description"
}
],
"query": "your search topic"
}
```## Example Usage with cURL
```bash
curl -X POST http://localhost:3001/api/search \
-H "Content-Type: application/json" \
-d '{"query": "AI hallucination"}'
```