DeepSeek vs ChatGPT: Coding Showdown
51sThe direct comparison between two popular AI tools sparks curiosity and debate among developers.
▶ Play ClipThis video compares the coding assistance provided by ChatGPT and DeepSeek AI. The creator presents a piece of buggy code to both AIs and analyzes their responses, focusing on error handling and JWT token management.
The video compares ChatGPT and DeepSeek AI for coding assistance.
A buggy API endpoint calling function is presented to both AIs.
The same prompt and code are given to both ChatGPT and DeepSeek.
DeepSeek requires login, unlike ChatGPT which can be used in incognito mode.
DeepSeek provides a detailed, step-by-step analysis of the code.
ChatGPT suggests modifying error handling logic and adding a try-catch block.
DeepSeek identifies the exact problem: the else block removes JWT tokens on any error.
DeepSeek correctly points out that JWT tokens should only be removed for authentication errors (401 or 403).
DeepSeek's solution is to only remove JWT tokens on 401 or 403 errors, not other types.
DeepSeek's modified code uses a simple if condition instead of a nested try-catch block.
The creator prefers DeepSeek's solution as it is cleaner and more direct.
"The title accurately reflects the video's content: a direct comparison of coding help from ChatGPT and DeepSeek."
What is the main problem identified in the code?
The else block removes JWT tokens on any error, not just authentication errors.
3:08
What is the correct condition for removing JWT tokens?
Only for 401 (Unauthorized) or 403 (Forbidden) errors.
4:01
Which AI provided a cleaner solution according to the creator?
DeepSeek AI.
5:04
What does DeepSeek's solution avoid?
Nested try-catch blocks inside the catch block.
4:17
DeepSeek's precise problem identification
DeepSeek correctly identifies the exact issue in the code, unlike ChatGPT which gives a more general suggestion.
3:08Solution: only remove JWT on auth errors
This is a key principle for secure error handling in API calls.
4:01Preference for DeepSeek's solution
The creator prefers DeepSeek's solution for its clarity and directness.
5:04[00:00] everybody is talking about deep seek AI
[00:02] compared to chat GPT so I thought to
[00:04] give it a try as well I have a piece of
[00:06] code here this code is basically one of
[00:09] the function for our one of the project
[00:12] in our course and this is a API end
[00:15] point calling function that is basically
[00:18] used by entire API calling method within
[00:21] the application so this is a functional
[00:24] code but it is not fully completed and
[00:27] it has some BG to fix and I have written
[00:30] some prompt here for ai2 analyze it and
[00:33] give me some feedback or provide me the
[00:35] solution and I want to give this exact
[00:37] same instruction and the code to the
[00:41] both charity and then dips and then see
[00:43] how it works so I have a Char open here
[00:45] in Incognito and I tried to open the
[00:47] dips into the Cognito but it won't allow
[00:51] so this is a really smart way to kind of
[00:53] saving the server cost I hope they are
[00:54] not doing that but yeah going back to I
[00:57] have to log in so I log in here so I
[01:00] haven't done any really much use of
[01:02] deeps so what I like to do is let's copy
[01:05] this out entire code and then I'm going
[01:07] to go to a platform here and then I'm
[01:09] going to pass that to GPD first hit
[01:12] enter or submit it and then give to the
[01:14] dsck as well and let's see what happens
[01:18] all right still processing it
[01:21] and let's analyze it which one doing the
[01:26] good job here this see is bit slow so oh
[01:30] looks like he's writing very detailed
[01:32] information so while it's just doing its
[01:34] job let's go and look into GPT and then
[01:36] see what it says so here are few Su
[01:39] modify the error handling logic here in
[01:41] the logic check for the user should be
[01:43] logged out should only be trigger for
[01:46] the authentication error like 44 should
[01:49] be based on the S and condition I.E non
[01:52] expir okay yeah so additionally better
[01:55] code handling is implementing status
[01:58] code 400 verify that it is actually
[02:00] correct XO doesn't have the status
[02:02] property directly blah blah blah and
[02:05] doesn't really give you detail there so
[02:08] scrolling down here I want to see so
[02:13] basically it has written another TR
[02:17] catch
[02:18] block inside my catch block and which I
[02:21] already don't like it and um nesting
[02:25] more cord here I don't really enjoy this
[02:28] approach and also of course uh doing
[02:30] other few check okay guys if you are
[02:33] quer you know what's going on here I got
[02:35] enough information what he's trying to
[02:37] give me and which is I'm not really
[02:39] happy here now I'm going to go back to
[02:42] this deep sick and then very first time
[02:45] I'm literally using this for cord
[02:47] analysis let's see what it has to say
[02:50] okay this is exactly the issue it has
[02:52] given very like to the point problem
[02:56] which I did not really see here did we
[02:59] see that so I do not see GPT giving me
[03:02] the exact location or the exact message
[03:06] where the issue is like here it has
[03:08] saying the behavior likely to doe to the
[03:11] else Block in the cat section of your
[03:14] API processor the function which removes
[03:16] the JWT token from the storage whenever
[03:19] an error occurs regardless of the error
[03:22] type yeah that is the actual problem
[03:24] here so if you look into this Cod
[03:27] whenever we have the server site 400
[03:30] error and then only that comes up with
[03:32] the just JWT expired then we are
[03:35] basically rerunning the code after
[03:36] fetching the new token other than that
[03:39] we are just deleting the token that was
[03:41] the problem so that was smart now
[03:44] looking into the error handle link okay
[03:46] here the code now only removes the JWT
[03:49] token and logs out user uh if the error
[03:52] is 44 on authorize 043 error basically
[03:56] it locks out every anything okay it has
[03:58] given to the point Point solution here
[04:01] you should only remove the JWT tokens
[04:03] and log the user out when the error is
[04:06] specifically related to the
[04:08] authentication that's correct but 401
[04:10] authorized or 43 forbidden and not for
[04:13] other type of yeah that's the solution
[04:15] kind of we are looking for but here is
[04:17] the modified code I'm going to go
[04:21] straight away and then look into the
[04:23] catch section at least it's not putting
[04:25] another try catch here inside the catch
[04:27] which I'm okay it looks for the message
[04:29] okay it's just checking if condition so
[04:31] it's going to run this cord only when
[04:34] that condition pass if the cord goes
[04:36] inside here it will stop here so it this
[04:39] will not run so if that doesn't pass
[04:41] through then it's going to check 401
[04:44] error response status s is
[04:46] 43 then you can delete this I think yeah
[04:52] honestly the solution comparing to I'm
[04:55] going to go back to chat JP quickly one
[04:56] more time to see the solution it's do
[04:59] pretty much similar thing but this is
[05:01] way messy Cod I would say honestly I do
[05:04] like the way the Deep SE has given the
[05:07] solution here comparatively the chat GPT
[05:12] solution okay that's my opinion over
[05:15] these two different tools guys what do
[05:17] you think let me know in the comment
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.