About

Duck.ai is one of the few online places to chat with AI privately. Self-hosting your own AI model is a better option, but not everybody has the hardware for it. DuckDuckGo has made deals with the model providers to keep your chats private, so it’s an easy option to recommend.

If you’re like me, you probably clear your cookies a lot (or always browse in incognito). This means that any time you visit Duck.ai, you have to set all your settings again. One solution is to set Duck.ai as an exception to your browser data deletion, but that makes me uneasy. After getting fed up setting my preferred settings each time, I wanted to see if I could automate the process.

The Bookmarklet

Bookmarklets are essentially bookmarks in your bookmarks bar that, when clicked, run your own JavaScript code on whichever page you’re visiting. This was a neat trick that some of my classmates used to edit pages when the Inspect Element was disabled on school computers.

I wrote a short bookmarklet that will automatically set my preferred settings in Duck.ai:

javascript:{
	const settings = {
		'aiChatPromptSuggestions': '{"hideSuggestions":true}',
		'aichatPromoDismissal': '{"promosDismissed":"9999-99-99"}',
		'duckaiCanUseApproxLocation': 'false',
		'duckaiSidebarCollapsed': 'true',
		'duckduckgo_settings': '{"description":"Each key is a setting documented in https://duckduckgo.com/duckduckgo-help-pages/settings/params/","kdcm":"6","kdcs":"0"}',
		'isRecentChatsOn': '"0"',
		'preferredDuckaiModel': '"6"',
	};
	
	let keys = Object.keys(settings);
	keys.forEach(key => {
		const value = settings[key];
		localStorage.setItem(key, value);
	});
	
	location.reload();
}

How To Use

(Steps may vary between browsers)

  1. Copy-paste the bookmarklet code above (including the part that says javascript:)
  2. Right click on the bookmarks bar in your browser
  3. Select “Add page…”
  4. In the field that says “URL”, paste the code you copied
  5. Name the bookmarklet whatever you want, for example: Debloat Duck.ai
  6. Click “Save”
  7. Visit Duck.ai (which redirects to https://duckduckgo.com/?q=DuckDuckGo+AI+Chat&ia=chat&duckai=1) You must visit this page before running the bookmarklet, because bookmarklets can only run code on the page you’re currently visiting.
  8. Click on the bookmarklet you just created. This will run the code.

You should now have a distraction free, private chat.

Explanation

Duck.ai stores its settings in the browser’s “local storage”. If you open the Inspect Element (either by right clicking on the page and clicking “Inspect” or by pressing F12) and navigate to Application > Local Storage > https://duckduckgo.com/ you will see a list of settings and their corresponding values.

By default, these settings are a tad too distracting for my taste. The bookmarklet I made does the following:

  1. Hides prompt suggestions
  2. Dismisses the promo by setting the shown date to something impossible in the future
  3. Disables using approximate location for responses
  4. Collapses the sidebar
  5. duckduckgo_settings doesn’t actually do much, and the values there are, in fact, not documented on this page
  6. Disables chat history
  7. Sets the preferred model to Mistral Small 3, which is open source and has low moderation.

You can set your preferred settings before running the bookmarklet and edit the bookmarklet code according to your own settings.

The code then iterates through these settings, and sets each one. Then, finally, reloads the page to apply the settings.

Updates

This project is far too small to make an entire repository for it, so I will try to just update this post with any new code. For example, duckaiCanUseApproxLocation is a new setting that was added in the last few days.

I hope everyone enjoys this as much as I did!

Here is a before and after:

  • RvTV95XBeo@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    arrow-down
    2
    ·
    15 hours ago

    Both sides win in this arrangement.

    What about the third party (you the user), and fourth party (everyone whose creativity was fed into the machines, and everyone who has to accept your LLM generated slop like it’s useful and/or contributing to the conversation)