Origem: D:/Documents/Github/LocalAiApp Arquivos omitidos (segredos, bancos de dados, logs, >50 MB): 0
33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
# Local Search Service
|
|
|
|
This is the background Web Search extraction service for the **LocalAiApp**. It acts as a lightweight proxy and DOM parser that connects your mobile app (React Native) to SearXNG, ensuring the Local AI context is pristine Markdown.
|
|
|
|
## How it Works
|
|
1. Receives a search query from the LocalAiApp via `POST /search-and-extract`.
|
|
2. Asks your local `SearXNG` instance for the top results.
|
|
3. Fetches the HTML of the resulting pages.
|
|
4. Uses `linkedom` and `Readability` to strip out all menus, footers, scripts, and clutter.
|
|
5. Converts the clean article payload into `Markdown` using `node-html-markdown`.
|
|
6. Returns the pure Markdown text to the LocalAiApp to inject into the AI's prompt.
|
|
|
|
## Setup
|
|
|
|
### Requirements
|
|
- Node.js v18+
|
|
- A running instance of [SearXNG](https://github.com/searxng/searxng) (running locally at `http://127.0.0.1:8888` by default).
|
|
|
|
### Running
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
2. Start the service (runs on port `3030`):
|
|
```bash
|
|
npm start
|
|
```
|
|
|
|
## Integrations
|
|
Inside the main `LocalAiApp`, the chat input now has a Web Search toggle (the Globe icon). When activated, every prompt sent will first trigger the search service. The service fetches context online and feeds the result as an invisible pre-system-prompt to LM Studio!
|