Cr4yfish

joined 2 years ago
MODERATOR OF
[–] Cr4yfish 5 points 3 months ago

oh, right. Forget that every time. I'll add one.

[–] Cr4yfish 8 points 3 months ago

I use Gemini, which supports PDF File uploads, combined with structured outputs to generate Course Sections, Levels & Question JSON.

When you upload a PDF, it first gets uploaded to a S3 Database directly from the Browser, which then sends the Filename and other data to the Server. The Server then downloads that Document from the S3 and sends it to Gemini, which then streams JSON back to the Browser. After that, the PDF is permanently deleted from the S3.

Data Privacy wise, I wouldn't upload anything sensitive since idk what Google does with PDFs uploaded to Gemini.

The Prompts are in English, so the output language is English as well. However, I actually only tested it with German Lecture PDFs myself.

So, yes, it probably works with any language that Gemini supports.

Here is the Source Code for the core function for this feature:

export async function createLevelFromDocument(
    { docName, apiKey, numLevels, courseSectionTitle, courseSectionDescription }: 
    { docName: string, apiKey: string, numLevels: number, courseSectionTitle: string, courseSectionDescription: string }) 
    {
    
    const hasCourseSection = courseSectionTitle.length > 0 && courseSectionDescription.length > 0;

    // Step 1: Download the PDF and get a buffer from it
    const blob = await downloadObject({ filename: docName, path: "/", bucketName: "documents" });
    const arrayBuffer = await blob.arrayBuffer();
    
    // Step 2: call the model and pass the PDF
    //const openai = createOpenAI({ apiKey: apiKey });
    const gooogle = createGoogleGenerativeAI({ apiKey: apiKey });

    const courseSectionsPrompt = createLevelPrompt({ hasCourseSection, title: courseSectionTitle, description: courseSectionDescription });
    
    const isPDF = docName.endsWith(".pdf");

    const content: UserContent = [];

    if(isPDF) {
        content.push(pdfUserMessage(numLevels, courseSectionsPrompt) as any);
        content.push(pdfAttatchment(arrayBuffer) as any);
    } else {
        const html = await blob.text();
        content.push(htmlUserMessage(numLevels, courseSectionsPrompt, html) as any);
    }

    const result = await streamObject({ 
        model: gooogle("gemini-1.5-flash"),
        schema: multipleLevelSchema,
        messages: [
            {
                role: "user",
                content: content
            }
        ]
    })
    

    return result;
}
[–] Cr4yfish 3 points 3 months ago

Understandable. I added a proper offline mode back to the Roadmap on github.

[–] Cr4yfish 8 points 3 months ago

I added it back to the roadmap :).

[–] Cr4yfish 10 points 3 months ago (5 children)

Thanks :). Yeah, it's publicly accessible: nouv.app/. I use it daily already but it still has tons of bugs.

[–] Cr4yfish 6 points 3 months ago (4 children)

The UI mostly works offline once loaded in due to aggressive caching. Downloading Course Content was on the initial Roadmap but I removed it since I wasn't sure if anyone would like the feature.

Syncing stuff is a real pain in the ass but I'll implement it if at least a couple people want it.

[–] Cr4yfish 33 points 3 months ago* (last edited 3 months ago)

Thanks for the suggestion, I’ll definitely try to make the app as language inclusive as possible!

Also, sorry if I might’ve been too vague with the post title. The app is just similar to Duolingo in terms of structure and the idea, however it’s not specific to language learning but supposed to cater to any subject, really.

For example, I personally use it to study for my university subjects.

[–] Cr4yfish 8 points 1 year ago (1 children)

You can actually fast travel directly to cities, even when you're in a different system.

[–] Cr4yfish 8 points 1 year ago

Out of interest, which places in Europe?

[–] Cr4yfish 2 points 1 year ago (1 children)

Yeah you can land anywhere on earth but there isn't much going on, just a big desert.

Details are in the game story.

[–] Cr4yfish 1 points 1 year ago

