handling incomplete responses from session api

This commit is contained in:
Rudis Muiznieks 2025-04-03 08:40:12 -05:00
parent 25f672f7e5
commit 1092b20bb5
Signed by: rudism
GPG key ID: CABF2F86EF7884F9
2 changed files with 5 additions and 2 deletions

View file

@ -108,7 +108,10 @@ class KagiSkill(FallbackSkill):
return False
def clean_session_string(self, raw_text):
text = json.loads(raw_text)
# sometimes it bails before finishing the json string
# if that happens let's fix it and read what we managed to get
jsonstr = raw_text if raw_text.endswith('"') else raw_text + '"'
text = json.loads(jsonstr)
pattern_refs = re.compile(r'<div[^>]*>.*$', re.DOTALL)
pattern_sups = re.compile(r'<sup[^>]*>.*?</sup>', re.DOTALL)
pattern_tags = re.compile(r'<.*?>')

View file

@ -4,7 +4,7 @@ import os
from os import walk, path
PYPI_NAME = "skill-ovos-fallback-kagi" # pip install PYPI_NAME
VERSION = "0.1.8"
VERSION = "0.1.9"
URL = f"https://code.sitosis.com/rudism/{PYPI_NAME}"
SKILL_CLAZZ = "KagiSkill" # needs to match __init__.py class name