diff --git a/package-lock.json b/package-lock.json
index 8ec9484fd..b5fb46fb5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -34,6 +34,7 @@
"sortablejs": "^1.15.2",
"svelte-sonner": "^0.3.19",
"tippy.js": "^6.3.7",
+ "turndown": "^7.2.0",
"uuid": "^9.0.1"
},
"devDependencies": {
@@ -1000,6 +1001,11 @@
"svelte": ">=3 <5"
}
},
+ "node_modules/@mixmark-io/domino": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@mixmark-io/domino/-/domino-2.2.0.tgz",
+ "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw=="
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -9077,6 +9083,14 @@
"node": "*"
}
},
+ "node_modules/turndown": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/turndown/-/turndown-7.2.0.tgz",
+ "integrity": "sha512-eCZGBN4nNNqM9Owkv9HAtWRYfLA4h909E/WGAWWBpmB275ehNhZyk87/Tpvjbp0jjNl9XwCsbe6bm6CqFsgD+A==",
+ "dependencies": {
+ "@mixmark-io/domino": "^2.2.0"
+ }
+ },
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
diff --git a/package.json b/package.json
index 50f5ea5ae..05e6a99cd 100644
--- a/package.json
+++ b/package.json
@@ -74,6 +74,7 @@
"sortablejs": "^1.15.2",
"svelte-sonner": "^0.3.19",
"tippy.js": "^6.3.7",
+ "turndown": "^7.2.0",
"uuid": "^9.0.1"
}
}
diff --git a/src/lib/components/chat/Messages/Placeholder.svelte b/src/lib/components/chat/Messages/Placeholder.svelte
index cdcb7784e..5922e25e0 100644
--- a/src/lib/components/chat/Messages/Placeholder.svelte
+++ b/src/lib/components/chat/Messages/Placeholder.svelte
@@ -9,6 +9,7 @@
import Suggestions from '../MessageInput/Suggestions.svelte';
import { sanitizeResponseContent } from '$lib/utils';
+ import Tooltip from '$lib/components/common/Tooltip.svelte';
const i18n = getContext('i18n');
@@ -41,14 +42,23 @@
selectedModelIdx = modelIdx;
}}
>
-
+
+
+
{/each}
diff --git a/src/lib/components/layout/Sidebar/ChatItem.svelte b/src/lib/components/layout/Sidebar/ChatItem.svelte
index 906dc8e8b..742c69a61 100644
--- a/src/lib/components/layout/Sidebar/ChatItem.svelte
+++ b/src/lib/components/layout/Sidebar/ChatItem.svelte
@@ -126,7 +126,7 @@
: selected
? 'from-gray-100 dark:from-gray-950'
: 'invisible group-hover:visible from-gray-100 dark:from-gray-950'}
- absolute right-[10px] top-[10px] pr-2 pl-5 bg-gradient-to-l from-80%
+ absolute right-[10px] top-[6px] py-1 pr-2 pl-5 bg-gradient-to-l from-80%
to-transparent"
on:mouseenter={(e) => {
diff --git a/src/routes/(app)/workspace/models/create/+page.svelte b/src/routes/(app)/workspace/models/create/+page.svelte
index 2b1330542..558f754ff 100644
--- a/src/routes/(app)/workspace/models/create/+page.svelte
+++ b/src/routes/(app)/workspace/models/create/+page.svelte
@@ -4,6 +4,8 @@
import { goto } from '$app/navigation';
import { settings, user, config, models, tools } from '$lib/stores';
+ import TurndownService from 'turndown';
+
import { onMount, tick, getContext } from 'svelte';
import { addNewModel, getModelById, getModelInfos } from '$lib/apis/models';
import { getModels } from '$lib/apis';
@@ -14,6 +16,7 @@
import Knowledge from '$lib/components/workspace/Models/Knowledge.svelte';
import ToolsSelector from '$lib/components/workspace/Models/ToolsSelector.svelte';
import { stringify } from 'postcss';
+ import { parseFile } from '$lib/utils/characters';
const i18n = getContext('i18n');
@@ -60,7 +63,10 @@
let knowledge = [];
$: if (name) {
- id = name.replace(/\s+/g, '-').toLowerCase();
+ id = name
+ .replace(/\s+/g, '-')
+ .replace(/[^a-zA-Z0-9-]/g, '')
+ .toLowerCase();
}
const addUsage = (base_model_id) => {
@@ -213,9 +219,29 @@
accept="image/*"
on:change={() => {
let reader = new FileReader();
- reader.onload = (event) => {
+ reader.onload = async (event) => {
let originalImageUrl = `${event.target.result}`;
+ let character = await parseFile(inputFiles[0]).catch((error) => {
+ return null;
+ });
+
+ if (character && character.character) {
+ character = character.character;
+ console.log(character);
+
+ name = character.name;
+
+ const turndownService = new TurndownService();
+ info.meta.description = turndownService.turndown(character.summary);
+
+ info.params.system = `Personality: ${character.personality}${
+ character?.scenario ? `\nScenario: ${character.scenario}` : ''
+ }${character?.greeting ? `\First Message: ${character.greeting}` : ''}${
+ character?.examples ? `\nExamples: ${character.examples}` : ''
+ }`;
+ }
+
const img = new Image();
img.src = originalImageUrl;
@@ -408,10 +434,11 @@
{#if info.meta.description !== null}
-
{/if}
diff --git a/src/routes/(app)/workspace/models/edit/+page.svelte b/src/routes/(app)/workspace/models/edit/+page.svelte
index 947f2f3df..ddbe9f682 100644
--- a/src/routes/(app)/workspace/models/edit/+page.svelte
+++ b/src/routes/(app)/workspace/models/edit/+page.svelte
@@ -369,10 +369,11 @@
{#if info.meta.description !== null}
-
{/if}