open-sauced / ai

Discover open-source projects on GitHub relevant to your skills (with ai).
https://opensauced.ai
MIT License
70 stars 30 forks source link

Feature: Save settings in local storage #206

Open bdougie opened 1 year ago

bdougie commented 1 year ago

Type of feature

🍕 Feature

Current behavior

I use the same settings every-time I generate a description. But every-time there is an update or the cookie refreshes I need to save the settings again. It would be nice if we save the user settings in local storage.

Suggested solution

localstorage is preferred, but we could potentially store a settings JSON.

"settings" : {
  "Description Source" : "Commit Message",
  "Description Type" : "Formal"
}

Additional context

No response

Code of Conduct

Contributing Docs

Anush008 commented 1 year ago

We are saving the settings to chrome.storage.local for it to be persistent. https://github.com/open-sauced/ai/blob/cc76e950a33d30677e2eb37fadb3d318ceca2d5b/src/popup/pages/aiprdescription.tsx#L35-L39 https://github.com/open-sauced/ai/blob/cc76e950a33d30677e2eb37fadb3d318ceca2d5b/src/utils/ai-utils/descriptionconfig.ts#L39-L41 The problem being, the storage is reset if there's a reinstall.

nickytonline commented 1 year ago

@Anush008, consider using chrome.storage.sync instead. See https://developer.chrome.com/docs/extensions/reference/storage/#storage-areas. The only caveat is it can't store much, only 100KB but it will perist across all devices and shouldn't get wiped between installs (need to double check that)

Also, see https://pandaquests.medium.com/data-retention-made-easy-persist-data-with-chrome-storage-api-in-chrome-extensions-ea4f4c721a62

Anush008 commented 1 year ago

Right. The extension settings are being saved to the synced storage. https://github.com/open-sauced/ai/blob/f67f67339a5daca506822715ee29aa66c4b0ba6e/src/popup/pages/settings.tsx#L15-L30 We can do same for the AI description settings too.

a0m0rajab commented 11 months ago

@Anush008 do we have anything to do for this issue?