chore: clean up console noise - remove debug logs from NostrProvider, NostrSync, useShakespeare

Removed:
- [NostrProvider] Routing query to read relays (fired on EVERY query)
- [NostrProvider] Publishing kind X to relays
- [NostrSync] Starting sync / querying profile / profile query returned / sync completed
- [NostrSync] Profile not found on main relays
- [NostrSync] Profile synced and cached
- [Shakespeare] Fetching / Model / Response status debug logs

Kept all warn/error logs for actual failure cases.

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
shakespeare.diy 2026-06-16 22:23:00 +07:00
parent 89b43a44e6
commit 966907a848
3 changed files with 2 additions and 12 deletions

View file

@ -62,7 +62,6 @@ const NostrProvider: React.FC<NostrProviderProps> = (props) => {
routes.set(relay.url, filters);
}
} else {
console.log('[NostrProvider] Routing query to read relays:', readRelays);
for (const url of readRelays) {
routes.set(url, filters);
}
@ -95,7 +94,7 @@ const NostrProvider: React.FC<NostrProviderProps> = (props) => {
DEFAULT_RELAYS.forEach(r => allRelays.add(r.url));
}
console.log(`[NostrProvider] Publishing kind ${event.kind} to relays:`, [...allRelays]);
return [...allRelays];
},

View file

@ -72,7 +72,6 @@ export function NostrSync() {
const syncUserData = async () => {
setSyncStatus('syncing');
console.log('[NostrSync] Starting sync for user:', user.pubkey.slice(0, 8) + '...');
// FIX B: Invalidate any stale cached data for this user BEFORE fetching
// This ensures we don't use old cached empty results
@ -137,12 +136,10 @@ export function NostrSync() {
// Sync profile (kind 0) and populate useAuthor cache
const syncProfile = async (relayGroup?: ReturnType<typeof nostr.group>): Promise<boolean> => {
const querySource = relayGroup || nostr;
console.log('[NostrSync] Querying profile for pubkey:', user.pubkey.slice(0, 8) + '...');
const events = await querySource.query(
[{ kinds: [0], authors: [user.pubkey], limit: 1 }],
{ signal: AbortSignal.timeout(10000) }
);
console.log('[NostrSync] Profile query returned', events.length, 'events');
if (events.length > 0) {
const event = events[0];
@ -178,7 +175,7 @@ export function NostrSync() {
});
});
console.log('[NostrSync] Profile synced and cached:', metadata.name || 'unnamed');
return true;
} catch (parseError) {
// Event exists but content couldn't be parsed - still cache the event
@ -206,7 +203,6 @@ export function NostrSync() {
// If profile not found on main relays, try fallback relays
if (!profileSynced) {
console.log('[NostrSync] Profile not found on main relays, trying fallbacks...');
const fallbackResult = await syncWithRetry(async () => {
const fallbackGroup = nostr.group(FALLBACK_RELAYS);
@ -223,7 +219,6 @@ export function NostrSync() {
if (relaysSynced || profileSynced) {
setSyncStatus('success');
console.log('[NostrSync] Sync completed - relays:', relaysSynced, 'profile:', profileSynced);
} else {
setSyncStatus('error');
console.error('[NostrSync] Sync failed - could not reach relays');

View file

@ -177,9 +177,6 @@ export function useShakespeare() {
const targetUrl = `${SHAKESPEARE_API_URL}/chat/completions`;
const token = await createNIP98Token('POST', targetUrl, requestBody, user);
console.log('[Shakespeare] Fetching:', targetUrl);
console.log('[Shakespeare] Model:', model, 'User pubkey:', user.pubkey?.slice(0, 8));
const response = await fetch(targetUrl, {
method: 'POST',
headers: {
@ -189,7 +186,6 @@ export function useShakespeare() {
body: JSON.stringify(requestBody),
});
console.log('[Shakespeare] Response status:', response.status);
await handleAPIError(response);
return await response.json();
} catch (err) {