ChatGPT is “only” a chat interface to GPT.
GPT basically has access to two contexts: its internals, and the prompt that it gets
Then when you ask something to ChatGPT, it takes your prompt and it generates a new prompt that includes the previous messages in your session, so that GPT can use them as context.
But, there’s a limit to the size of the prompt. And it’s not that big.
So then ChatGPT’s magic is figuring out how to crafts prompts, within the size limits, to feed GPT, so that it has enough context to give a good answer.
Essentially, ChatGPT is some really amazing prompt-engineering system with a great interface.