@@ -12,7 +12,7 @@ const openai = new OpenAI({
1212 apiKey : process . env . OPENAI_API_KEY
1313} ) ;
1414
15- export async function indexUser ( { fid, name, profile, intent } ) {
15+ export async function indexUser ( { fid, name, username , profile, intent } ) {
1616 try {
1717
1818 const openrank = await getOpenRank ( fid ) ;
@@ -30,11 +30,12 @@ export async function indexUser({ fid, name, profile, intent }) {
3030
3131 // Upsert user data with both vector embeddings
3232 await db . raw (
33- `INSERT INTO users (fid, name, openrank, profile, intent, profile_vector, intent_vector, created_at)
34- VALUES (?, ?, ?, ?, ?, ?, ?, NOW())
33+ `INSERT INTO users (fid, name, username, openrank, profile, intent, profile_vector, intent_vector, created_at)
34+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW())
3535 ON CONFLICT (fid)
3636 DO UPDATE SET
3737 name = EXCLUDED.name,
38+ username = EXCLUDED.username,
3839 openrank = EXCLUDED.openrank,
3940 profile = EXCLUDED.profile,
4041 intent = EXCLUDED.intent,
@@ -44,6 +45,7 @@ export async function indexUser({ fid, name, profile, intent }) {
4445 [
4546 fid ,
4647 name ,
48+ username ,
4749 openrank ,
4850 profile ,
4951 intent ,
@@ -70,9 +72,7 @@ export async function findUsers({ fid, profile, intent }, limit = 50) {
7072 END AS fid
7173 FROM matches m
7274 WHERE (m.user1_fid = ? OR m.user2_fid = ?)
73- AND (m.status = 'declined' OR
74- m.user1_status = 'declined' OR
75- m.user2_status = 'declined')
75+ AND (m.status = 'accepted')
7676
7777 UNION
7878
@@ -114,6 +114,7 @@ export async function findUsers({ fid, profile, intent }, limit = 50) {
114114 `SELECT
115115 fid,
116116 name,
117+ username,
117118 profile,
118119 intent,
119120 (1 - (profile_vector <=> ?)) * 0.5 +
0 commit comments