I just wish there was an option to lower the resolution. I've got a 2080 and also got 30fps, because 4k.

[–] Cr4yfish 2 points 1 year ago

Nemmy ist actually hosted on vercel :D. The traffic blew the Analytics limits of my account.

 

* that are listed on the awesome Lemmy list

 

Hello everyone!

As always, all changes are on nemmy.app.

What changed

Better Markdown Support

Nemmy now supports a ton of different markdown options. Here is a Post on Nemmy showcasing the different options.

Better caching & comment caching

Most issues with the SPA post loading mod should be fixed now. Posts now open in a new tab, again, and comments are now cached as well.

Using these new techniques posts and their comments should now load in an instant. But this cache is only used for the last post visited. I did this because I don't want the cache to explode in size.

Improved Design principles

I upgrade the design specs of Nemmy and cards will now look better going forward.

Instance Info Sidebar

The instance info button in the sidebar doesn't make best use of desktop resources. So now, on wide screens, there will be a sidebar next to the posts.

Improved Explore Section

I further improved the design, although it's still not optimal for desktop.

Inbox v2

The inbox page has been improved, now showing the users comment which someone replied to. Users can now also open the comment chain showing only the context.

Comment should load better now

My fight with the damn comment trees goes on.

Work continues on the Bookmarks page

I now removed the extra page and moved the bookmarks to the user profile - like reddit and any other reddit-like app do.

The button is already there but is non-functional as of right now. It only breaks stuff :).

Meta

I've had very little time again over the last couple of days and this trend will continue into next week. So the next update will probably be sometime in the second half of next week.

Well, that's it for this update.

3
Hotfix deployed (self.nemmy)
submitted 2 years ago by Cr4yfish to c/nemmy
 

I fixed the bug where Users with no account could not load any posts.

 

Hello again, welcome to Dev update 17!

All changes are on nemmy.app.

What changed

  • You can now Bookmark Posts and Comments

Although, I didn't code the Bookmark Page yet, so you can't view all your saved posts and comments in one place yet.

  • You can now choose an Account to use when creating Communities

This is the first step of many which will make a seamless experience possible, without worrying about Instances at all!

What singles out Nemmy here out of all other Lemmy Apps is the approach to multi-user handling. On other Apps you would first change your active user account and then create a Community.

On Nemmy it's irrelevant which account is the active one, since the User is seen as an abstract which can have multiple "linked instances".

This is the first feature I implemented that uses this concept, but I will soon introduce this to creating posts/comments/notifications/chats etc. as well.

The active account will only be relevant to voting in the long run.

  • A new number formatter

Most numbers will now be displayed in a more sensible format, like this:

Bugfixes

  • Users can now vote again on posts & comments

That's it for now

But there will be more soon!

6
submitted 2 years ago* (last edited 2 years ago) by Cr4yfish to c/nemmy
 

Welcome to Dev update 16

As always, all changes are already on nemmy.app.

By the way, the screenshots I post in the updates are sometimes dark and sometimes light mode. Of course every page supports both, dark and light mode.

What changed

New Features

  • You can create Communities now! The UX of creating a Community is (intentionally) very similar to creating a Post, that being it breaks down into own pages.

It's not completely done yet. A confirmation page is still missing and while you can choose between all instances that you have an account for on Nemmy, it currently isn't switching automatically, so only the instance linked to your currently active account works.

I will fix both of these problems today or tomorrow.

Also, as you can see in the screenshots below, you cannot currently upload images directly and have to do a workaround by uploading the images to a third party and then just pasting the direct link into the form.

This is because the "official way" is bugged and I was trying to implement a workaround for 6 hours last night until I finally gave up. I'm still not sure on what the problem exactly is, so right now I will just wait for the maintainers of Lemmy to fix some bugs with the backend and then try again.

  • Sorting and Filtering has finally been added everywhere

Improvements

  • The User and Community pages are now server rendered
  • The current account will now be the first in User Sidebar

  • All user links now link to the internal /u/ Link

