diff --git a/backend/- b/backend/- new file mode 100644 index 00000000..f3618d19 --- /dev/null +++ b/backend/- @@ -0,0 +1 @@ +[[[-0.013114812783896923,0.1905374825000763,-0.3017500638961792,0.13865843415260315,-0.02245320752263069,-0.17323674261569977,0.01209946721792221,-0.2305026352405548,-0.5808178186416626,-0.1605306714773178,-0.2019975483417511,0.08041276037693024,-0.19402050971984863,0.15041713416576385,-0.5067760348320007,-0.05650178715586662,-0.11073841154575348,0.56447434425354,0.175505131483078,0.3939419686794281,-0.3578721284866333,0.0769389197230339,-0.0941341295838356,-0.15508152544498444,0.34595000743865967,0.6635770201683044,0.004271584562957287,-0.20469291508197784,-0.03128843009471893,-1.3511842489242554,-0.032000984996557236,-0.13617263734340668,0.06219322979450226,0.3765774667263031,-0.5545458197593689,0.18642649054527283,-0.019303657114505768,0.23251961171627045,-0.2797326147556305,0.09919481724500656,0.2990594804286957,0.16630391776561737,-0.06430071592330933,0.1663219928741455,0.3516000211238861,0.12959469854831696,-0.3257056772708893,-0.21407191455364227,0.40137729048728943,-0.20212562382221222,-0.5765513777732849,-0.4996473491191864,-0.14558082818984985,0.14532406628131866,-0.33666494488716125,-0.16050846874713898,0.18855725228786469,0.40477049350738525,0.07260603457689285,-0.5765323042869568,-0.24045047163963318,0.051954951137304306,0.11293975263834,0.17677585780620575,-0.09009800851345062,-0.3006853759288788,0.08580192923545837,0.186387300491333,-0.09620106220245361,0.01875067688524723,0.11228911578655243,0.274558424949646,-0.2445431798696518,0.07479538023471832,0.012248209677636623,-0.048036329448223114,0.231296569108963,0.08167564123868942,0.4591931700706482,0.25701484084129333,-0.07118316739797592,0.05015493556857109,-0.48126983642578125,-0.2500942647457123,0.17845293879508972,0.3319666385650635,0.08572205901145935,-0.24089312553405762,0.4155759811401367,0.32165905833244324,0.25136223435401917,0.15883837640285492,0.012308773584663868,-0.04631917551159859,-0.09330517053604126,-0.20589493215084076,0.5094208121299744,-0.26885849237442017,0.14547015726566315,5.9714436531066895,-0.10502542555332184,-0.23733270168304443,-0.01809532940387726,0.5168452262878418,0.03511323779821396,0.09416757524013519,0.315315306186676,-0.0899929478764534,0.10895819962024689,-0.26942503452301025,-0.0172042828053236,0.18967361748218536,0.0640888437628746,-0.38739100098609924,0.2117658406496048,0.011044575832784176,0.2321043461561203,-0.01471694279462099,0.36401012539863586,0.2701683044433594,-0.004887457005679607,-0.04303939267992973,-0.23352256417274475,-0.012150518596172333,-0.4096793830394745,-1.1356163024902344,-0.43677225708961487,-3.550256837965068e-32,-0.4426610469818115,0.0039997645653784275,0.25532644987106323,0.3893808424472809,-0.24340558052062988,-0.0599832609295845,-0.19283150136470795,0.057209987193346024,-0.26436322927474976,-0.08483975380659103,-0.4021152853965759,-0.1511671245098114,0.30095815658569336,0.4325122833251953,0.23937031626701355,-0.36551886796951294,0.3893909454345703,0.18453122675418854,-0.27166834473609924,-0.47644755244255066,0.11388427019119263,-0.19418831169605255,0.016419002786278725,-0.02714892290532589,-0.24712885916233063,-0.26292383670806885,0.27719220519065857,-0.15684174001216888,0.027804719284176826,-0.4107171297073364,-0.12025873363018036,-0.10459471493959427,0.151932492852211,-0.027021700516343117,-0.08023685961961746,-0.06768982857465744,0.1416706144809723,-0.3542255461215973,0.04471932351589203,0.07094629853963852,0.3376694917678833,-0.22079719603061676,-0.1574292778968811,-0.11977682262659073,-0.010069059208035469,0.35441264510154724,0.46962249279022217,0.2199486494064331,-0.15697507560253143,-0.1155332550406456,-0.20464065670967102,0.5610281825065613,-0.33348146080970764,-0.0908617451786995,0.06416584551334381,0.07863340526819229,0.0168662928044796,0.16971538960933685,-0.15340009331703186,-0.027347644791007042,-0.13447539508342743,0.1442386656999588,0.21216925978660583,-0.10431468486785889,-0.15172457695007324,-0.4851713180541992,-0.11033784598112106,-0.056953828781843185,-0.1773247867822647,0.4548363983631134,-0.47506269812583923,0.24583224952220917,-0.1904970407485962,-0.19679898023605347,0.04688882455229759,0.12003045529127121,0.02691575698554516,-0.17542634904384613,0.1104234978556633,-0.29962897300720215,-0.11127820611000061,0.09934868663549423,0.1588962823152542,-0.42320096492767334,0.19229194521903992,-0.18575307726860046,0.274140328168869,-0.15526533126831055,0.2423650622367859,0.06687882542610168,-0.06256048381328583,0.21206651628017426,0.29260969161987305,-0.17832309007644653,-0.39957812428474426,3.4350175431557926e-32,-0.35638171434402466,-0.057029590010643005,-0.2979898452758789,0.08032840490341187,-0.05366574972867966,-0.1650254726409912,0.12594930827617645,0.039473194628953934,-0.33692264556884766,-0.10342567414045334,-0.2345643937587738,-0.33872056007385254,0.2741716206073761,0.1350647360086441,0.21950314939022064,0.30859431624412537,-0.11684500426054001,-0.045953940600156784,-0.10458961874246597,-0.19488874077796936,-0.34691011905670166,-0.1321580410003662,0.2788510322570801,0.02774188481271267,0.06421735882759094,0.26277631521224976,0.21344691514968872,-0.3015608489513397,-0.07291330397129059,0.10531140118837357,0.10845626145601273,-0.1495971828699112,-0.14238590002059937,0.33654123544692993,-0.17439107596874237,0.38333097100257874,-0.12374186515808105,-0.3008224666118622,0.4254079759120941,-0.03267906233668327,-0.3469311594963074,0.2926954925060272,-0.24380521476268768,-0.015412232838571072,-0.17672847211360931,0.027931084856390953,0.2911330759525299,0.39331477880477905,0.07462529093027115,0.27581652998924255,-0.15362697839736938,0.18701013922691345,-0.011059082113206387,0.12623043358325958,0.019254567101597786,-0.2750660479068756,-0.248543843626976,-0.0942077562212944,0.10744339972734451,-0.2724156975746155,-0.07343391329050064,-0.04064192250370979,0.12483348697423935,-0.12731142342090607,-0.23115107417106628,-0.04255004972219467,0.35364219546318054,0.23726531863212585,-0.451206773519516,0.06052766740322113,0.3267849087715149,0.22377997636795044,-0.05981689691543579,0.29418498277664185,-0.27102434635162354,-0.26484277844429016,0.34959089756011963,0.044529736042022705,-0.14558373391628265,-0.4335179924964905,0.21192827820777893,-0.22762803733348846,0.2698962390422821,0.027713607996702194,-0.025892863050103188,0.500705897808075,-0.24431905150413513,-0.019752342253923416,0.24906526505947113,0.19879215955734253,-0.1733323037624359,0.30850163102149963,-0.2541195750236511,0.042283277958631516,0.007469732314348221,-8.822195241009467e-08,-0.10274249315261841,0.10584837198257446,-0.20383474230766296,-0.04663485288619995,0.12469750642776489,0.0652632936835289,-0.0189505685120821,-0.17445531487464905,-0.028420982882380486,0.15109769999980927,-0.14045454561710358,-0.41093143820762634,-0.21196286380290985,-0.3185705542564392,0.6753252148628235,0.04714430496096611,-0.3399130403995514,0.30858418345451355,0.20665478706359863,-0.2666056752204895,0.30833128094673157,0.6474772095680237,-0.33229222893714905,0.3207392394542694,0.24034865200519562,0.08804589509963989,0.20210163295269012,-0.4080621898174286,0.35968881845474243,-0.09770102053880692,0.0049887765198946,0.2592270076274872,-0.3389747440814972,-0.037582624703645706,-0.04751720279455185,0.06412012130022049,0.12555089592933655,0.5372346639633179,0.0815146416425705,0.13454164564609528,-0.46440252661705017,-0.08293937146663666,0.21505337953567505,-0.11153809726238251,-0.23872314393520355,-0.20049722492694855,-0.17567995190620422,-0.284086674451828,0.21320408582687378,-0.3107796907424927,0.2855813801288605,0.030451791360974312,0.028395885601639748,0.5685003399848938,0.3244066834449768,-0.1383146494626999,-0.034331031143665314,-0.04187970235943794,0.20940563082695007,-0.12817086279392242,-0.23346246778964996,-0.23160558938980103,-0.33829039335250854,-0.11962376534938812],[0.022909261286258698,-0.010346662253141403,-0.038009487092494965,-0.5639296770095825,0.03328079730272293,-0.5901224613189697,-0.3641219139099121,-0.6023812294006348,-0.6684089303016663,-0.2100764513015747,0.20220491290092468,0.32529470324516296,-0.49839669466018677,0.4080882668495178,-0.806993305683136,0.10353882610797882,-0.6815439462661743,1.2953896522521973,0.6455633640289307,0.16736817359924316,-1.240642786026001,-0.2146749347448349,-0.2535834014415741,0.08538941293954849,0.7851578593254089,0.8285587430000305,0.5334327220916748,-0.4617541432380676,0.4535868465900421,-0.368888258934021,0.7020595669746399,0.888437807559967,-0.8788026571273804,0.36398130655288696,-1.4741572141647339,0.1732942759990692,0.4865669012069702,0.34871938824653625,-0.8801512122154236,0.6120744347572327,0.2837604284286499,0.43773797154426575,0.1410801261663437,0.3856535255908966,0.6527307033538818,0.19923311471939087,-0.13636904954910278,0.05091298744082451,0.48886141180992126,0.46219804883003235,-0.8080113530158997,-0.8776068091392517,-0.4275367856025696,-0.46475034952163696,-0.5139144659042358,-0.5285087823867798,0.40012863278388977,0.3880755603313446,0.5143498182296753,-0.05910266190767288,0.3217366933822632,-0.4307345449924469,0.6973230242729187,-0.12272047996520996,-0.23432107269763947,-0.4097335934638977,-0.12454249709844589,1.3484266996383667,-0.00908494833856821,0.7079669833183289,0.012127318419516087,0.11530778557062149,-0.05535063520073891,-0.22191061079502106,0.03363402932882309,0.7987334728240967,0.26797664165496826,0.2752758264541626,0.8552129864692688,-0.11302214860916138,-0.387207567691803,0.16375505924224854,-0.45154425501823425,-0.8254179358482361,0.4439769685268402,1.2497998476028442,-0.16056136786937714,0.19466885924339294,0.7110124230384827,0.03766143321990967,0.5967329740524292,0.6399787068367004,0.4542681574821472,-0.30427083373069763,0.49598947167396545,-0.8344345092773438,0.7814719676971436,-0.2755371630191803,0.2933262884616852,-0.3545992970466614,0.356761634349823,-0.5950918793678284,-0.39615365862846375,0.6781384944915771,-0.05419967696070671,-0.19843989610671997,0.3266812562942505,-0.4062080681324005,0.14659003913402557,-0.8468134999275208,-0.2399354726076126,-0.0261697918176651,-0.8067123889923096,-0.5111156702041626,0.1667945384979248,-0.38350021839141846,-0.3007695972919464,-0.18204934895038605,0.8000698685646057,0.07904359698295593,-0.1677805632352829,0.28649893403053284,-0.2223852574825287,0.3134624660015106,-0.7506750226020813,0.18428963422775269,-0.34886685013771057,2.8063760947738923e-32,-1.0899075269699097,0.2087843120098114,0.3088136613368988,0.31073230504989624,0.14980848133563995,-0.10020580887794495,0.12418956309556961,0.5180423259735107,0.31623440980911255,0.10426308214664459,-0.8841572403907776,-0.19474612176418304,0.3061025142669678,1.5586128234863281,0.8580184578895569,0.040116894990205765,0.8539421558380127,0.19710542261600494,-0.4123418927192688,-1.062356948852539,0.9608045816421509,-0.8703911304473877,-0.22348478436470032,-0.22357307374477386,-0.5761101841926575,-0.505524754524231,0.013747131451964378,-0.3479904234409332,-1.0304858684539795,-0.04883238673210144,-0.15227395296096802,-0.22139279544353485,0.3872717618942261,0.01672203466296196,-0.30600929260253906,0.9906411170959473,0.620538592338562,0.01725861430168152,0.4714782238006592,0.02687290497124195,0.4389759600162506,-0.5540168881416321,1.0081638097763062,0.03473352640867233,-0.17889708280563354,0.6462663412094116,0.9988086223602295,0.2230461686849594,-0.9186086654663086,-0.02537022903561592,-0.7594552636146545,0.159952774643898,0.23206442594528198,-0.06784622371196747,0.4821963608264923,0.612856924533844,-0.4688538908958435,0.25752517580986023,-0.25124695897102356,-0.655558168888092,-0.40373465418815613,0.9104257822036743,0.7778791189193726,-0.6169568300247192,-0.9149924516677856,-1.3234703540802002,-0.41948238015174866,0.09203090518712997,-0.2712172567844391,1.0503792762756348,0.38051217794418335,0.4284329116344452,0.04551517218351364,-0.25992727279663086,0.26230236887931824,0.8285337686538696,-0.1186424121260643,-0.14596033096313477,-0.4791563153266907,-0.2338666021823883,-1.4722074270248413,0.6367579102516174,-0.04922576993703842,-0.7950900793075562,0.6587182283401489,0.3326897621154785,-0.03703486546874046,-1.4089560508728027,0.811022162437439,0.16101522743701935,-0.7293428778648376,-0.11656355857849121,0.12495481222867966,0.31700825691223145,-0.3942163288593292,-1.446981677174006e-32,-1.6541186571121216,-0.08928072452545166,0.09685203433036804,0.6290793418884277,-0.8191053867340088,-0.24544070661067963,0.4469108581542969,-0.13650548458099365,-1.2783864736557007,-0.16167280077934265,-0.26396942138671875,-0.37525632977485657,0.4393373131752014,-0.0989139974117279,0.0326697900891304,1.3034276962280273,-0.661845862865448,-0.1786249876022339,0.01639172062277794,0.34509193897247314,-0.7161890268325806,-0.3164549469947815,0.8785247206687927,0.15799786150455475,0.3121373653411865,0.297394335269928,1.7975914478302002,0.3994860351085663,-0.5949615240097046,-0.30673685669898987,0.1886770874261856,-0.6638122200965881,0.18537001311779022,0.915176510810852,0.020665662363171577,0.7539640069007874,-0.3035850524902344,-0.1722169816493988,0.6148290038108826,-0.013283871114253998,-0.6266619563102722,0.18287505209445953,0.06308615952730179,-0.6936830878257751,-0.3058895766735077,0.46196088194847107,1.2789740562438965,0.7213206887245178,0.8601747751235962,0.7067865133285522,-0.20606368780136108,0.24582837522029877,0.12587347626686096,0.05975797027349472,0.17504408955574036,-0.3895443379878998,-1.0705080032348633,-0.33679527044296265,1.850942850112915,-0.8152919411659241,-0.08933337777853012,-0.3669746518135071,0.18253524601459503,-0.5616438388824463,0.687095582485199,0.017412984743714333,0.6190701127052307,0.11787677556276321,-0.291070818901062,0.05576847493648529,0.8560897707939148,1.0165376663208008,-0.4696216583251953,-0.05906480923295021,-0.18181942403316498,-0.7318390607833862,1.1463192701339722,-0.1988205760717392,-0.5727343559265137,-0.33447176218032837,-0.08696731925010681,0.0469776876270771,0.6539347171783447,0.552266001701355,-0.5900633335113525,1.1290043592453003,-0.1025848314166069,0.1840170919895172,0.5746421813964844,1.0411019325256348,-0.4437291622161865,0.4778691530227661,0.3821168541908264,0.19083960354328156,0.2781353294849396,-8.893253067299156e-08,-0.5387905836105347,-0.2773584723472595,-1.22183358669281,-0.10265596210956573,-0.04592133313417435,-0.6880545616149902,-0.11229904741048813,-0.33099812269210815,-0.10858562588691711,-0.4353832006454468,-0.8247130513191223,-0.43962666392326355,-0.3621150553226471,0.00962120946496725,0.9407971501350403,-0.29026079177856445,-0.0007158131338655949,0.005607920233160257,-0.1339379847049713,0.08337001502513885,0.03175393491983414,0.6616770029067993,-0.2892949879169464,0.9322808384895325,0.32240167260169983,-0.12262044101953506,0.08669479936361313,1.0168671607971191,1.635699987411499,-0.7137191295623779,-0.23718467354774475,1.0472781658172607,-0.28677886724472046,-0.08206837624311447,0.32224899530410767,-0.24866518378257751,-0.4264746904373169,0.3564327359199524,-0.5027561783790588,0.724498987197876,-0.4797656834125519,0.4421256482601166,0.4578186571598053,-0.7772694230079651,-0.4939265847206116,0.25703275203704834,-0.390948623418808,-0.5357860922813416,-0.2869722545146942,-0.9204695224761963,0.38671696186065674,-0.07896383106708527,0.27211493253707886,1.118689775466919,0.6548080444335938,-0.360472172498703,-0.3638365566730499,-0.17273861169815063,-0.14624330401420593,-0.3019760549068451,-0.8103756904602051,-0.5994964241981506,-0.0040009962394833565,-0.7742329239845276],[0.05415450781583786,1.3574442863464355,-0.452359676361084,-0.47323888540267944,0.4199760854244232,-0.3334192633628845,0.8222646713256836,-0.4918695390224457,-1.3375576734542847,-0.20722225308418274,-0.06783012300729752,0.24097897112369537,0.02357008121907711,0.4056730568408966,-1.1108454465866089,-0.21819020807743073,-0.9713428616523743,1.699537754058838,-1.4437686204910278,-0.319157212972641,-0.7160840630531311,-0.2770059406757355,-0.4155363440513611,-0.05581238493323326,0.9374152421951294,0.9449763894081116,0.17634513974189758,-0.7080159187316895,-0.06024996563792229,-0.23690535128116608,0.7334856986999512,0.21211911737918854,0.6151797771453857,-0.05682549998164177,-0.7240273952484131,-0.5460084080696106,-0.05697411298751831,0.3792550265789032,-1.0187100172042847,0.8503050208091736,0.18645821511745453,0.14035820960998535,0.154052734375,0.4066165089607239,0.5912805199623108,-0.5002454519271851,-0.7135121822357178,0.3282373547554016,0.3252999186515808,0.14853189885616302,-1.2598235607147217,-0.39472535252571106,-0.3257772624492645,0.0904008150100708,-0.5542494654655457,-0.7845144867897034,0.4050471782684326,0.8452573418617249,0.4859549105167389,-0.36334899067878723,-0.3362504541873932,-0.001505440566688776,0.988246738910675,0.10035918653011322,0.29022452235221863,-0.811143159866333,0.6951541304588318,0.16584071516990662,-0.3378545045852661,0.06063834950327873,0.47201892733573914,0.2644183933734894,0.13127131760120392,-0.06582813709974289,0.46013015508651733,0.5542388558387756,-0.521423876285553,0.7758939266204834,1.0999751091003418,0.09288281947374344,-0.46726977825164795,-0.34303635358810425,-0.681291937828064,-0.30681848526000977,0.5419886112213135,1.254961371421814,-0.4941122233867645,0.16069352626800537,0.7003132700920105,-0.29958364367485046,0.1757177710533142,0.6032736897468567,-0.6365149021148682,0.37369030714035034,0.3933085501194,-0.6762889623641968,0.7989315390586853,-1.1378741264343262,0.2391497939825058,-0.06921595335006714,0.5574874877929688,0.30644872784614563,0.8494722843170166,0.9423995614051819,-0.054868582636117935,-0.052302632480859756,0.11214302480220795,-0.005870736204087734,0.9827466607093811,-0.775553822517395,-0.37890252470970154,0.18581055104732513,-0.6858078837394714,-0.03569735214114189,0.5609368085861206,-0.15925507247447968,0.5851295590400696,0.2617282569408417,0.5704636573791504,0.1008179783821106,-0.40285468101501465,0.41344767808914185,-0.21682770550251007,0.40325209498405457,-0.11897534132003784,0.2451254427433014,0.0240495428442955,3.8279853046356833e-32,-1.0791844129562378,0.001983738737180829,0.1364251971244812,0.8289531469345093,-0.26735854148864746,-0.23382361233234406,0.02662372961640358,0.20187591016292572,0.004981178790330887,0.019572153687477112,-0.11145426332950592,0.1796877235174179,0.2406044453382492,1.018491506576538,1.1115669012069702,-0.1503800004720688,1.043251872062683,1.031089186668396,-0.6138976216316223,-0.6772643327713013,0.8841919302940369,-0.5078752636909485,0.18619705736637115,0.18136470019817352,-0.2811219096183777,-0.7585719227790833,0.6178541779518127,-0.2791368365287781,0.43150919675827026,-0.39042583107948303,-0.6801278591156006,-0.4168354570865631,-0.6256169080734253,0.1949416846036911,-0.2014762908220291,0.7210873961448669,0.6204773783683777,0.08341678231954575,0.3361571729183197,-0.11215587705373764,0.16692234575748444,-0.5959279537200928,0.71811842918396,-0.11260335892438889,-0.11948493123054504,0.6979227066040039,0.8476638197898865,0.35602766275405884,0.0867568701505661,-0.07018072158098221,0.17389428615570068,-0.13503840565681458,0.07892785966396332,0.1998891681432724,0.04042096063494682,0.2321709543466568,0.05299095809459686,-0.10412099212408066,0.2143561989068985,-1.0602686405181885,-0.262238085269928,-0.25709864497184753,0.686886727809906,-0.04218928515911102,-0.08203674107789993,-1.7819565534591675,-0.003197589423507452,-0.03884487226605415,-0.16612257063388824,1.2295445203781128,-0.8369224071502686,0.26757076382637024,0.6714149117469788,0.2160344123840332,-0.6281585693359375,0.674224317073822,-0.13037747144699097,-0.3399542272090912,-0.2640392482280731,-0.34015318751335144,-0.6892695426940918,0.777915358543396,0.3265770673751831,-0.6677676439285278,0.17362123727798462,-0.6523596048355103,0.4109192490577698,-0.5633350014686584,0.2952038049697876,0.3236108720302582,-1.2974720001220703,-0.007650385610759258,-0.17562218010425568,0.0004697871336247772,-0.9583083987236023,-1.8435620266675612e-32,-1.0234454870224,-0.15475662052631378,-0.11348585784435272,0.20834478735923767,-0.8527840971946716,-0.43127328157424927,-0.05661498010158539,-0.11501143127679825,-0.8699365854263306,-0.6935716271400452,-0.01792106218636036,-0.4199169874191284,0.8905774354934692,-0.8598840832710266,-0.29860633611679077,0.3055565655231476,0.1418425291776657,0.28958940505981445,-0.31596192717552185,0.2314498871564865,-0.6171757578849792,-0.603322446346283,0.34713461995124817,-0.4798189401626587,0.2421339601278305,0.1124284565448761,0.5901508331298828,-0.19122764468193054,0.827518105506897,-0.24114136397838593,0.20699766278266907,-0.44395312666893005,-0.31027960777282715,0.440324604511261,0.1597265750169754,0.4469306766986847,0.30672842264175415,-0.10835956782102585,0.17772823572158813,0.06620355695486069,-0.1822291761636734,0.19486868381500244,-0.7715476155281067,-0.18352548778057098,-0.02614205703139305,-0.08584567904472351,0.7709946632385254,0.21482498943805695,0.2548576295375824,0.43700262904167175,0.14313766360282898,0.9048771262168884,0.23666329681873322,-0.27158427238464355,-0.10851170122623444,0.11144927889108658,-0.042713724076747894,-0.4624885022640228,0.045859772711992264,-0.6476991772651672,-0.9667921662330627,-1.0828081369400024,0.09478998184204102,-0.6615127325057983,-0.27939707040786743,-0.04141612350940704,0.5256527066230774,0.2555273473262787,-0.056273847818374634,0.40352967381477356,0.5696406364440918,0.6279202103614807,0.08068423718214035,0.5788111686706543,-0.2992602288722992,-1.2348178625106812,0.8412310481071472,0.2341376096010208,0.012391090393066406,-0.7150497436523438,0.4120013117790222,0.2439160794019699,0.1377301663160324,0.6853378415107727,0.7593275308609009,0.44321250915527344,0.8011146187782288,0.3238663375377655,0.19734080135822296,0.7194167971611023,-0.2160823941230774,0.07643792778253555,-0.26379916071891785,0.09240511059761047,-0.4577013850212097,-9.118180344103166e-08,-0.14147047698497772,0.49243074655532837,-0.5946840643882751,0.42139366269111633,0.0602932944893837,-0.48465558886528015,0.04221335053443909,-0.09533306956291199,-0.5597880482673645,0.23174113035202026,-0.5880532264709473,-0.4046148657798767,0.03068098984658718,0.2977662980556488,1.037116527557373,-0.20988278090953827,-0.06265540421009064,0.4171236753463745,-0.059025004506111145,-0.6159367561340332,-0.144444540143013,0.03894976153969765,-0.43873104453086853,0.31459668278694153,0.4685252904891968,-0.5386199951171875,0.008569285273551941,1.2780497074127197,1.2480250597000122,-0.41035449504852295,-0.5976592302322388,1.1608716249465942,-0.03944261744618416,-0.21606674790382385,0.2684326171875,-0.2980797588825226,-0.39914900064468384,1.206718921661377,-0.37182503938674927,-0.38332971930503845,-0.7086963057518005,0.5035828948020935,0.18246214091777802,0.22413261234760284,-0.06573786586523056,-0.20360144972801208,-0.04779660701751709,-0.6131598949432373,-0.02034844644367695,-0.7495336532592773,0.5693603157997131,-0.05125690996646881,0.38133612275123596,0.4897633194923401,-0.1131412461400032,-0.33217909932136536,-0.13125081360340118,0.06533123552799225,-0.07385297864675522,0.15340249240398407,-1.0101014375686646,-0.21474570035934448,-0.45737797021865845,0.39601096510887146],[0.6592098474502563,-0.1786622405052185,-0.7219332456588745,0.8695473670959473,0.92046058177948,-0.22790318727493286,2.5295679569244385,1.061110496520996,-0.6722424030303955,-0.2307255119085312,-0.2740589678287506,-0.32185882329940796,-0.10805870592594147,0.04803042486310005,-0.48462721705436707,0.23512506484985352,-0.12060733139514923,0.2587464153766632,-0.9934223294258118,-0.35397565364837646,-1.5720378160476685,0.4912026822566986,-0.28958550095558167,-0.2529217600822449,0.35193920135498047,1.0201053619384766,0.12555648386478424,-0.036134131252765656,0.5027483701705933,-1.087280035018921,-0.1292930245399475,-0.6914108395576477,1.096509575843811,0.06917603313922882,-0.5289838314056396,-0.2374088019132614,-0.37808093428611755,-0.3578682243824005,0.09197568893432617,0.28949835896492004,-0.3599793016910553,-0.1006445586681366,0.7007849812507629,0.369109570980072,0.4362359046936035,-0.32079800963401794,-0.8967679142951965,0.615837574005127,0.8782556056976318,0.05068836733698845,-0.236118882894516,0.20132601261138916,-0.7990772128105164,0.37518590688705444,0.07543071359395981,0.4039730131626129,0.032021477818489075,1.0889170169830322,0.6407288908958435,-0.1758497655391693,0.6137016415596008,-0.08390045911073685,0.3531261682510376,0.3053632974624634,0.9464857578277588,0.366118460893631,-0.19205284118652344,0.586681067943573,-0.5777187943458557,-0.36570248007774353,-0.14863798022270203,0.2956162989139557,-0.5145608186721802,1.1896207332611084,0.5544019341468811,-0.33099883794784546,0.3227398991584778,-0.11736711859703064,0.9182295203208923,-0.18505679070949554,-0.5851609706878662,-0.3478500247001648,-0.7545455694198608,-0.3024429380893707,0.6187875270843506,0.33495694398880005,0.7711738348007202,0.3252023756504059,0.18578872084617615,-0.1665017306804657,0.20944803953170776,-0.5023778080940247,-0.38091275095939636,0.36065673828125,0.6641368865966797,-0.3811725676059723,0.25371116399765015,0.23149560391902924,0.5281107425689697,-0.05890265852212906,0.4433092176914215,-0.3625413477420807,0.13335324823856354,-0.4034634232521057,0.0930560976266861,0.34539833664894104,-0.1697702705860138,0.3866070806980133,0.4232567548751831,0.5139338374137878,-0.2646891176700592,-0.237815722823143,-0.8041777610778809,-0.16138286888599396,0.22865000367164612,-0.8293580412864685,0.961155891418457,-0.36592599749565125,0.5777104496955872,-0.36446189880371094,-0.18928727507591248,-0.1780337393283844,-1.5971875190734863,0.5413707494735718,-0.8625906109809875,-0.5064886212348938,-0.23806381225585938,-4.3060359349752666e-32,-0.8571036458015442,-0.9009466171264648,0.3872836232185364,0.7967178821563721,-0.0012465240433812141,-0.17969205975532532,-0.8491281867027283,-0.051596686244010925,-0.6542484760284424,-0.877256453037262,-0.1289374977350235,0.20889587700366974,-0.717841386795044,0.9696531295776367,-0.39712226390838623,-0.8443758487701416,1.2194961309432983,-0.665886640548706,-1.4099172353744507,-0.5780979990959167,-0.25343263149261475,-1.0733965635299683,0.7448278069496155,-0.855972170829773,-0.5004740953445435,-0.2209703028202057,0.4697866439819336,-0.5432453155517578,0.16375496983528137,-0.24012692272663116,-0.3464125692844391,0.47132909297943115,-0.2698488235473633,-0.709399402141571,0.015017682686448097,-0.06791850179433823,0.3933863341808319,-0.01930973120033741,0.3431219756603241,-0.14618957042694092,-0.3621364235877991,-0.4555363655090332,-0.13010257482528687,-0.058377016335725784,0.6679726243019104,0.45897912979125977,0.3657625615596771,-0.010208696126937866,-0.2676880359649658,0.3611047863960266,0.15548580884933472,0.0030269515700638294,-0.7033557295799255,-0.4844873249530792,-0.098995141685009,0.024899592623114586,-0.04244342818856239,0.5020899176597595,0.5908389091491699,-0.12424250692129135,-0.03223080560564995,-0.2737865149974823,0.01702381856739521,0.06681042909622192,-1.2038122415542603,-0.09958893805742264,0.037355441600084305,-0.18762391805648804,0.4808095395565033,0.4470072090625763,0.21162478625774384,-0.0810588076710701,1.2396446466445923,0.11500293016433716,0.2353416532278061,-0.001104000024497509,0.783012330532074,-0.5274820923805237,-1.2115076780319214,-0.07121656835079193,0.578625500202179,0.7870814800262451,-0.12418379634618759,-1.058090090751648,2.1915063858032227,-0.5273946523666382,0.6308826804161072,-0.9659997820854187,0.6103891134262085,-0.10232412815093994,-0.8032033443450928,0.08809131383895874,1.011653184890747,-0.973156750202179,-0.8570232391357422,2.0142070722084941e-32,-0.5560421943664551,-0.11705071479082108,0.1110178679227829,-0.1436503827571869,-0.6070836782455444,-0.18545544147491455,0.7676862478256226,0.7377379536628723,0.7375638484954834,0.020308466628193855,0.25560203194618225,-0.2171994000673294,0.9486690163612366,-0.18151745200157166,0.5357708930969238,0.0072333309799432755,-0.023880397900938988,0.25852444767951965,-0.7933613061904907,-0.26327240467071533,-1.0698168277740479,0.2833334505558014,0.28620296716690063,-0.3011966049671173,0.07064379006624222,0.20684409141540527,0.9437636733055115,-1.0211180448532104,0.9965919256210327,-0.21508261561393738,0.49032989144325256,-0.3298519253730774,-0.6016286015510559,0.27065473794937134,-0.11754932254552841,-0.35522228479385376,-0.842706561088562,-0.28390246629714966,-0.1298736184835434,-0.8256822824478149,-0.2663767635822296,0.3601182997226715,0.6756768226623535,-0.2616075277328491,0.32438039779663086,-0.05026748776435852,0.06763017177581787,-0.027060965076088905,-0.11617332696914673,0.702663004398346,-0.8765251040458679,0.23849453032016754,0.27948668599128723,-0.4495956599712372,-0.30419856309890747,-0.635137677192688,1.1320126056671143,-0.9318191409111023,0.5359644889831543,-0.8841976523399353,-0.7856243252754211,-0.20066848397254944,-0.35192808508872986,-0.4374886453151703,0.10824979096651077,-1.1595414876937866,0.2565730810165405,-0.0024427485186606646,-0.810219943523407,-0.06257122755050659,-0.40515270829200745,0.7686329483985901,0.26088660955429077,-0.0606355145573616,0.13100740313529968,-0.5967392325401306,0.5037087202072144,0.5724459290504456,0.032882556319236755,-0.9202459454536438,1.0662553310394287,0.05725070461630821,0.6763278841972351,0.19481080770492554,-0.8768101334571838,0.49582526087760925,0.206842303276062,0.44465529918670654,0.3668024241924286,0.027252955362200737,-0.234380304813385,0.9938817024230957,-0.6850712895393372,-0.15643101930618286,0.10197728127241135,-9.724411853540005e-08,-0.0050558955408632755,-0.14163723587989807,0.1451500952243805,0.4734324812889099,0.5203513503074646,0.1092730313539505,-0.46666479110717773,-0.16230100393295288,-0.5070863962173462,0.30285879969596863,-0.47886836528778076,-0.2639915645122528,0.4601040780544281,-0.07785855233669281,0.3918492794036865,0.8532705903053284,-0.4116540849208832,-0.3197295069694519,-0.34722036123275757,-0.4860093295574188,-0.05753215774893761,0.07905133068561554,-0.054087575525045395,0.41977229714393616,0.09712330996990204,0.6789669990539551,0.6491153836250305,1.4718616008758545,-0.017331847921013832,-0.14845804870128632,0.09932011365890503,1.001815915107727,-0.30209824442863464,-0.7118170857429504,-0.3425062596797943,0.318437397480011,-0.3737075924873352,0.539016604423523,-0.5635029673576355,0.03194466605782509,0.11866474151611328,-0.4977225363254547,-0.04597298428416252,0.14479702711105347,-0.832782506942749,0.49279022216796875,0.11022898554801941,-0.36633434891700745,-0.006154068745672703,0.18806421756744385,0.7898309230804443,0.13825008273124695,0.9246245622634888,0.20227625966072083,0.6318255662918091,0.907319962978363,0.05449135974049568,0.3676578998565674,0.25943851470947266,-0.26134541630744934,0.9868384003639221,-0.17261922359466553,-1.3767204284667969,-1.0571482181549072],[0.020096292719244957,0.8486655354499817,-0.37301385402679443,0.19726881384849548,-0.32333511114120483,-0.582426130771637,0.6799147725105286,0.19017747044563293,-0.36569997668266296,-0.42362311482429504,0.2538243234157562,-0.41609007120132446,0.17242230474948883,-0.06998900324106216,-0.49589383602142334,0.05023423582315445,-0.6912860870361328,0.43636009097099304,-0.5416205525398254,-0.3101215958595276,-0.509748101234436,-0.3633144497871399,-0.4160236716270447,0.04808132350444794,0.18222138285636902,1.1804583072662354,0.5502727031707764,0.17395950853824615,0.1997494250535965,-0.9309079647064209,0.09887976199388504,0.15326258540153503,0.5309121608734131,0.37132343649864197,-1.4128696918487549,-0.16285298764705658,-0.5681222081184387,0.3132017254829407,-0.5133925676345825,0.5623440146446228,-0.2688688039779663,-0.13473860919475555,0.07591169327497482,0.013120939955115318,0.442261278629303,0.15172956883907318,-0.32035595178604126,0.08709868043661118,0.9815473556518555,-0.005941813811659813,-1.0833547115325928,-0.39197418093681335,-0.9568983912467957,0.13696351647377014,0.27201592922210693,-0.32245585322380066,0.15660499036312103,0.06366614252328873,0.6048558950424194,-0.7452844381332397,0.14200912415981293,-0.2059064656496048,-0.06506334245204926,1.0144848823547363,0.851942777633667,-0.061090655624866486,0.009426277130842209,0.07349449396133423,-0.718323290348053,0.39298778772354126,-0.4826969504356384,0.12062232941389084,-0.48814547061920166,0.5459232330322266,0.08314419537782669,0.02644859254360199,0.06872008740901947,-0.24378417432308197,1.0238786935806274,0.3464713394641876,-0.49824273586273193,-0.2865202724933624,-0.8981944918632507,0.3382564187049866,0.4116309583187103,0.768248975276947,0.20717069506645203,0.4318086504936218,0.7015975117683411,0.16531822085380554,0.08390448987483978,0.43017083406448364,-0.22095969319343567,0.29717522859573364,-0.06153479218482971,0.2767719030380249,0.745822548866272,-0.9681623578071594,0.2510322332382202,-0.3439933955669403,0.49623823165893555,-0.617790162563324,-0.23222538828849792,0.6945452690124512,-0.4951092004776001,0.14292892813682556,0.1644645631313324,-0.034523434937000275,0.2747529149055481,-0.17436356842517853,-0.36583638191223145,-0.1543499082326889,-0.6912095546722412,-0.2760680913925171,0.47702646255493164,0.06530030071735382,0.25860023498535156,-0.028959989547729492,0.5522688627243042,0.057847749441862106,0.05042316019535065,0.18488512933254242,-0.6448588371276855,0.2795063853263855,-0.8702508211135864,-0.3154197633266449,0.3244209885597229,-5.758544639650045e-32,-1.1025973558425903,0.12689387798309326,0.4550663232803345,0.7314335703849792,-0.25601881742477417,-0.3533232510089874,-0.1767244040966034,0.1642875075340271,-0.4625971019268036,0.4397004544734955,-0.7646302580833435,0.03161512687802315,0.023269901052117348,0.3940275013446808,0.9733719229698181,-0.4311242699623108,1.227001428604126,0.3008420765399933,0.026237882673740387,-0.655461311340332,-0.3084699511528015,-0.6770647168159485,-0.124420665204525,0.5521118640899658,-0.6406050324440002,-0.5167575478553772,0.826893150806427,-0.3605450391769409,0.6685084104537964,0.1886540651321411,0.2164248675107956,-0.029663756489753723,-0.2211315929889679,-0.4465177059173584,0.019905049353837967,-0.09769420325756073,0.47256433963775635,-0.40554189682006836,0.8033366203308105,-0.3981941342353821,-0.09641654044389725,-0.6561076641082764,-0.22865086793899536,-0.3252328932285309,0.18249806761741638,0.9393050074577332,1.083936333656311,0.11169982701539993,0.27814391255378723,0.47963836789131165,-0.6435950398445129,0.16087374091148376,-0.31523287296295166,0.1251869797706604,-0.2593500316143036,0.10936572402715683,-0.036676470190286636,0.7707896828651428,-0.3097276985645294,-0.21895234286785126,0.14598901569843292,-0.001395637635141611,0.451464980840683,-0.16660860180854797,-0.8861490488052368,-0.4445406496524811,-0.7609462141990662,-0.5533163547515869,0.18380722403526306,0.8749280571937561,-1.1128745079040527,0.027273060753941536,0.45239800214767456,0.41225484013557434,-0.003942523617297411,-0.26854652166366577,0.5855395197868347,-0.43782922625541687,-0.4641193449497223,-0.49594393372535706,-1.1053837537765503,0.08155130594968796,-0.08473799377679825,-0.5795508623123169,0.9065677523612976,-0.3835345506668091,0.29984259605407715,-1.3248655796051025,0.3877255618572235,0.18937692046165466,-1.5677798986434937,0.21724115312099457,0.40765175223350525,-0.38122695684432983,-0.8029585480690002,4.981900224039163e-32,-1.1347377300262451,0.191227987408638,-0.7926865220069885,-0.14398731291294098,-0.6299229264259338,0.015237079933285713,0.5424725413322449,0.04292089864611626,-0.7675654292106628,0.34540480375289917,-0.047323789447546005,-0.39859190583229065,0.8897927403450012,-0.33538615703582764,0.9461829662322998,1.058070421218872,0.3029458224773407,-0.3227667808532715,-0.6112149357795715,0.03377801924943924,-0.9339179396629333,0.14939239621162415,-0.3886848986148834,0.18274769186973572,-0.09408184885978699,0.166924387216568,0.8912842273712158,-0.040497083216905594,0.20206081867218018,-0.0258831437677145,-0.604256808757782,-0.6318131685256958,-0.3050365746021271,0.43129634857177734,-0.6716107130050659,-0.1078755185008049,1.2066320180892944,-0.5866444110870361,0.007437826134264469,-0.2707204520702362,0.10256680101156235,0.08074837177991867,0.034223515540361404,1.2875392436981201,-0.23304058611392975,-0.11464843153953552,0.539581835269928,0.5655103325843811,0.22257253527641296,0.28225260972976685,-0.5862346887588501,-0.18460439145565033,-0.39733225107192993,-0.25606024265289307,0.10236450284719467,0.11869985610246658,-0.03291449323296547,-0.32644200325012207,0.016697345301508904,-0.18373453617095947,-0.46552208065986633,-0.05799460411071777,0.08494109660387039,0.038062792271375656,0.3073018789291382,-0.7398568391799927,0.24373283982276917,0.2125770002603531,-0.6528601050376892,0.14052245020866394,0.9358307123184204,0.9053934812545776,-0.11766186356544495,0.04682016000151634,-0.8624746799468994,-0.7309844493865967,-0.48107028007507324,0.2609233260154724,-0.22173959016799927,-0.18105773627758026,0.8676988482475281,-0.004778312984853983,0.5097503066062927,-0.05398747697472572,-0.44624561071395874,0.8495096564292908,0.6825332641601562,0.7994239926338196,0.33071407675743103,-0.2440253049135208,-0.3250344395637512,1.1436421871185303,0.06417429447174072,0.1459326595067978,0.17686167359352112,-9.48049461158007e-08,-0.3928861618041992,-0.23973974585533142,0.06982940435409546,0.04834498092532158,0.7329522967338562,-0.15050557255744934,0.05376686155796051,0.07302800565958023,-0.5628591775894165,0.16731521487236023,0.3260651230812073,-0.8753454089164734,-0.17304275929927826,0.402657151222229,1.1400023698806763,-0.12546512484550476,-0.33138054609298706,0.2930655777454376,-0.36899641156196594,-0.3791370689868927,0.35569465160369873,0.24150241911411285,0.14865201711654663,0.650809645652771,0.4506867229938507,0.09545692801475525,-0.13285697996616364,0.8478912711143494,1.2270007133483887,0.09717244654893875,0.35952746868133545,0.5415733456611633,-0.1960969865322113,-0.13090701401233673,0.18567539751529694,0.515247106552124,-0.1231289878487587,0.7800031900405884,0.03232037276029587,0.7138656973838806,-0.4066942036151886,0.10101098567247391,0.46307146549224854,-0.41316863894462585,0.14909103512763977,0.41290247440338135,0.09131137281656265,-1.0430519580841064,-0.4264766275882721,-0.7758062481880188,-0.09088319540023804,0.23330043256282806,0.38299423456192017,0.9147360920906067,0.684927761554718,-0.20299623906612396,0.10380864888429642,0.13153237104415894,-0.2884804308414459,0.7346088290214539,0.1727655529975891,0.49309319257736206,-0.37393561005592346,-0.40245506167411804]]] \ No newline at end of file diff --git a/backend/database/reset_db.py b/backend/database/reset_db.py index 8dc83c87..c787a43b 100644 --- a/backend/database/reset_db.py +++ b/backend/database/reset_db.py @@ -164,7 +164,10 @@ def main(): print("\nšŸ“ Running migrations...") import subprocess result = subprocess.run(['uv', 'run', 'run_migrations.py'], - capture_output=True, text=True) + capture_output=True, + text=True, + encoding="utf-8", # <-- ADD THIS + errors="ignore") if result.returncode != 0: print("āŒ Migration failed!") @@ -177,7 +180,10 @@ def main(): print("\n🌱 Loading seed data...") import subprocess result = subprocess.run(['uv', 'run', 'seed_data.py'], - capture_output=True, text=True) + capture_output=True, + text=True, + encoding="utf-8", # <-- ADD THIS + errors="ignore") if result.returncode != 0: print("āŒ Seed data failed!") diff --git a/backend/researcher/server.py b/backend/researcher/server.py index 55183726..e524dd89 100644 --- a/backend/researcher/server.py +++ b/backend/researcher/server.py @@ -10,7 +10,7 @@ from fastapi import FastAPI, HTTPException from pydantic import BaseModel from dotenv import load_dotenv -from agents import Agent, Runner, trace +from agents import Agent, Runner, trace , ModelSettings from agents.extensions.models.litellm_model import LitellmModel # Suppress LiteLLM warnings about optional dependencies @@ -54,7 +54,7 @@ async def run_research_agent(topic: str = None) -> str: # bedrock/openai.gpt-oss-120b-1:0 for OpenAI OSS models # bedrock/converse/us.anthropic.claude-sonnet-4-20250514-v1:0 for Claude Sonnet 4 # NOTE that nova-pro is needed to support tools and MCP servers; nova-lite is not enough - thank you Yuelin L.! - MODEL = "bedrock/us.amazon.nova-pro-v1:0" + MODEL = "bedrock/amazon.nova-pro-v1:0" model = LitellmModel(model=MODEL) # Create and run the agent with MCP server diff --git a/backend/retirement/templates.py b/backend/retirement/templates.py index 38deabd1..09a15ec2 100644 --- a/backend/retirement/templates.py +++ b/backend/retirement/templates.py @@ -56,7 +56,7 @@ Market Assumptions: - Average equity returns: 7% annually - Average bond returns: 4% annually -- Inflation rate: 3% annually +- Inflation rate: 5% annually - Safe withdrawal rate: 4% initially Perform the following analyses: diff --git a/backend/tagger/agent.py b/backend/tagger/agent.py index 5efe8eac..62ffc522 100644 --- a/backend/tagger/agent.py +++ b/backend/tagger/agent.py @@ -6,7 +6,7 @@ from typing import List import logging from decimal import Decimal - +from typing import Dict from pydantic import BaseModel, Field, field_validator, ConfigDict from agents import Agent, Runner, trace from agents.extensions.models.litellm_model import LitellmModel @@ -322,3 +322,63 @@ def classification_to_db_format(classification: InstrumentClassification) -> Ins allocation_regions=regions_dict, allocation_sectors=sectors_dict, ) + +class InstrumentClassificationWithRationale(BaseModel): + # Rationale MUST come first so LLM generates reasoning before answers + rationale: str = Field( + description="Detailed explanation of why these classifications were chosen, including specific factors considered" + ) + + asset_class: AssetClassType = Field( + description="Primary asset class classification" + ) + + asset_class_allocation: Dict[str, float] = Field( + description="Percentage breakdown by asset class", + example={"equity": 100.0} + ) + + region_allocation: Dict[str, float] = Field( + description="Percentage breakdown by geographic region", + example={"north_america": 70.0, "europe": 20.0, "asia_pacific": 10.0} + ) + + sector_allocation: Dict[str, float] = Field( + description="Percentage breakdown by sector (only for equity)", + example={"technology": 30.0, "healthcare": 20.0, "financial": 50.0} + ) + +async def run_tagger_agent(instrument: dict) -> dict: + model = LitellmModel(model=f"bedrock/{bedrock_model}") + + with trace("Classify instrument with explainability"): + agent = Agent( + name="Instrument Tagger with Explainability", + instructions=CLASSIFICATION_INSTRUCTIONS, + model=model, + response_format=InstrumentClassificationWithRationale + ) + + result = await Runner.run( + agent, + input=create_classification_task(instrument), + max_turns=1 + ) + + classification = result.final_output_as(InstrumentClassificationWithRationale) + + # Log the rationale for audit trail + logger.info(json.dumps({ + "event": "CLASSIFICATION_RATIONALE", + "symbol": instrument["symbol"], + "rationale": classification.rationale, + "timestamp": datetime.utcnow().isoformat() + })) + + # Return classification without rationale to planner + return { + "asset_class": classification.asset_class, + "asset_class_allocation": classification.asset_class_allocation, + "region_allocation": classification.region_allocation, + "sector_allocation": classification.sector_allocation + } \ No newline at end of file diff --git a/backend/tagger/templates.py b/backend/tagger/templates.py index 651b3ccd..37b40cfe 100644 --- a/backend/tagger/templates.py +++ b/backend/tagger/templates.py @@ -44,4 +44,19 @@ - Each category must sum to exactly 100.0% - For stocks, typically 100% in one asset class, one region, one sector - For ETFs, distribute based on underlying holdings -- For bonds/bond funds, use fixed_income asset class and appropriate sectors (treasury/corporate/mortgage/government_related)""" \ No newline at end of file +- For bonds/bond funds, use fixed_income asset class and appropriate sectors (treasury/corporate/mortgage/government_related)""" + +ANALYSIS_INSTRUCTIONS_WITH_EXPLANATION = """ +When providing recommendations, always: +1. Start with your reasoning process +2. List specific factors you considered +3. Explain why certain recommendations were prioritized +4. Include any assumptions made +5. Note any limitations or caveats + +Format each recommendation as: +**Recommendation:** [The action to take] +**Reasoning:** [Why this recommendation was made] +**Impact:** [Expected outcome if implemented] +**Priority:** [High/Medium/Low based on user goals] +""" \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 19afc161..a88157c0 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@clerk/nextjs": "^6.32.0", "@microsoft/fetch-event-source": "^2.0.1", - "next": "15.5.3", + "next": "^15.5.9", "react": "19.1.0", "react-dom": "19.1.0", "react-markdown": "^10.1.0", @@ -868,9 +868,9 @@ } }, "node_modules/@next/env": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.3.tgz", - "integrity": "sha512-RSEDTRqyihYXygx/OJXwvVupfr9m04+0vH8vyy0HfZ7keRto6VX9BbEk0J2PUk0VGy6YhklJUSrgForov5F9pw==", + "version": "15.5.9", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.9.tgz", + "integrity": "sha512-4GlTZ+EJM7WaW2HEZcyU317tIQDjkQIyENDLxYJfSWlfqguN+dHkZgyQTV/7ykvobU7yEH5gKvreNrH4B6QgIg==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -884,9 +884,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.5.3.tgz", - "integrity": "sha512-nzbHQo69+au9wJkGKTU9lP7PXv0d1J5ljFpvb+LnEomLtSbJkbZyEs6sbF3plQmiOB2l9OBtN2tNSvCH1nQ9Jg==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.5.7.tgz", + "integrity": "sha512-IZwtxCEpI91HVU/rAUOOobWSZv4P2DeTtNaCdHqLcTJU4wdNXgAySvKa/qJCgR5m6KI8UsKDXtO2B31jcaw1Yw==", "cpu": [ "arm64" ], @@ -900,9 +900,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.5.3.tgz", - "integrity": "sha512-w83w4SkOOhekJOcA5HBvHyGzgV1W/XvOfpkrxIse4uPWhYTTRwtGEM4v/jiXwNSJvfRvah0H8/uTLBKRXlef8g==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.5.7.tgz", + "integrity": "sha512-UP6CaDBcqaCBuiq/gfCEJw7sPEoX1aIjZHnBWN9v9qYHQdMKvCKcAVs4OX1vIjeE+tC5EIuwDTVIoXpUes29lg==", "cpu": [ "x64" ], @@ -916,9 +916,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.5.3.tgz", - "integrity": "sha512-+m7pfIs0/yvgVu26ieaKrifV8C8yiLe7jVp9SpcIzg7XmyyNE7toC1fy5IOQozmr6kWl/JONC51osih2RyoXRw==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.5.7.tgz", + "integrity": "sha512-NCslw3GrNIw7OgmRBxHtdWFQYhexoUCq+0oS2ccjyYLtcn1SzGzeM54jpTFonIMUjNbHmpKpziXnpxhSWLcmBA==", "cpu": [ "arm64" ], @@ -932,9 +932,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.5.3.tgz", - "integrity": "sha512-u3PEIzuguSenoZviZJahNLgCexGFhso5mxWCrrIMdvpZn6lkME5vc/ADZG8UUk5K1uWRy4hqSFECrON6UKQBbQ==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.5.7.tgz", + "integrity": "sha512-nfymt+SE5cvtTrG9u1wdoxBr9bVB7mtKTcj0ltRn6gkP/2Nu1zM5ei8rwP9qKQP0Y//umK+TtkKgNtfboBxRrw==", "cpu": [ "arm64" ], @@ -948,9 +948,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.5.3.tgz", - "integrity": "sha512-lDtOOScYDZxI2BENN9m0pfVPJDSuUkAD1YXSvlJF0DKwZt0WlA7T7o3wrcEr4Q+iHYGzEaVuZcsIbCps4K27sA==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.5.7.tgz", + "integrity": "sha512-hvXcZvCaaEbCZcVzcY7E1uXN9xWZfFvkNHwbe/n4OkRhFWrs1J1QV+4U1BN06tXLdaS4DazEGXwgqnu/VMcmqw==", "cpu": [ "x64" ], @@ -964,9 +964,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.5.3.tgz", - "integrity": "sha512-9vWVUnsx9PrY2NwdVRJ4dUURAQ8Su0sLRPqcCCxtX5zIQUBES12eRVHq6b70bbfaVaxIDGJN2afHui0eDm+cLg==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.5.7.tgz", + "integrity": "sha512-4IUO539b8FmF0odY6/SqANJdgwn1xs1GkPO5doZugwZ3ETF6JUdckk7RGmsfSf7ws8Qb2YB5It33mvNL/0acqA==", "cpu": [ "x64" ], @@ -980,9 +980,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.5.3.tgz", - "integrity": "sha512-1CU20FZzY9LFQigRi6jM45oJMU3KziA5/sSG+dXeVaTm661snQP6xu3ykGxxwU5sLG3sh14teO/IOEPVsQMRfA==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.5.7.tgz", + "integrity": "sha512-CpJVTkYI3ZajQkC5vajM7/ApKJUOlm6uP4BknM3XKvJ7VXAvCqSjSLmM0LKdYzn6nBJVSjdclx8nYJSa3xlTgQ==", "cpu": [ "arm64" ], @@ -996,9 +996,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.5.3.tgz", - "integrity": "sha512-JMoLAq3n3y5tKXPQwCK5c+6tmwkuFDa2XAxz8Wm4+IVthdBZdZGh+lmiLUHg9f9IDwIQpUjp+ysd6OkYTyZRZw==", + "version": "15.5.7", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.5.7.tgz", + "integrity": "sha512-gMzgBX164I6DN+9/PGA+9dQiwmTkE4TloBNx8Kv9UiGARsr9Nba7IpcBRA1iTV9vwlYnrE3Uy6I7Aj6qLjQuqw==", "cpu": [ "x64" ], @@ -1553,6 +1553,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.13.tgz", "integrity": "sha512-hHkbU/eoO3EG5/MZkuFSKmYqPbSVk5byPFa3e7y/8TybHiLMACgI8seVYlicwk7H5K/rI2px9xrQp/C+AUDTiQ==", "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -1625,6 +1626,7 @@ "integrity": "sha512-B7RIQiTsCBBmY+yW4+ILd6mF5h1FUwJsVvpqkrgpszYifetQ2Ke+Z4u6aZh0CblkUGIdR59iYVyXqqZGkZ3aBw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.43.0", "@typescript-eslint/types": "8.43.0", @@ -2148,6 +2150,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3281,6 +3284,7 @@ "integrity": "sha512-QePbBFMJFjgmlE+cXAlbHZbHpdFVS2E/6vzCy7aKlebddvl1vadiC4JFV5u/wqTkNUwEV8WrQi257jf5f06hrg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3455,6 +3459,7 @@ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.9", @@ -4801,9 +4806,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "dev": true, "license": "MIT", "dependencies": { @@ -5464,9 +5469,9 @@ } }, "node_modules/mdast-util-to-hast": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", - "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -6215,12 +6220,13 @@ "license": "MIT" }, "node_modules/next": { - "version": "15.5.3", - "resolved": "https://registry.npmjs.org/next/-/next-15.5.3.tgz", - "integrity": "sha512-r/liNAx16SQj4D+XH/oI1dlpv9tdKJ6cONYPwwcCC46f2NjpaRWY+EKCzULfgQYV6YKXjHBchff2IZBSlZmJNw==", + "version": "15.5.9", + "resolved": "https://registry.npmjs.org/next/-/next-15.5.9.tgz", + "integrity": "sha512-agNLK89seZEtC5zUHwtut0+tNrc0Xw4FT/Dg+B/VLEo9pAcS9rtTKpek3V6kVcVwsB2YlqMaHdfZL4eLEVYuCg==", "license": "MIT", + "peer": true, "dependencies": { - "@next/env": "15.5.3", + "@next/env": "15.5.9", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", @@ -6233,14 +6239,14 @@ "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "15.5.3", - "@next/swc-darwin-x64": "15.5.3", - "@next/swc-linux-arm64-gnu": "15.5.3", - "@next/swc-linux-arm64-musl": "15.5.3", - "@next/swc-linux-x64-gnu": "15.5.3", - "@next/swc-linux-x64-musl": "15.5.3", - "@next/swc-win32-arm64-msvc": "15.5.3", - "@next/swc-win32-x64-msvc": "15.5.3", + "@next/swc-darwin-arm64": "15.5.7", + "@next/swc-darwin-x64": "15.5.7", + "@next/swc-linux-arm64-gnu": "15.5.7", + "@next/swc-linux-arm64-musl": "15.5.7", + "@next/swc-linux-x64-gnu": "15.5.7", + "@next/swc-linux-x64-musl": "15.5.7", + "@next/swc-win32-arm64-msvc": "15.5.7", + "@next/swc-win32-x64-msvc": "15.5.7", "sharp": "^0.34.3" }, "peerDependencies": { @@ -6676,6 +6682,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -6685,6 +6692,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.26.0" }, @@ -6696,7 +6704,8 @@ "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/react-markdown": { "version": "10.1.0", @@ -6730,6 +6739,7 @@ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==", "license": "MIT", + "peer": true, "dependencies": { "@types/use-sync-external-store": "^0.0.6", "use-sync-external-store": "^1.4.0" @@ -6779,7 +6789,8 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/redux-thunk": { "version": "3.1.0", @@ -7650,6 +7661,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -7819,6 +7831,7 @@ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/frontend/package.json b/frontend/package.json index f20ef299..502548e7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,7 +11,7 @@ "dependencies": { "@clerk/nextjs": "^6.32.0", "@microsoft/fetch-event-source": "^2.0.1", - "next": "15.5.3", + "next": "^15.5.9", "react": "19.1.0", "react-dom": "19.1.0", "react-markdown": "^10.1.0", diff --git a/scripts/deploy.py b/scripts/deploy.py index b7e1d59b..a0674daa 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -18,6 +18,7 @@ import time from pathlib import Path +NPM_CMD = "npm.cmd" if os.name == "nt" else "npm" def run_command(cmd, cwd=None, check=True, capture_output=False, env=None): """Run a command and optionally capture output.""" @@ -50,7 +51,8 @@ def check_prerequisites(): for tool, message in tools.items(): try: - run_command([tool, "--version"], capture_output=True) + cmd = [NPM_CMD, "--version"] if tool == "npm" else [tool, "--version"] + run_command(cmd, capture_output=True) print(f" āœ… {tool} is installed") except (subprocess.CalledProcessError, FileNotFoundError): print(f" āŒ {message}") @@ -110,7 +112,7 @@ def build_frontend(api_url=None): node_modules = frontend_dir / "node_modules" if not node_modules.exists(): print(" Installing dependencies...") - run_command(["npm", "install"], cwd=frontend_dir) + run_command([NPM_CMD, "install"], cwd=frontend_dir) # If API URL is provided, create .env.production.local to override .env.local if api_url: @@ -152,7 +154,7 @@ def build_frontend(api_url=None): # Set NODE_ENV to production to ensure .env.production is used build_env = os.environ.copy() build_env["NODE_ENV"] = "production" - run_command(["npm", "run", "build"], cwd=frontend_dir, env=build_env) + run_command([NPM_CMD, "run", "build"], cwd=frontend_dir, env=build_env) # Verify the build out_dir = frontend_dir / "out" diff --git a/scripts/run_local.py b/scripts/run_local.py index 7d471760..91801f32 100644 --- a/scripts/run_local.py +++ b/scripts/run_local.py @@ -1,3 +1,251 @@ +# #!/usr/bin/env python3 +# """ +# Run both frontend and backend locally for development. +# This script starts the NextJS frontend and FastAPI backend in parallel. +# """ + +# import os +# import sys +# import subprocess +# import signal +# import time +# from pathlib import Path + +# # Track subprocesses for cleanup +# processes = [] + +# def cleanup(signum=None, frame=None): +# """Clean up all subprocess on exit""" +# print("\nšŸ›‘ Shutting down services...") +# for proc in processes: +# try: +# proc.terminate() +# proc.wait(timeout=5) +# except: +# proc.kill() +# sys.exit(0) + +# # Register cleanup handlers +# signal.signal(signal.SIGINT, cleanup) +# signal.signal(signal.SIGTERM, cleanup) + +# def check_requirements(): +# """Check if required tools are installed""" +# checks = [] + +# # Check Node.js +# try: +# result = subprocess.run(["node", "--version"], capture_output=True, text=True) +# node_version = result.stdout.strip() +# checks.append(f"āœ… Node.js: {node_version}") +# except FileNotFoundError: +# checks.append("āŒ Node.js not found - please install Node.js") + +# # Check npm +# try: +# result = subprocess.run(["npm", "--version"], capture_output=True, text=True) +# npm_version = result.stdout.strip() +# checks.append(f"āœ… npm: {npm_version}") +# except FileNotFoundError: +# checks.append("āŒ npm not found - please install npm") + +# # Check uv (which manages Python for us) +# try: +# result = subprocess.run(["uv", "--version"], capture_output=True, text=True) +# uv_version = result.stdout.strip() +# checks.append(f"āœ… uv: {uv_version}") +# except FileNotFoundError: +# checks.append("āŒ uv not found - please install uv") + +# print("\nšŸ“‹ Prerequisites Check:") +# for check in checks: +# print(f" {check}") + +# # Exit if any critical tools are missing +# if any("āŒ" in check for check in checks): +# print("\nāš ļø Please install missing dependencies and try again.") +# sys.exit(1) + +# def check_env_files(): +# """Check if environment files exist""" +# project_root = Path(__file__).parent.parent + +# root_env = project_root / ".env" +# frontend_env = project_root / "frontend" / ".env.local" + +# missing = [] + +# if not root_env.exists(): +# missing.append(".env (root project file)") +# if not frontend_env.exists(): +# missing.append("frontend/.env.local") + +# if missing: +# print("\nāš ļø Missing environment files:") +# for file in missing: +# print(f" - {file}") +# print("\nPlease create these files with the required configuration.") +# print("The root .env should have all backend variables from Parts 1-7.") +# print("The frontend/.env.local should have Clerk keys.") +# sys.exit(1) + +# print("āœ… Environment files found") + +# def start_backend(): +# """Start the FastAPI backend""" +# backend_dir = Path(__file__).parent.parent / "backend" / "api" + +# print("\nšŸš€ Starting FastAPI backend...") + +# # Check if dependencies are installed +# if not (backend_dir / ".venv").exists() and not (backend_dir / "uv.lock").exists(): +# print(" Installing backend dependencies...") +# subprocess.run(["uv", "sync"], cwd=backend_dir, check=True) + +# # Start the backend +# proc = subprocess.Popen( +# ["uv", "run", "main.py"], +# cwd=backend_dir, +# stdout=subprocess.PIPE, +# stderr=subprocess.PIPE, +# text=True, +# bufsize=1 +# ) +# processes.append(proc) + +# # Wait for backend to start +# print(" Waiting for backend to start...") +# for _ in range(30): # 30 second timeout +# try: +# import httpx +# response = httpx.get("http://localhost:8000/health") +# if response.status_code == 200: +# print(" āœ… Backend running at http://localhost:8000") +# print(" API docs: http://localhost:8000/docs") +# return proc +# except: +# time.sleep(1) + +# print(" āŒ Backend failed to start") +# cleanup() + +# def start_frontend(): +# """Start the NextJS frontend""" +# frontend_dir = Path(__file__).parent.parent / "frontend" + +# print("\nšŸš€ Starting NextJS frontend...") + +# # Check if dependencies are installed +# if not (frontend_dir / "node_modules").exists(): +# print(" Installing frontend dependencies...") +# subprocess.run(["npm", "install"], cwd=frontend_dir, check=True) + +# # Start the frontend +# proc = subprocess.Popen( +# ["npm", "run", "dev"], +# cwd=frontend_dir, +# stdout=subprocess.PIPE, +# stderr=subprocess.STDOUT, # Combine stderr with stdout +# text=True, +# bufsize=1 +# ) +# processes.append(proc) + +# # Wait for frontend to start +# print(" Waiting for frontend to start...") +# import httpx +# import select + +# started = False +# for i in range(30): # 30 second timeout +# # Check for any output from the process using non-blocking read +# if proc.stdout: +# ready, _, _ = select.select([proc.stdout], [], [], 0) +# if ready: +# line = proc.stdout.readline() +# if line: +# print(f" Frontend: {line.strip()}") +# # NextJS dev server prints "Ready" when it's ready +# if "ready" in line.lower() or "compiled" in line.lower() or "started server" in line.lower(): +# started = True + +# # Also try to connect +# if started or i > 5: # Start checking after 5 seconds or when we see "ready" +# try: +# response = httpx.get("http://localhost:3000", timeout=1) +# print(" āœ… Frontend running at http://localhost:3000") +# return proc +# except httpx.ConnectError: +# pass # Server not ready yet +# except: +# # Any other response means server is up +# print(" āœ… Frontend running at http://localhost:3000") +# return proc + +# time.sleep(1) + +# print(" āŒ Frontend failed to start") +# cleanup() + +# def monitor_processes(): +# """Monitor running processes and show their output""" +# print("\n" + "="*60) +# print("šŸŽÆ Alex Financial Advisor - Local Development") +# print("="*60) +# print("\nšŸ“ Services:") +# print(" Frontend: http://localhost:3000") +# print(" Backend: http://localhost:8000") +# print(" API Docs: http://localhost:8000/docs") +# print("\nšŸ“ Logs will appear below. Press Ctrl+C to stop.\n") +# print("="*60 + "\n") + +# # Monitor processes +# while True: +# for proc in processes: +# # Check if process is still running +# if proc.poll() is not None: +# print(f"\nāš ļø A process has stopped unexpectedly!") +# cleanup() + +# # Read any available output +# try: +# line = proc.stdout.readline() +# if line: +# print(f"[LOG] {line.strip()}") +# except: +# pass + +# time.sleep(0.1) + +# def main(): +# """Main entry point""" +# print("\nšŸ”§ Alex Financial Advisor - Local Development Setup") +# print("="*50) + +# # Check prerequisites +# check_requirements() +# check_env_files() + +# # Install httpx if needed +# try: +# import httpx +# except ImportError: +# print("\nšŸ“¦ Installing httpx for health checks...") +# subprocess.run(["uv", "add", "httpx"], check=True) + +# # Start services +# backend_proc = start_backend() +# frontend_proc = start_frontend() + +# # Monitor processes +# try: +# monitor_processes() +# except KeyboardInterrupt: +# cleanup() + +# if __name__ == "__main__": +# main() + #!/usr/bin/env python3 """ Run both frontend and backend locally for development. @@ -21,8 +269,11 @@ def cleanup(signum=None, frame=None): try: proc.terminate() proc.wait(timeout=5) - except: - proc.kill() + except Exception: + try: + proc.kill() + except Exception: + pass sys.exit(0) # Register cleanup handlers @@ -35,33 +286,33 @@ def check_requirements(): # Check Node.js try: - result = subprocess.run(["node", "--version"], capture_output=True, text=True) + result = subprocess.run(["node", "--version"], capture_output=True, text=True, check=True) node_version = result.stdout.strip() checks.append(f"āœ… Node.js: {node_version}") - except FileNotFoundError: + except Exception: checks.append("āŒ Node.js not found - please install Node.js") - # Check npm + # Check npm (Windows-safe) try: - result = subprocess.run(["npm", "--version"], capture_output=True, text=True) + npm_cmd = ["npm.cmd", "--version"] if os.name == "nt" else ["npm", "--version"] + result = subprocess.run(npm_cmd, capture_output=True, text=True, check=True) npm_version = result.stdout.strip() checks.append(f"āœ… npm: {npm_version}") - except FileNotFoundError: + except Exception: checks.append("āŒ npm not found - please install npm") - # Check uv (which manages Python for us) + # Check uv try: - result = subprocess.run(["uv", "--version"], capture_output=True, text=True) + result = subprocess.run(["uv", "--version"], capture_output=True, text=True, check=True) uv_version = result.stdout.strip() checks.append(f"āœ… uv: {uv_version}") - except FileNotFoundError: + except Exception: checks.append("āŒ uv not found - please install uv") print("\nšŸ“‹ Prerequisites Check:") for check in checks: print(f" {check}") - # Exit if any critical tools are missing if any("āŒ" in check for check in checks): print("\nāš ļø Please install missing dependencies and try again.") sys.exit(1) @@ -85,8 +336,6 @@ def check_env_files(): for file in missing: print(f" - {file}") print("\nPlease create these files with the required configuration.") - print("The root .env should have all backend variables from Parts 1-7.") - print("The frontend/.env.local should have Clerk keys.") sys.exit(1) print("āœ… Environment files found") @@ -97,12 +346,10 @@ def start_backend(): print("\nšŸš€ Starting FastAPI backend...") - # Check if dependencies are installed if not (backend_dir / ".venv").exists() and not (backend_dir / "uv.lock").exists(): print(" Installing backend dependencies...") subprocess.run(["uv", "sync"], cwd=backend_dir, check=True) - # Start the backend proc = subprocess.Popen( ["uv", "run", "main.py"], cwd=backend_dir, @@ -113,9 +360,8 @@ def start_backend(): ) processes.append(proc) - # Wait for backend to start print(" Waiting for backend to start...") - for _ in range(30): # 30 second timeout + for _ in range(30): try: import httpx response = httpx.get("http://localhost:8000/health") @@ -123,7 +369,7 @@ def start_backend(): print(" āœ… Backend running at http://localhost:8000") print(" API docs: http://localhost:8000/docs") return proc - except: + except Exception: time.sleep(1) print(" āŒ Backend failed to start") @@ -135,53 +381,32 @@ def start_frontend(): print("\nšŸš€ Starting NextJS frontend...") - # Check if dependencies are installed + npm_base = "npm.cmd" if os.name == "nt" else "npm" + if not (frontend_dir / "node_modules").exists(): print(" Installing frontend dependencies...") - subprocess.run(["npm", "install"], cwd=frontend_dir, check=True) + subprocess.run([npm_base, "install"], cwd=frontend_dir, check=True) - # Start the frontend proc = subprocess.Popen( - ["npm", "run", "dev"], + [npm_base, "run", "dev"], cwd=frontend_dir, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, # Combine stderr with stdout + stderr=subprocess.STDOUT, text=True, bufsize=1 ) processes.append(proc) - # Wait for frontend to start print(" Waiting for frontend to start...") import httpx - import select - - started = False - for i in range(30): # 30 second timeout - # Check for any output from the process using non-blocking read - if proc.stdout: - ready, _, _ = select.select([proc.stdout], [], [], 0) - if ready: - line = proc.stdout.readline() - if line: - print(f" Frontend: {line.strip()}") - # NextJS dev server prints "Ready" when it's ready - if "ready" in line.lower() or "compiled" in line.lower() or "started server" in line.lower(): - started = True - - # Also try to connect - if started or i > 5: # Start checking after 5 seconds or when we see "ready" - try: - response = httpx.get("http://localhost:3000", timeout=1) - print(" āœ… Frontend running at http://localhost:3000") - return proc - except httpx.ConnectError: - pass # Server not ready yet - except: - # Any other response means server is up - print(" āœ… Frontend running at http://localhost:3000") - return proc + for _ in range(60): # up to 60 seconds + try: + response = httpx.get("http://localhost:3000", timeout=1) + print(" āœ… Frontend running at http://localhost:3000") + return proc + except Exception: + pass time.sleep(1) print(" āŒ Frontend failed to start") @@ -199,49 +424,43 @@ def monitor_processes(): print("\nšŸ“ Logs will appear below. Press Ctrl+C to stop.\n") print("="*60 + "\n") - # Monitor processes while True: for proc in processes: - # Check if process is still running if proc.poll() is not None: - print(f"\nāš ļø A process has stopped unexpectedly!") - cleanup() + print(f"\nā„¹ļø A process exited (pid={proc.pid}). Continuing...") + processes.remove(proc) + continue + - # Read any available output try: line = proc.stdout.readline() if line: print(f"[LOG] {line.strip()}") - except: + except Exception: pass time.sleep(0.1) def main(): - """Main entry point""" print("\nšŸ”§ Alex Financial Advisor - Local Development Setup") print("="*50) - # Check prerequisites check_requirements() check_env_files() - # Install httpx if needed try: import httpx except ImportError: print("\nšŸ“¦ Installing httpx for health checks...") subprocess.run(["uv", "add", "httpx"], check=True) - # Start services - backend_proc = start_backend() - frontend_proc = start_frontend() + start_backend() + start_frontend() - # Monitor processes try: monitor_processes() except KeyboardInterrupt: cleanup() if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/terraform/2_sagemaker/.terraform.lock.hcl b/terraform/2_sagemaker/.terraform.lock.hcl index ac9a7691..9fff0e2c 100644 --- a/terraform/2_sagemaker/.terraform.lock.hcl +++ b/terraform/2_sagemaker/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.70" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", @@ -27,6 +28,7 @@ provider "registry.terraform.io/hashicorp/aws" { provider "registry.terraform.io/hashicorp/time" { version = "0.13.1" hashes = [ + "h1:5l8PAnxPdoUPqNPuv1dAr3efcCCtSCnY+Vj2nSGkQmw=", "h1:ZT5ppCNIModqk3iOkVt5my8b8yBHmDpl663JtXAIRqM=", "zh:02cb9aab1002f0f2a94a4f85acec8893297dc75915f7404c165983f720a54b74", "zh:04429b2b31a492d19e5ecf999b116d396dac0b24bba0d0fb19ecaefe193fdb8f", diff --git a/terraform/3_ingestion/.terraform.lock.hcl b/terraform/3_ingestion/.terraform.lock.hcl index cdc1668d..9f8c6099 100644 --- a/terraform/3_ingestion/.terraform.lock.hcl +++ b/terraform/3_ingestion/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", diff --git a/terraform/3_ingestion/main.tf b/terraform/3_ingestion/main.tf index b281c460..021926d9 100644 --- a/terraform/3_ingestion/main.tf +++ b/terraform/3_ingestion/main.tf @@ -1,3 +1,4 @@ +data "aws_caller_identity" "current" {} terraform { required_version = ">= 1.5" @@ -17,7 +18,7 @@ provider "aws" { } # Data source for current caller identity -data "aws_caller_identity" "current" {} +#data "aws_caller_identity" "current" {} # ======================================== # S3 Vectors Bucket diff --git a/terraform/4_researcher/.terraform.lock.hcl b/terraform/4_researcher/.terraform.lock.hcl index cdc1668d..9f8c6099 100644 --- a/terraform/4_researcher/.terraform.lock.hcl +++ b/terraform/4_researcher/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", diff --git a/terraform/5_database/.terraform.lock.hcl b/terraform/5_database/.terraform.lock.hcl index 64d2d1de..5b96e898 100644 --- a/terraform/5_database/.terraform.lock.hcl +++ b/terraform/5_database/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", @@ -28,6 +29,7 @@ provider "registry.terraform.io/hashicorp/random" { version = "3.7.2" constraints = "~> 3.5" hashes = [ + "h1:0hcNr59VEJbhZYwuDE/ysmyTS0evkfcLarlni+zATPM=", "h1:KG4NuIBl1mRWU0KD/BGfCi1YN/j3F7H4YgeeM7iSdNs=", "zh:14829603a32e4bc4d05062f059e545a91e27ff033756b48afbae6b3c835f508f", "zh:1527fb07d9fea400d70e9e6eb4a2b918d5060d604749b6f1c361518e7da546dc", diff --git a/terraform/6_agents/.terraform.lock.hcl b/terraform/6_agents/.terraform.lock.hcl index cdc1668d..9f8c6099 100644 --- a/terraform/6_agents/.terraform.lock.hcl +++ b/terraform/6_agents/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", diff --git a/terraform/6_agents/main.tf b/terraform/6_agents/main.tf index af7f4a37..acf9e6aa 100644 --- a/terraform/6_agents/main.tf +++ b/terraform/6_agents/main.tf @@ -76,6 +76,29 @@ resource "aws_iam_role" "lambda_agents_role" { Part = "6" } } +resource "aws_iam_role_policy" "lambda_agents_bedrock_policy" { + name = "alex-lambda-agents-bedrock-policy" + role = aws_iam_role.lambda_agents_role.name + + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Action = [ + "bedrock:InvokeModel", + "bedrock:InvokeModelWithResponseStream", + "bedrock:DescribeModel", + "bedrock:ListModels" + ] + Resource = [ + "arn:aws:bedrock:*::foundation-model/*", + "arn:aws:bedrock:*:*:inference-profile/*" + ] + } + ] + }) +} # IAM policy for Lambda agents resource "aws_iam_role_policy" "lambda_agents_policy" { diff --git a/terraform/7_frontend/.terraform.lock.hcl b/terraform/7_frontend/.terraform.lock.hcl index cdc1668d..9f8c6099 100644 --- a/terraform/7_frontend/.terraform.lock.hcl +++ b/terraform/7_frontend/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2", diff --git a/terraform/8_enterprise/.terraform.lock.hcl b/terraform/8_enterprise/.terraform.lock.hcl index cdc1668d..9f8c6099 100644 --- a/terraform/8_enterprise/.terraform.lock.hcl +++ b/terraform/8_enterprise/.terraform.lock.hcl @@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" { version = "5.100.0" constraints = "~> 5.0" hashes = [ + "h1:H3mU/7URhP0uCRGK8jeQRKxx2XFzEqLiOq/L2Bbiaxs=", "h1:Ijt7pOlB7Tr7maGQIqtsLFbl7pSMIj06TVdkoSBcYOw=", "zh:054b8dd49f0549c9a7cc27d159e45327b7b65cf404da5e5a20da154b90b8a644", "zh:0b97bf8d5e03d15d83cc40b0530a1f84b459354939ba6f135a0086c20ebbe6b2",