janhq / jan

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer. Multiple engine support (llama.cpp, TensorRT-LLM)
https://jan.ai/
GNU Affero General Public License v3.0
22.7k stars 1.31k forks source link

feat: Extension should be able to register its own settings #776

Closed louis-jan closed 6 months ago

louis-jan commented 10 months ago

Problem

Success Criteria

const DEFAULT_SETTINGS: Partial = { key: "xxx-yyyy", };

class OAIExtension extends JanExtension { settings: OAISettings

onLoad() { this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); } }


**Additional context**
User should be able to update settings from setting page > extensions > oai extension > settings

Base Extension class should have a default implementation of 
```ts
// Read extension data from json file 
function loadData()

// Write extension data to json file
function saveData(data: object)

Q: Web & Mobile compatibility? A: inject localStorage module (session based) instead of fs for these platforms

Further update

dan-homebrew commented 10 months ago

Thanks - I think this will be a great way to start work on https://github.com/janhq/jan/issues/757

imtuyethan commented 6 months ago

Design for dynamic extension settings: https://www.figma.com/file/ytn1nRZ17FUmJHTlhmZB9f/Jan-App-(version-1)?type=design&node-id=6999-89915&mode=design&t=IhyPYt0bZS0kM65Y-4

Screenshot 2024-03-28 at 1 10 57 PM
Van-QA commented 6 months ago
  1. Extension group name should be in upper case for all text :x:, see Figma design above image

  2. Inconsistent in the hyperlink text: Groq Documentation and OpenAI documentation :x:

    image image
Van-QA commented 6 months ago
  1. API key placeholder should contain prefix of the sample key :x:
    • openAI: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    • Groq: gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx image
Van-QA commented 6 months ago

looking good on Jan v0.4.10-367 ✅