didalgolab / chatgpt-intellij-plugin

Yet another JetBrains extension that enables you to use ChatGPT within your favorite IDE.
Apache License 2.0
25 stars 13 forks source link

Open AI Logout #17

Open leasemate opened 6 months ago

leasemate commented 6 months ago

OpenAI does not stay logged in when closing Pycharm and reopening, is there a way to stay logged in?

pgebert commented 2 months ago

Same problem in Intellij - have to paste the api access token each time I reopen Intellij to use this plugin.

didalgolab commented 2 months ago

@pgebert do you mean it happens even when you use the plugin with api connection? Please attach full idea.log

pgebert commented 2 months ago

Description

When I reopen Intellij, the full Azure Open AI settings of the plugin are visible (api endpoint, deployment name and even the partly masked api key). But inserting a message in the chat, it prompts me to insert the api key again. After inserting the unchanged api key it works again until I reopen Intellij,

Logs

In the logs I get the following exception on startup:

2024-06-28 16:58:01,355 [   8395]   WARN - #c.i.i.s.i.StartupManagerImpl - Migrate com.didalgo.intellij.chatgpt.StartupHandler to ProjectActivity [Plugin: com.didalgo.chatgpt]
com.intellij.diagnostic.PluginException: Migrate com.didalgo.intellij.chatgpt.StartupHandler to ProjectActivity [Plugin: com.didalgo.chatgpt]
    at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.kt:276)
    at com.intellij.ide.startup.impl.StartupManagerImpl.access$runPostStartupActivities(StartupManagerImpl.kt:68)
    at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3$2.invokeSuspend(StartupManagerImpl.kt:191)
    at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3$2.invoke(StartupManagerImpl.kt)
    at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3$2.invoke(StartupManagerImpl.kt)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
    at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$3.invokeSuspend(StartupManagerImpl.kt:190)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:270)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Full log file: idea.log

Version

Hope this helps

didalgolab commented 2 months ago

@pgebert Thank you. It would be helpful if the log itself contained the error about the missing API Key. Can you do the following:

pgebert commented 2 months ago

Sure - this is the resulting log file: idea.log

didalgolab commented 2 months ago

@pgebert I'm unable to find helpful information in the logs, so I can only offer a guess. My suspicion is that the kdbx database might have got corrupted. If the issue is indeed a corrupted kdbx database, you can try the following: Locate the "c.kdbx" file in the folder C:\Users\{USER}\AppData\Roaming\JetBrains\IntelliJIdea2024.1\. With IDEA closed, rename this file but keep it for possible restoration. Start your IDE, re-enter the API keys, and verify if they are saved correctly upon the next IDE restart.

pgebert commented 2 months ago

Thanks - your tip helped me to resolve the issue: activating KeePass in the Intellij settings fixed it. 🙏

didalgolab commented 2 months ago

@pgebert Thanks for the information. I'm glad that it works for you. I'm a bit surprised that KeePass needs extra activation in IntelliJ. I guess I need to consider how to address this aspect in the plugin.