Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
Bugfix, documentation, and guidelines (0.2.3)
Browse files Browse the repository at this point in the history
**Bugfix**:

- Fixed the issue of the settings panel overlapping the gear button on mobile
- Fixed the issue where the imported memory strings didn't get the appropriate "Remove" buttons
  • Loading branch information
LyubomirT committed Oct 4, 2023
1 parent bcb1f87 commit beb04f3
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 45 deletions.
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# C.ai addons Contributing Guide

## Table of Contents
- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [Making Changes](#making-changes)
- [Testing](#testing)
- [Submitting Changes](#submitting-changes)

## Introduction

Thank you for your interest in contributing to the C.ai addons project! This document will guide you through the process of contributing to the project.

## Getting Started

To get started, you will need to fork the repository. You can do this by clicking on the "Fork" button in the top right corner of the repository page.


## Making Changes

After forking the repository, you can make changes to the code. You can do this by editing the files in the repository. After you are done making changes, you can commit them to your forked repository. After that, you can create a pull request (compare across forks) to the main repository.

## Testing

Before submitting a pull request, you should test your changes. You can do this by loading the unpacked extension in your browser. To do this, you need to load the unpacked extension in your browser. If the extension works as expected, you can submit your changes.

## Submitting Changes

After testing your changes, you can submit them by creating a pull request. To do this, you need to go to the main repository page, and click on the "New pull request" button. After that, you need to click on the "compare across forks" link. Then, you need to select your forked repository, and create the pull request. After that, you need to wait for the pull request to be reviewed. If the pull request is accepted, your changes will be merged into the main repository.
88 changes: 87 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,88 @@
# c.ai-addons
Character AI Memory Managed
Additional Tools for Character.ai

## Installation
1. Download the latest release from the [releases page](https://github.com/LyubomirT/c.ai-addons/releases).
2. Extract the archive.
3. Open your preferred web browser and navigate to the extension manager.
4. Enable developer mode (if not already enabled or if needed).
5. Click on "Load unpacked" and select the extracted folder.

# Usage

## Settings

In the bottom left corner of the webpage (it's a bottom toolbar on mobile), there is a button, with a gear icon. Clicking on it will open the extension settings.

![Settings Button](resources/markdown/settings.png)

## Memory Manager

The memory manager is a tool that allows you to manually create "Memory Strings", that prevent the chatbot from forgetting things when
inserted into your message. This is useful for things like names, locations, etc. that you want to be remembered throughout the conversation.

The Memory Manager requires the "Enable Memory Manager" option to be enabled in the extension settings.

**Preview**

![Memory Manager Preview](resources/markdown/mmanager.png)

### Creating a Memory String

A memory string consists of "AI memories" and "User facts". To add a new AI memory, click on the "Add memory" button in the "Character Memory" section. To add a new user fact, click on the "Add fact" button in the "User Memory" section. You can preview your memory string in the box above:

![Memory String Preview](resources/markdown/preview.png)

There are also other Memory String controls, like the ones shown below:

![Memory String Controls](resources/markdown/mcontrols.png)

### Inserting a Memory String

Below the Memory String controls, there is a button, saying "Insert Memory String". Clicking on it will insert the memory string into the message box. NOTE that it's recommended to hit Shift+Enter while focusing on the messagebox after inserting it, because otherwise it might break the message.

If you don't want to use the button, simply copy-paste the memory string from the previewer into the message box.

### Importing an Existing Memory String

If you already have a memory string, you can import it by clicking on the "Import Memory String" button. This will open a prompt, where you can paste your memory string. After pasting it, click on "Confirm" and it will be imported, if it matches the standard memory string format.

### Automatically Generating a Memory String with AI

If you don't want to manually create a memory string, you can use the "Generate Automatically" button. This will automatically generate a memory string based on the current chat state. The process can sometimes be a bit slow, and it's not 100% accurate.

You can also switch between the "Fast" and "Normal" models. Fast can save you some time, but it's not as accurate as the normal model, while the normal model is more accurate, but slower.

### Opening or Closing the Memory Manager

In the top right corner of the webpage, there is a button, with an arrow. Clicking on it will open the memory manager, and clicking on it again will close it.

![Memory Manager Button](resources/markdown/oc.png)

## Legacy Chats

In a recent update, Character.AI changed the way you chat, as well as removing a few neat features. This addon brings back the old chat, as well as the features that were removed.

### Enabling Legacy Chats

First of all, you need to enable the "Enable Legacy Chats" option in the extension settings. After that, you need to refresh the page, and then you need to click the "Spin" button in the toolbar, while being on a chatting page.

![Spin Button](resources/markdown/spin.png)

## Non-Rounded Avatars

This addon removes the rounded corners from the avatars. It can be enabled by enabling the "Disable Rounded Avatars" option in the extension settings.

## Hiding / Showing the Toolbar (Mobile)

The toolbar covers a lot of space in the bottom part of the screen on mobile devices. You can easily hide it by clicking the three-dot button in the top right corner of the page. This will hide the toolbar, and you can show it again by clicking the same button.

![Toolbar Button](resources/markdown/ocstuff.png)

# Contributing

Contributions are welcome! If you want to contribute, you can either open an issue, or create a pull request. If you want to create a pull request, please make sure to follow the [contribution guidelines](CONTRIBUTING.md).

# License

This project is licensed under the [GNU General Public License v3.0](LICENSE).
Empty file removed background.js
Empty file.
28 changes: 22 additions & 6 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,20 +256,20 @@ function initMemoryManager() {
"character-memory-select"
);
var userMemorySelect = document.getElementById("user-memory-select");

// Clear existing memory options
characterMemorySelect.innerHTML =
'<option value="" disabled selected>--Select a memory--</option>';
userMemorySelect.innerHTML =
'<option value="" disabled selected>--Select a memory--</option>';

// Split memoryString by newlines
var memoryLines = memoryString.split("\n");

memoryLines.forEach(function (memoryLine) {
// Trim whitespace and check for AI memories or User Facts keywords
var cleanedLine = memoryLine.trim();

if (cleanedLine.startsWith("[ AI memories:")) {
var memories = cleanedLine.match(/"([^"]*)"/g);
if (memories) {
Expand All @@ -279,6 +279,7 @@ function initMemoryManager() {
newOption.value = cleanedMemory;
newOption.textContent = cleanedMemory;
characterMemorySelect.appendChild(newOption);
characterMemorySelect.selectedIndex = 1;
});
}
} else if (cleanedLine.startsWith("[ User Facts:")) {
Expand All @@ -290,13 +291,28 @@ function initMemoryManager() {
newOption.value = cleanedMemory;
newOption.textContent = cleanedMemory;
userMemorySelect.appendChild(newOption);
userMemorySelect.selectedIndex = 1;
});
}
}
});


// Show remove button if there are more than one options
if(characterMemorySelect.options.length > 1){
document.getElementById(
"remove-character-memory-button"
).style.display = "inline-block";
}

if(userMemorySelect.options.length > 1){
document.getElementById(
"remove-user-memory-button"
).style.display = "inline-block";
}

updateMemoryString(); // Update the displayed memory string
}


// create a function to insert the memory string to the user input textarea
function insertMemoryString() {
Expand Down Expand Up @@ -1206,7 +1222,7 @@ var settingsPanel = document.createElement("div");
settingsPanel.id = "addon-settings-panel";
settingsPanel.style.display = "none";
settingsPanel.style.position = "absolute";
settingsPanel.style.bottom = "50px";
settingsPanel.style.bottom = screenWidth <= 960 ? "75px" : "50px";
settingsPanel.style.left = "10px";
settingsPanel.style.width = "300px";
settingsPanel.style.backgroundColor = "#fff";
Expand Down
15 changes: 0 additions & 15 deletions index.html

This file was deleted.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "C.AI Addons",
"version": "0.2.2",
"version": "0.2.3",
"description": "A browser extension that adds some features to character.ai",
"icons": {
"16": "icon16.png",
Expand Down
Binary file added resources/markdown/mcontrols.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/markdown/mmanager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/markdown/oc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/markdown/ocstuff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/markdown/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/markdown/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/markdown/spin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 0 additions & 22 deletions settings.js

This file was deleted.

0 comments on commit beb04f3

Please sign in to comment.