diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..12716b2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{py,js,html,css,scss,md}] +charset = utf-8 +indent_style = space +indent_size = 4 diff --git a/README.md b/README.md index 5021861..17c0da3 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ pip install -r requirements.txt python server.py --enable-modules=caption,summarize,classify ``` * Copy the Extra's server API URL listed in the console window after it finishes loading up. On local installs, this defaults to `http://localhost:5100`. -* Open your SillyTavern [config.conf](https://github.com/Cohee1207/SillyTavern/blob/dev/config.conf) file (located in the base install folder), and look for a line "`const enableExtensions`". Make sure that line has "`= true`", and not "`= false`". +* Open your SillyTavern [config.conf](https://github.com/Cohee1207/SillyTavern/blob/dev/config.conf) file (located in the base install folder), and look for a line "`const enableExtensions`". Make sure that line has "`= true`", and not "`= false`". * Start your SillyTavern server * Open the Extensions panel (via the 'Stacked Blocks' icon at the top of the page), paste the API URL into the input box, and click "Connect" to connect to the Extras extension server. * To run again, simply activate the environment and run these commands. Be sure to the additional options for server.py (see below) that your setup requires. @@ -168,7 +168,7 @@ Steps: 2. Run `docker-compose up -d --build` to build ChromaDB. This may take a long time depending on your system 3. Once the build process is finished, ChromaDB should be running in the background. You can check with the command `docker ps` 4. On your client machine, specify your local server ip in the `--chroma-host` argument (ex. `--chroma-host=192.168.1.10`) - + If you are running ChromaDB on the same machine as SillyTavern, you will have to change the port of one of the services. To do this for ChromaDB: @@ -344,19 +344,19 @@ WAV audio file. "chat_id": "chat1 - 2023-12-31", "messages": [ { - "id": "633a4bd1-8350-46b5-9ef2-f5d27acdecb7", + "id": "633a4bd1-8350-46b5-9ef2-f5d27acdecb7", "date": 1684164339877, "role": "user", "content": "Hello, AI world!", "meta": "this is meta" }, { - "id": "8a2ed36b-c212-4a1b-84a3-0ffbe0896506", + "id": "8a2ed36b-c212-4a1b-84a3-0ffbe0896506", "date": 1684164411759, "role": "assistant", "content": "Hello, Hooman!" }, - ] + ] } ``` #### **Output** @@ -378,7 +378,7 @@ WAV audio file. ``` [ { - "id": "633a4bd1-8350-46b5-9ef2-f5d27acdecb7", + "id": "633a4bd1-8350-46b5-9ef2-f5d27acdecb7", "date": 1684164339877, "role": "user", "content": "Hello, AI world!", @@ -386,7 +386,7 @@ WAV audio file. "meta": "this is meta" }, { - "id": "8a2ed36b-c212-4a1b-84a3-0ffbe0896506", + "id": "8a2ed36b-c212-4a1b-84a3-0ffbe0896506", "date": 1684164411759, "role": "assistant", "content": "Hello, Hooman!", diff --git a/server.py b/server.py index ac1829e..8b37721 100644 --- a/server.py +++ b/server.py @@ -785,7 +785,7 @@ def chromadb_export(): data = request.get_json() if "chat_id" not in data or not isinstance(data["chat_id"], str): abort(400, '"chat_id" is required') - + chat_id_md5 = hashlib.md5(data["chat_id"].encode()).hexdigest() collection = chromadb_client.get_or_create_collection( name=f"chat-{chat_id_md5}", embedding_function=chromadb_embed_fn @@ -794,7 +794,7 @@ def chromadb_export(): documents = collection_content.get('documents', []) ids = collection_content.get('ids', []) metadatas = collection_content.get('metadatas', []) - + content = [ { "id": ids[i], @@ -803,12 +803,12 @@ def chromadb_export(): } for i in range(len(ids)) ] - + export = { "chat_id": data["chat_id"], "content": content } - + return jsonify(export) diff --git a/tts_edge.py b/tts_edge.py index 672b458..a4004ac 100644 --- a/tts_edge.py +++ b/tts_edge.py @@ -28,5 +28,5 @@ def generate_audio(text: str, voice: str) -> bytes: for chunk in chunks: buffer.write(chunk) - + return buffer.getvalue()