mirror of
				https://github.com/severian-dev/sucker.severian.dev.git
				synced 2025-10-31 06:05:41 +00:00 
			
		
		
		
	chore: test
This commit is contained in:
		| @@ -334,9 +334,12 @@ export async function POST(request: NextRequest) { | ||||
|       ); | ||||
|     } | ||||
|  | ||||
|     // Parse potential token from messages[3] | ||||
|     const tokenCandidate: string | undefined = body.messages?.[3]?.content; | ||||
|     const providedConversationId = parseConversationToken(tokenCandidate || undefined); | ||||
|     // Parse potential token from messages[3] (user) or messages[4] (assistant prior reply) | ||||
|     const tokenCandidateUser: string | undefined = body.messages?.[3]?.content; | ||||
|     const tokenCandidateAssistant: string | undefined = body.messages?.[4]?.content; | ||||
|     const providedConversationId = | ||||
|       parseConversationToken(tokenCandidateUser || undefined) || | ||||
|       parseConversationToken(tokenCandidateAssistant || undefined); | ||||
|  | ||||
|     let existingCard: StoredCard | null = null; | ||||
|     let linkedByToken = false; | ||||
| @@ -382,14 +385,11 @@ export async function POST(request: NextRequest) { | ||||
|     } | ||||
|  | ||||
|     const extracted = extractCardData(body.messages); | ||||
|     if (!existingCard) { | ||||
|       existingCard = findExistingCard(extracted.trackingName); | ||||
|     } | ||||
|  | ||||
|     // Prefer existing card's conversationId; otherwise generate a new random one for creation | ||||
|     const conversationId = existingCard | ||||
|       ? existingCard.conversationId | ||||
|       : providedConversationId || generateId(); | ||||
|       : generateId(); | ||||
|  | ||||
|     console.log(`Conversation ID: ${conversationId}`); | ||||
|  | ||||
| @@ -487,7 +487,7 @@ export async function POST(request: NextRequest) { | ||||
|       }; | ||||
|       extractedCards.push(newCard); | ||||
|       const tokenNote = ` This is the conversation ID you can use to start off a new chat when capturing alternate greetings, use it instead of the character name: [sucker:conv=${conversationId}]`; | ||||
|       responseMessage = `New character "${extracted.trackingName}" created (v1).${tokenNote}`; | ||||
|       responseMessage = `New character "${extracted.data.name}" created (v1).${tokenNote}`; | ||||
|     } | ||||
|  | ||||
|     cleanupExpiredCards(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Severian
					Severian