Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves chat panel initialization error #660

Merged
merged 4 commits into from
Mar 8, 2024
Merged

Resolves chat panel initialization error #660

merged 4 commits into from
Mar 8, 2024

Conversation

abbott
Copy link
Contributor

@abbott abbott commented Feb 28, 2024

Removes get_value({}) inline of dictionary get method, unblocking chat panel initialization error:

“There seems to be a problem with the Chat backend, please look at the JupyterLab server logs or contact your administrator to correct this problem.”

Tested against v2.10.0 in Jupyter Lab v4.1.2

Fixes #335

Copy link

welcome bot commented Feb 28, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@dlqqq dlqqq added the bug Something isn't working label Mar 5, 2024
Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you opening this PR! Once released, this will be super helpful to other users experiencing the same bug.

This PR is not yet complete however. The root issue is that the value of self.config.serverapp.jpserver_extensions has a different type that depends on the environment for some reason. In some environments (like yours) it is an instance of dict, but in others (like the CI pipeline) it is an instance of LazyConfigValue. See these CI logs:

Screenshot 2024-03-05 at 10 17 32 AM

What's more bizarre is that the value of this LazyConfigValue seems to differ depending on how it is accessed. Here are the logging statements I added to get_chat_user():

self.log.warning(self.config)
self.log.warning(self.config.ServerApp)
self.log.warning(self.config.ServerApp.jp_server_extensions)
self.log.warning(self.config.ServerApp.jp_server_extensions.get_value({}))

And here are the logs they yield:

[W 2024-03-05 10:30:38.298 ServerApp] {'NotebookApp': {}, 'ServerApp': {'jpserver_extensions': <LazyConfigValue value={'jupyterlab': True, 'jupyter_ai': True, 'jupyter_lsp': True, 'jupyter_server_terminals': True, 'notebook_shim': True}>, 'default_url': '/lab', 'open_browser': True, 'file_url_prefix': '/lab/tree', 'jp_server_extensions': <LazyConfigValue value={}>}}
[W 2024-03-05 10:30:38.298 ServerApp] {'jpserver_extensions': <LazyConfigValue value={'jupyterlab': True, 'jupyter_ai': True, 'jupyter_lsp': True, 'jupyter_server_terminals': True, 'notebook_shim': True}>, 'default_url': '/lab', 'open_browser': True, 'file_url_prefix': '/lab/tree', 'jp_server_extensions': <LazyConfigValue value={}>}
[W 2024-03-05 10:30:38.298 ServerApp] <LazyConfigValue value={}>
[W 2024-03-05 10:30:38.299 ServerApp] {}

Notice how line 2 implies a non-empty dict, but lines 3 and 4 imply an empty dict. 🤔

I'm going to pull in @Zsailer to see if he can offer some guidance on the best way of determining if jupyter_collaboration is installed & enabled. There may be a better way that doesn't require accessing self.config.ServerApp.jp_server_extensions directly, since that may be an internal jupyter_server API.

Zach and I will get back to you on this, and I will open a PR against your PR. 👍

@dlqqq dlqqq added this to the v2.12.0 milestone Mar 6, 2024
Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, thank you both! @abbott @Zsailer

@dlqqq dlqqq merged commit 60e9161 into jupyterlab:main Mar 8, 2024
8 checks passed
Copy link

welcome bot commented Mar 8, 2024

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

@dlqqq
Copy link
Member

dlqqq commented Mar 8, 2024

@meeseeksdev please backport to 1.x

Copy link

lumberbot-app bot commented Mar 8, 2024

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 1.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 60e9161e55304e51e7fa1d08a227bde594d13115
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #660: Resolves chat panel initialization error'
  1. Push to a named branch:
git push YOURFORK 1.x:auto-backport-of-pr-660-on-1.x
  1. Create a PR against branch 1.x, I would have named this PR:

"Backport PR #660 on branch 1.x (Resolves chat panel initialization error)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@dlqqq
Copy link
Member

dlqqq commented Mar 8, 2024

Disregard the above, that was done out of muscle memory, and this PR should not be backported.

@abbott abbott deleted the issue-335-chat-backend branch March 10, 2024 14:06
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* Removed invalid ` get_value ` method for dictionary call

* replaced jpserver_extensions with extension_manager API

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Removed invalid ` get_value ` method for dictionary call

* replaced jpserver_extensions with extension_manager API

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Still Needs Manual Backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problem with the Chat backend
3 participants