mlc-ai / web-llm-chat

Chat with AI large language models running natively in your browser. Enjoy private, server-free, seamless AI conversations.
https://chat.webllm.ai/
Apache License 2.0
380 stars 58 forks source link

[Feature Request]: Locale activation via URL parameter #48

Closed waldenn closed 3 months ago

waldenn commented 4 months ago

Problem Description

The locale can not yet be changed using an URL parameter. This prevents me from embedding the chat app in a larger system, which can call the chat app with the right context (language, prompt, etc.).

Solution Description

I would like to embed the chat app in a larger (multi-lingual) application and call the chat app via a language-code (eg. "fr") in its URL. This should then (only?) show the prompts available in that language.

It would also be great to be able to select the active prompt (and optional user prompt) from the URL.

Alternatives Considered

No response

Additional Context

No response

Neet-Nestor commented 3 months ago

Feature added in 2a1eaba857d05f9774e5c31678023ea003b2b0e5.

Now, you can use lang=fr query string in URL to specify UI language. Check https://github.com/mlc-ai/web-llm-chat/blob/main/app/locales/index.ts#L25 for all available language options.

Neet-Nestor commented 3 months ago

Note that language translations are currently not 100% covered. Please feel free to contribute to translation strings if you find any missing ones!

waldenn commented 3 months ago

Fanstastic! Thanks! Will look into the locales, once I have a laptop with WebGPU support.