mirror of
https://github.com/severian-dev/sucker.severian.dev.git
synced 2025-10-28 12:45:55 +00:00
fix: r1 and blank user persona handling
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
# Sucker
|
# Sucker
|
||||||
|
|
||||||
Check package.json for commands, I can't be bothered.
|
Check package.json for commands, I can't be bothered.
|
||||||
|
|
||||||
|
### Changelog
|
||||||
|
|
||||||
|
- 1.1: Fix for R1 handling change, blank user persona bug
|
||||||
|
- 1.0: Yup.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function safeReplace(text: string, old: string, newStr: string): string {
|
|||||||
|
|
||||||
function extractCardData(messages: Message[]): CardData {
|
function extractCardData(messages: Message[]): CardData {
|
||||||
const content0 = messages[0].content;
|
const content0 = messages[0].content;
|
||||||
const content1 = messages[1].content;
|
const content1 = messages[2].content;
|
||||||
|
|
||||||
const userName = extractPersonaName(content0, 0);
|
const userName = extractPersonaName(content0, 0);
|
||||||
const charName = extractPersonaName(content0, 1);
|
const charName = extractPersonaName(content0, 1);
|
||||||
@@ -67,8 +67,9 @@ function extractCardData(messages: Message[]): CardData {
|
|||||||
first_mes: content1,
|
first_mes: content1,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (personaMatches.length >= 2) {
|
// blank user persona handling, or at least an attempt
|
||||||
const secondPersonaIdx = personaMatches[1].index!;
|
let secondPersonaIdx =
|
||||||
|
personaMatches[personaMatches.length >= 2 ? 1 : 0]?.index;
|
||||||
const startDesc = secondPersonaIdx + "'s Persona:".length;
|
const startDesc = secondPersonaIdx + "'s Persona:".length;
|
||||||
const remaining = content0.slice(startDesc);
|
const remaining = content0.slice(startDesc);
|
||||||
|
|
||||||
@@ -102,7 +103,6 @@ function extractCardData(messages: Message[]): CardData {
|
|||||||
? rawExampleStr.slice(colonIdx + 1).trim()
|
? rawExampleStr.slice(colonIdx + 1).trim()
|
||||||
: rawExampleStr.trim();
|
: rawExampleStr.trim();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (const field in cardData) {
|
for (const field in cardData) {
|
||||||
if (field !== "name") {
|
if (field !== "name") {
|
||||||
|
|||||||
@@ -186,7 +186,12 @@ export default function Home() {
|
|||||||
<main className="min-h-screen bg-background text-foreground">
|
<main className="min-h-screen bg-background text-foreground">
|
||||||
<div className="container mx-auto px-4 py-8">
|
<div className="container mx-auto px-4 py-8">
|
||||||
<div className="flex justify-between items-center mb-4">
|
<div className="flex justify-between items-center mb-4">
|
||||||
<h1 className="text-3xl font-bold">Sucker</h1>
|
<div>
|
||||||
|
<h1 className="text-3xl font-bold">Sucker v1.1</h1>
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
Fixed R1 handling change, blank user persona bug.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<Button
|
<Button
|
||||||
onClick={fetchCards}
|
onClick={fetchCards}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
Reference in New Issue
Block a user