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

fix: chart tool chinese font display and raise error #11058

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

hjlarry
Copy link
Contributor

@hjlarry hjlarry commented Nov 25, 2024

Summary

Tip

Close issue syntax: Fixes #<issue number> or Resolves #<issue number>, see documentation for more details.

fixed 2 errors:

  1. fix The Chinese font is not available in the chart tool #10777
  2. when you run the tool to generate a bar, then change params to generate another bar will raise:
[on_tool_start] ToolCall:bar_chart
{'data': '15000', 'x_axis': '测试汉字'}
C:\Users\hejl\PycharmProjects\dify\api\core\tools\provider\builtin\chart\tools\bar.py:31: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
  flg, ax = plt.subplots(figsize=(10, 8))
C:\Users\hejl\PycharmProjects\dify\api\core\tools\provider\builtin\chart\tools\bar.py:35: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator.
  ax.set_xticklabels(axis, rotation=45, ha="right")
Exception ignored in: <function Image.__del__ at 0x0000018D0AC99080>
Traceback (most recent call last):
  File "C:\Users\hejl\.pyenv\pyenv-win\versions\3.12.0\Lib\tkinter\__init__.py", line 4081, in __del__
    self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
2024-11-24 21:31:55,681.681 INFO [Thread-9 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [25/Nov/2024 13:31:55] "OPTIONS /console/api/apps/d0f351d8-946d-4a62-a074-dc8ac0bf2e11/workflows/draft HTTP/1.1" 200 -
2024-11-24 21:31:55,710.710 INFO [Thread-11 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [25/Nov/2024 13:31:55] "POST /console/api/apps/d0f351d8-946d-4a62-a074-dc8ac0bf2e11/workflows/draft HTTP/1.1" 200 -
Exception ignored in: <function Variable.__del__ at 0x0000018D0AC02AC0>
Traceback (most recent call last):
  File "C:\Users\hejl\.pyenv\pyenv-win\versions\3.12.0\Lib\tkinter\__init__.py", line 410, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000018D0AC02AC0>
Traceback (most recent call last):
  File "C:\Users\hejl\.pyenv\pyenv-win\versions\3.12.0\Lib\tkinter\__init__.py", line 410, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000018D0AC02AC0>
Traceback (most recent call last):
  File "C:\Users\hejl\.pyenv\pyenv-win\versions\3.12.0\Lib\tkinter\__init__.py", line 410, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x0000018D0AC02AC0>
Traceback (most recent call last):
  File "C:\Users\hejl\.pyenv\pyenv-win\versions\3.12.0\Lib\tkinter\__init__.py", line 410, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong thread

Screenshots

Before: After:

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working labels Nov 25, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 25, 2024
@crazywoola crazywoola merged commit 56e361a into langgenius:main Nov 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Chinese font is not available in the chart tool
2 participants