That's it for today!

See you all next time :)

4
submitted 2 years ago* (last edited 2 years ago) by Cr4yfish to c/nemmy
 

Hey all, I'm back with some news!

All changes, as always, are live on nemmy.app. I recommend checking today's update out yourself since it's mostly animations and load times.

What Changed

  • Posts can now be loaded in two different ways:
  1. SPA (Single Page Application) Mode (new)
  2. MPA (Multi Page Application) Mode (old)

Those terms mean something completely different, I chose them because what Nemmy does in these cases is similar to their ideas

When a User clicks on a Posts they see in their Feed (most use cases), the Post gets loaded in SPA mode. This means every cache and data fetching is bypassed and the Post data gets directly inserted into the Post page. You may notice this with a flashing "?preload=true" extension to the URL when visiting a post. Because of this, the post gets loaded literally instantly - no wait times.

MPA mode is still used for when you then reload the page, or click on a direct link to a post. Then the server tries different caching methods to reduce the load times as much as possible, also using server rendering so the data gets loaded insanely fast to the server and only passed down to the client.

The numbers using 4G/LTE Wifi with low latency

Time to load a Post with SPA Mode:

instantly

Time to load a Post with MPA Mode:

  • If cached: About 0.3 Seconds if cached by the server
  • Otherwise About 1 Second
  • Endless scrolling for comments is finally here!

After yesterdays update, Users would have to constantly click the "load more comments" button - no more of that, the button is gone!

