This commit is contained in:
2025-07-15 13:48:51 -04:00
parent a1f82036ff
commit fd300743c8
2 changed files with 15 additions and 9 deletions

View File

@ -125,7 +125,12 @@ class Misc(FastAPI):
""" """
np: dict = self.radio.radio_util.now_playing np: dict = self.radio.radio_util.now_playing
artistsong: str = np.get("artistsong", "N/A - N/A") artistsong: str = "N/A - N/A"
artist = np.get("artist")
song = np.get("song")
if artist and song:
artistsong = f"{artist} - {song}"
album: str = np.get("album", "N/A") album: str = np.get("album", "N/A")
genre: str = np.get("genre", "N/A") genre: str = np.get("genre", "N/A")
return (artistsong, album, genre) return (artistsong, album, genre)
@ -143,10 +148,6 @@ class Misc(FastAPI):
# End response time test # End response time test
total_keys = await self.redis_client.dbsize() total_keys = await self.redis_client.dbsize()
response_time: float = time_end - time_start response_time: float = time_end - time_start
(_, ci_keys) = await self.redis_client.scan(
cursor=0, match="ci_session*", count=10000000
)
num_ci_keys = len(ci_keys)
index_info = await self.redis_client.ft().info() index_info = await self.redis_client.ft().info()
indexed_lyrics: int = index_info.get("num_docs") indexed_lyrics: int = index_info.get("num_docs")
return JSONResponse( return JSONResponse(
@ -154,7 +155,7 @@ class Misc(FastAPI):
"responseTime": round(response_time, 7), "responseTime": round(response_time, 7),
"storedKeys": total_keys, "storedKeys": total_keys,
"indexedLyrics": indexed_lyrics, "indexedLyrics": indexed_lyrics,
"sessions": num_ci_keys, "sessions": -1,
} }
) )

View File

@ -11,8 +11,13 @@ class GPT:
api_key=self.api_key, api_key=self.api_key,
timeout=10.0, timeout=10.0,
) )
self.default_system_prompt: str = """You are a helpful assistant who will provide only totally accurate tidbits of \ self.default_system_prompt: str = """You are a helpful assistant who will provide ONLY TOTALLY ACCURATE (!!) tidbits of \
info on the specific songs the user may listen to.""" info on the specific songs the user may listen to.
# IMPORTANT
As an AI assistant, you may not always have much information available to describe the track provided. That is TOTALLY FINE!
What is not acceptable is hallucinations, for example:
- Do NOT mention the name of the album the track was included on. You rarely have correct information in this context.
- If no 100% reliable data is available, do NOT (!!) mention the album..."""
logging.getLogger("httpx").setLevel("CRITICAL") logging.getLogger("httpx").setLevel("CRITICAL")
@ -33,7 +38,7 @@ class GPT:
}, },
], ],
model="gpt-4o-mini", model="gpt-4o-mini",
temperature=0.35, temperature=1.00,
) )
response: Optional[str] = chat_completion.choices[0].message.content response: Optional[str] = chat_completion.choices[0].message.content
return response return response