Adds dynamic Claude model fetching and management #1

Merged
AlexKucera merged 60 commits from dynamic-models into master 2025-10-31 13:42:04 +01:00
Showing only changes of commit d5af2a08ce - Show all commits
+7 -1
View File
4
@@ -408,8 +408,14 @@ export class AnthropicClient {
// Validate that the assistant actually returned "ping" // Validate that the assistant actually returned "ping"
// This ensures the API is working correctly, not just returning a 2xx status // This ensures the API is working correctly, not just returning a 2xx status
// Check all content blocks (not just first) in case of multiple text blocks
// Normalize to tolerate punctuation and quotes (e.g., "ping.", ""ping"") // Normalize to tolerate punctuation and quotes (e.g., "ping.", ""ping"")
const returnedText = (response.content?.[0]?.text || '').trim().toLowerCase(); const returnedText = (response.content || [])
.filter(c => c && c.type === 'text' && typeof c.text === 'string')
.map(c => c.text)
.join(' ')
.trim()
.toLowerCase();
const normalized = returnedText.replace(/^[^a-z]+|[^a-z]+$/g, '').replace(/\s+/g, ''); const normalized = returnedText.replace(/^[^a-z]+|[^a-z]+$/g, '').replace(/\s+/g, '');
const isValid = normalized === 'ping'; const isValid = normalized === 'ping';