# websearch

CLI websearch with an LLM summary using SearXNG to get search results.

Websearch is a Deno project that will grow to be provide more and more useful
summaries of information on the web for a given topic. It could easily be built
with another framework, but this is also an education project to learn the new
framework.

This is an example of using an LLM with knowledge outside of the Model.

## Depenecies

Websearch is dependent on Ollama running localy with a model intended to perform
the analysis/summary of the search information. That websearch is right now
using SearXNG, but could be easily ported to other providers.

## Usage

If you want to use this in GNU/Linux on an x68 platform, a pre-built binary is
in the repository. Copy it to a location in your `PATH` like `~/.local/bin/ws`.

On the first run, you'll need to tell Websearch what Ollama Model to user and
where the SearXNG endpoint is with the `--model MODEL` and 
`--search_url SEARCH_URL` comand line flags, as well as provide a search query.
```
$ ws --model=Ollama3.1 --search_url=http://localhost:8000 \
    Movies releasing in theaters in 2025
```
### Example

```
❯ ws Deno 2 new features
Query: Deno 2 new features
This is a detailed announcement from the Deno team about their upcoming release of Deno 2.0, which includes numerous features, bug fixes, and performance improvements. Here's a breakdown of what's new:

**Key Features**

1. **npm Support**: Deno now supports installing and managing npm packages.
2. **Experimental Decorators**: Deno introduces experimental decorators, which can be used to add metadata to modules.
3. **Improved Performance**: Deno 2.0 includes various performance improvements, including optimized HTTP client and server handling.
4. **CSS, HTML, YAML Formatters**: Deno now includes CSS, HTML, and YAML formatters, making it easier to format code and files.

**Bug Fixes**

The announcement lists numerous bug fixes, including:

1. **Fixes for npm-related issues**, such as installing and managing packages.
2. **Improvements to the HTTP client**, including improved performance and error handling.
3. **Bug fixes for various Deno modules**, such as `node`, `crypto`, and `sqlite3`.
4. **Improvements to the command-line interface (CLI)**, including better error handling and feedback.

**Changes**

1. **GlobalThis.location**: The `globalThis.location` property is now configurable.
2. **Helpful Hints**: Deno 2.0 includes helpful hints when using the `window` global that was removed in previous versions.
3. **Deno Cache**: The "deno cache" option has been removed from the help output.

**Acknowledgments**

The Deno team would like to thank their community for their support and contributions, including:

1. Ian Bull
2. Kenta Moriuchi
3. Mohammad Sulaiman
4. MujahedSafaa
5. Óscar Otero
6. Pig Fang
7. Simon Lecoq
8. Volker Schlecht
9. Carles Escrig Royo

**Next Steps**

The Deno team plans to release Deno 2.0 next week, and they will continue to monitor both the Discord and GitHub channels for feedback and bug reports.

Overall, this announcement highlights the significant progress made in Deno 2.0, which includes numerous features, performance improvements, and bug fixes. The community's support and contributions have been instrumental in shaping the release, and the team is grateful for their help.
```

### Building for other platforms

See the [Deno Compile Options](https://docs.deno.com/runtime/reference/cli/compiler/#compile-options)
for supported platform targets.

Example for GNU/Linux_x68:

```
$ deno compile \
  --target x86_64-unknown-linux-gnu \
  --allow-env=HOME,NODE_V8_COVERAGE \
  --allow-net \
  --allow-read \
  --allow-write \
  main.ts
```

## Configuration

Once Websearch runs successfuly, the model and search_url are saved to the
configuration file at `~/.config/websearch/config.yml`. This is used so
subsequent calls can omit the flags.

If you provide a flag with an updated option, that will be updated in the
config.