Comments now finally load in an endless stream on demand, when the user scrolls to the bottom.

  • Authentication handling improvements
  • Switching Users now updates most things (e.g. Communities, Profile pictures etc.)
  • Adding a new User account now switches automatically to the new account (it did before as well but didn't show until page reload)
  • A couple more animations have been added to pages

  • Nemmy has a new License

Before, Nemmy used a custom license I made up on the spot because I didn't know any license and didn't want to randomly choose one. Anyway, now Nemmy uses the AGPL License, which is the same License Lemmy itself uses.

  • There have also been some smaller adjustments

Like adding more "EndlessScrollingEnds" how I like to call them

That's it for today

See you all soon!

Edit

So there seem to be a ton of bugs left I overlooked.

Most notable:

  • You can't load posts from anywhere but the feed - I'm already working on a fix for that
  • You can't open posts in new tabs since the post then wants to access state that doesn't exist in that tab
  • Community pages don't show the correct number of subscribers or active users
 

Behind the scenes I've been working on a system that switches instances automatically when one isn't available.

This has happened to me so often while developing, that an instance has gone offline, that I decided to do something about it.

Soon Nemmy will try out another instance if the requested (default or user specified) isn't available - and if that one isn't available as well, Nemmy will switch again - and so on.

The list of valid instances to switch to is hand-picked by me and consists of the instances with the most up-time and with the most federated instances to increase the chances of user requested content being available.

All-in-all, soon the possibility of using Nemmy and experiencing any downtime will be close to 0.

 

Hello again! Dev Update 14 here

As always, all changes are already on nemmy.app.

Wow, so it's been quite a while since the last update and there are a couple reasons for that, e.g. I'm not home atm so I only have a Laptop. I also have very little time in general right now and have a lot to do at work.

Anyways. I did manage to add some features (break others) and improve some UX.

What changed

  • You can now add multiple users to Nemmy (you can't add ones with the same username on different intances for now)

This required a complete overhaul on how authentication works on Nemmy. It's a lot more complicated but also more streamlined now.

  • Mild to Big performance improvements of Images

I switched almost completely to next/image, which optimized image loading by default so especially feeds with lots of images should now be less resource intensive.

  • Inbox, Chat and Settings pages have been added. None of them are done but you can take a look at the progress

  • Users from all Lemmy instances and Mastodon can now be viewed on Nemmy (some are still redirected to their own instance's website)

  • A few pages are now server rendered before being hydrated with user-specific content

This means that soon almost all initial requests will be cached on a few minutes basis (currently 2 minutes). So after the first request, every other within 2 minutes will be almost instantly served.

Right now, this counts for the Homefeed and Post pages. The Inbox, Chat and Settings pages are also Server Rendered, but not as aggressively cached since they are User specific pages anyway.

  • Comments are being rendered in a more sensible way

This means huge performance boot on posts with 200+ Comments. But it also means you'll have to press the "load more comments" button more often.

I know the UX of doing that isn't ideal right now, I'll take care of that later.

  • You can now view Instance info (basic implementation)

  • Instances are now shown in more places

e.g. on posts

Known Bugs

  • Especially when doing anything with authentication, you usually have to refresh the App right now. I'll fix that soon.

That's it for now!

See you all soon

6
submitted 2 years ago* (last edited 2 years ago) by Cr4yfish to c/nemmy
 

Note: This is outdated, read the update down below

I'm currently working on the Settings page, the User's inbox and a chatting page.

Though, the development process has come to an effective halt due to a very weird bug which I've tried to fix for the past couple of days now. The bug crashes my development build due to excessive RAM and CPU usage and I couldn't yet make out the culprit. But I'm working on it.

So yeah, I'm still here... but I need some more time before introducing the next update.

In the mean time, here's a sneak peek at the Notifications Page design:

Update:

I've worked for 3 days on this bug and literally 20mins after finally posting an update I fixed it :/.

Here is the working Inbox prototype:

5
submitted 2 years ago* (last edited 2 years ago) by Cr4yfish to c/nemmy
 

Dev update 13

As always all changes are on Nemmy.app.

So, 2 days I think without updates... what's been going on?

I basically had zero time to do an update but also very little time to actually code, however there has been some changes, so:

What changed

  • I added another branch, testing out a new way of rendering Comments (huge performance boost) and started testing client-side caching in addition to the server-side cache

  • Every post (/post/any id) will now be rendered on the server side, which means it won't "pop-in" after you load the side. This will also be very important with another change I'll make soon, which will enable me to cache these requests to Lemmy. Which in turn means incredible response times.

  • I continued the migration from Lemmy.world as the default instance, to being able to switch that anytime. This means if Lemmy.world is offline again, Nemmy will just switch to another big instance like Lemmy.ml as default. Of course that will change anyway if the user logs in.

  • I also added a temporary fix for the Login problem: Some may have noticed that if you didn't check the "stay signed in" checkbox, you would't get a cookie, the JWT would only be stored in session storage.

Session storage has a major flaw with the current system of how Nemmy works though, because session storage works only in 1 tab, not in any other. So you wouldn't be signed in when opening any post, since they open in another tab for now.

So the workaround for now is to just give every user a cookie, like most other websites would do anyway (the cookie isn't used for tracking, but it can be a security risk of having that without explicit knowledge).

  • I also started coding the whole "save the scroll position" thing, so Nemmy will always remember where you left off and scroll there for you.

  • The "explore" section in the search page has also been properly added, though I plan on changing the algorithm to get trending topics very soon.

  • There's also been some smaller bugfixes

Well, that's it for the updates for now

See you all soon!

 

Welcome to Dev update #12

It's so late at night again :(

What changed

  • I built the backend to support all instances

Every feature will migrate over the next couple of days to the new system, making everything compatible with all instances of Lemmy. Right now, only Login and Signup are supported.

  • Signup feature

You can now sign up to (almost) any Instance via Nemmy! Due to security concerns, I limited the available instances to 871 curated ones, so users still have plenty to choose off!

  • Subscribing to Communities

This is pretty simple. You can now actually click the "subscribe" button on any community you haven't subscribed to already.

  • Minor improvements

The sort and filter dropdowns now show the active setting (if the screen width is wide enough)

That's it for today!

I really need to sleep now.

Edit: If you downvote this you might as well tell me why lmao

view more: ‹ prev next ›