Commit graph

9 commits

Author SHA1 Message Date
Wesley Appler
25c0344578
[WIP] Implement the importing of optics (#167)
* Initial implementation of importing sites from an optic

* Removed unused import

* Updated button text

* Implemented client-side WASM to allow for parsing of imported .optic files

* Removed unneeded deps & updated `CONTRIBUTING.md` to reflect wasm-pack needs

* CI updates

* Added vite-plugin-wasm-pack to ensure wasm modules get copied over

* CI fix >:(

* More CI attempts

* agony - CSP fix & further wasm-pack fixes

* CSP updates

* Package update to prevent an unneccesary build of wasm

* reduce bloat in ci build log from wasm

* fix another non-determinsticly failing test

* only install wasm-pack as part of setup steps in CONTRIBUTING.md
./scripts/ci/check seems to fail if it tries to install wasm-pack while it is already installed (at least on my machine). as it is already added as a step in CONTRIBUTING.md we can assume it has been installed on the system

* add vite plugin to ensure changes to 'crates/client-wasm' gets reflected in the frontend.
adapted from https://github.com/StractOrg/stract/pull/109

* run 'npm run format'

* propagate errors from wasm crate
2024-02-28 17:01:32 +01:00
Oliver Bøving
f5bb0d2ef8
Optics LSP Chores (#145)
* Update the linked project to new location of `optics-lsp`

* Update optics-lsp license file path

It was previously a symlink to `../LICENSE.md`, but since moving the crate into `crates/` this should now be `../../LICENSE.md`.

* Bump lsp-types and serde-wasm-bindgen

* Sort crates in optics-lsp and add itertools

* Move optic-lsp token docs out to a separate file

rustfmt does not like long string literals, so these doc strings prevented most of the file from being formatted. Moving it out still mess with rustfmt, but now it is at least isolated :)

* Add token to hover docs

This blatantly steals a feature from rust-analyzer, where the hovered token is displayed as the first thing in the hover docs. It helps signalize that the documentation corresponds to the token being hovered, and also just looks nice. :)

* Refactor error formatting in optics-lsp

Instead of pushing string literals, we build up an iterator of lines and join them at the end.

Other minor refactorings are performed as well.

* change optics extension license to MIT

* release optics extension 0.0.12
2024-02-10 17:36:55 +01:00
Mikkel Denker
ea3b7a4099 implement some layers in ggml
linear, embedding and multihead attention
2024-01-31 17:51:02 +01:00
Oliver Bøving
2e2aff3da0
🥬 Svelte frontend (#91)
* remove deno frontend

* Add Svelte frontend

* change frontend port to 8000 and autofocus searchbar on frontpage

* Setup formatting of the new frontend with the new monorepo

* Add "show more" button to explore

* Add searchbar arrow key navigation

* Update query based on navigation in search bar

* Highlight mathcing prefix in search results

* Add toggling of site rankings to search results

* Fix crashing when having multiple semi-identical optics

* Refactor searchbar visibility

---------

Co-authored-by: Mikkel Denker <mikkel@trystract.com>
2023-09-10 16:32:03 +00:00
Oliver Bøving
072a6323e9
🍋 Fresh frontend (#84)
* Add fresh frontend

This reimplements the existing frontend using Fresh. Primay highlights of
this new frontend is:

- Uses deno instead of node/npm for less dependencies. Deno for example
  includes a formatter and linter, and dependencies are downloaded
  automatically.
- Everything is TypeScript. There is no more .astro or similar, which
  reduces complexity.
- The frontend is built up of components entirely, which can either be
  server side rendered only, or rehidrated on the client for
  interactivity (islands).
- Fresh server side renderes all requests, populated by using the API,
  which is typesafe and generated from the OpenAPI spec.
- Combining the last two, it becomes much easier to add high levels of
  interactivity, which needed to be written in external JS files. Now
  these are Preact component and can use all lthe benefits that comes
  from this.

Future work includes:
- [ ] Integrating Alice in the new UI
- [ ] Direct answers UI
- [ ] Default Optics. Should they come from the API or the frontend?
- [ ] Integrating the new fresh server with the existing backend
- [ ] Rutes supplying `queryUrlPart` to `Header`

* Update fresh frontend to use "type" rather than "@type"

* Add placeholder Tailwind config for VSCode intellisense

* Add discussions UI

* Clean up some left over template `{{...}}`

* './icons' might not exist before generation

* some UI/UX changes for consistency with old frontend

* Remove unused ENABLE_CSP flag since it is always enabled now

* Store icons used for the frontend in the repository

* Don't generate icons when starting the frontend

* Fix chat textarea sizing in Firefox

* Add Chat UI to new frontend

* Only allow one of liked, disliked, blocked at a time

* Add `curosr-pointer` to safe search radio buttons

* Add `leading-6` to articles to get more line spacing

Almost equivalent to the old frontend

* Prefix explore and site ranking links with https://

Perhaps we should determine the protocol in a more robust way?

* Fix explore sites regressions from adding tailwind-forms

* Refactor manage optics UI

* Add API endpoint for exporting optic from site rankings

`/beta/api/sites/export` is a JSON equivilant of the existing
`/settings/sites/export` endpoint.

* Add "Export as optic" and "Clear all and export as optic" buttons

These new buttons use the new `/beta/api/sites/export` endpoint to
download the generated optic

* Store site rankings in URL and send it during searching

* Use the tailwind config to extend the twind theme

* Add `/beta/api/explore/export` API endpoint

* Fix optics export button on explore

* Reflect the currently searched optic in the optic selector

* Add `noscript:hidden` class to hide fx search result adjust buttons

* Re-search when changing ranking of a webpage

* Refactor searchbar interaction and suggestion highlighting

We now do the highlighting on the frontend

* Change site blocking to be domain blocking when converting site rankings to optics.
The domain field uses the public suffix list which already handles suffixes that can be shared by multiple users (netlify.app etc.).
In other words, the domain of 'site.netlify.app' is 'site.netlify.app', so users of stract can still block specific netlify sites without blocking them all.

* Pass around `queryUrlPart` between pages

* Do syntax highlighting server-side using HighlightJS

* Remove `facebook.com` as default site in explore

* Add webmasters page to new frontend

* Remove old frontend

* Remove dead code from old Rust frontend

* Rename webstract to frontend

* remove more stuff from old frontend

---------

Co-authored-by: Mikkel Denker <mikkel@trystract.com>
2023-09-04 05:59:28 +00:00
Mikkel Denker
b16a1b9629 alice 2023-06-01 15:43:27 +02:00
Mikkel Denker
fe713a8737 Move from onnx to libtorch bindings for ML inference.
Fuck onnx. It was an enormous hassle to get onnx to play ball with more advanced models and execute the onnx models on GPU since onnx is only compiled to older cuda versions. This commit removes our dependency to onnx and replaces it with direct bindings to libtorch which gives us more flexibility and still allows us to easily deploy simple models with tracing. Time will tell if this is sufficiently performant or if we may want to develop some kind of JIT that can fuse matrix operations to increase performance.
2023-05-08 11:11:49 +02:00
Mikkel Denker
a03a4957be
Ftr/optics language (#69)
* Store all schema_org from webpages in a field

* flatten json tokenizer

* rename goggles -> optics

* update optics syntax

* cargo workspace

* very simple lsp wasm connection

* optics as separate package

* hover stuff

* optics vscode extension published

* syntax errors on-save and begin schema-field

* Use separate targets for LSP and rest (#68)

By moving the different targets into separate workspaces, we avoid some
of the issues where rust-analyzer might just stop working.

By adding the two projects to .vscode/settings.json we keep the ability
to get completions, goto definitions, rename, and such operations.

This requires us to specify the dependency versions in the LSP crate, as
we can no longer refer to them by the workspace version. The positive of
this is that the WASM/LSP dependent crates are now moved to the LSP crate.

* schema.org syntax in optic

* optic can now perform schema searches

* simplified schema_org flattening

* wrote new quickstart.optic

* update like-text

Co-authored-by: Oliver Bøving <oliver@bvng.dk>
2022-12-01 14:59:49 +01:00
Oliver Bøving
5176802207 Move around some prettier options 2022-09-11 14:20:07 +02:00