debugging

This commit is contained in:
Thomas G. Lopes 2025-06-19 13:50:18 +01:00
parent 30312e6f55
commit 371853de44
2 changed files with 8 additions and 4 deletions

View file

@ -85,7 +85,7 @@ Clone of [T3 Chat](https://t3.chat/)
### Final push ### Final push
- [x] Private mode for greeting - [x] Private mode for greeting
- [ ] Free mode - [x] Free mode
- [ ] make things prettier - [ ] make things prettier
- [ ] mobile adjustments - [ ] mobile adjustments
- [ ] cloud per chat persistance - [ ] cloud per chat persistance

View file

@ -4,7 +4,7 @@ import { v } from 'convex/values';
import { providerValidator } from './schema'; import { providerValidator } from './schema';
import * as array from '../../utils/array'; import * as array from '../../utils/array';
import * as object from '../../utils/object'; import * as object from '../../utils/object';
import { internal } from './_generated/api'; import { api, internal } from './_generated/api';
import { Provider } from '../../types'; import { Provider } from '../../types';
import type { Doc } from './_generated/dataModel'; import type { Doc } from './_generated/dataModel';
@ -88,9 +88,10 @@ export const set = mutation({
session_token: v.string(), session_token: v.string(),
}, },
handler: async (ctx, args) => { handler: async (ctx, args) => {
const session = await ctx.runQuery(internal.betterAuth.getSession, { const session = await ctx.runQuery(api.betterAuth.publicGetSession, {
sessionToken: args.session_token, session_token: args.session_token,
}); });
console.log('Session', session);
if (!session) throw new Error('Invalid session token'); if (!session) throw new Error('Invalid session token');
@ -101,6 +102,9 @@ export const set = mutation({
) )
.first(); .first();
console.log('Trying to set', args.model_id, 'for', session.userId);
console.log('Existing', !!existing);
if (args.enabled && existing) return; // nothing to do here if (args.enabled && existing) return; // nothing to do here
if (existing) { if (existing) {