Helpdesk: Knowledge base suggestion issue

I am currently facing an issue with the Helpdesk module’s Knowledge Base functionality in Frappe: local. When I type a subject in the Helpdesk ticket creation form, the system does not show any suggestions from the Knowledge Base.

I noticed that the official Frappe YouTube channel demonstrated this functionality in a video titled “Helpdesk in Frappe”. However, they also faced the same issue initially but later showed how it works in Frappe Cloud without explaining the root cause of the issue. You can see this demonstration at https://youtu.be/tEGwQrTMqlQ?si=ziAc55qfP3jsg_MV&t=2624

Even my Frappe Cloud Helpdesk is showing Knowledge Base suggestions very very slow.

Could someone help me understand what might be causing this issue? Is there any configuration or setup that I might be missing?

Thank you in advance!

I got telegram suggestion in helpdesk channel: replaced all the redis-alpine images with - image: redis/redis-stack-server:latest

I opened docker-compose.yml
And replaced (image: redis:alpine) with:
image: redis/redis-stack-server:latest
Then save and run:
docker-compose down
Got an error
sukhpreet:~/frappe-bench/apps/helpdesk/docker$ docker-compose down WARN[0000] /home/acer/frappe-bench/apps/helpdesk/docker/docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion

Then I know about version attribute in docker-compose.yml file is no longer necessary because modern versions of docker compose automatically handle configuration without it. So then i removed it.

Again run:
docker-compose down
docker-compose down

To check is it running or not
docker ps

sukhpreet:~/frappe-bench/apps/helpdesk/docker$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
73e560d306fc redis/redis-stack-server:latest “/entrypoint.sh” 6 minutes ago Up 5 minutes 6379/tcp docker-redis-1
e92cfc78f562 mariadb:10.8 “docker-entrypoint.s…” 6 minutes ago Up 5 minutes 3306/tcp docker-mariadb-1
a4816bdbd350 frappe/bench:latest “bash /workspace/ini…” 6 minutes ago Up 5 minutes 6787/tcp, 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 8001-8005/tcp, 9001-9005/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp docker-frappe-1
e2a4195c3cc6 mariadb:10.6 “docker-entrypoint.s…” 5 weeks ago Up 27 minutes 3306/tcp fm_global-db
a24b77b5d286 mariadb:10.11 “docker-entrypoint.s…” 3 months ago Up 27 minutes 3306/tcp frappe_docker-db-1
6a54d913f805 redis:alpine “docker-entrypoint.s…” 3 months ago Up 27 minutes 0.0.0.0:6380->6379/tcp, [::]:6380->6379/tcp frappe_docker-redis-1

Then I check is redis responding or not
docker exec -it docker-redis-1 redis-cli
It respond PONG after running PING.

I updated the common_site_config.json changed the ports from redis_cache, redis_queue, redis_socketio

Then run bench start
It created error:
18:34:23 socketio.1 | Realtime service listening on: 9002 18:34:23 socketio.1 | node:internal/process/promises:288 18:34:23 socketio.1 | triggerUncaughtException(err, true /* fromPromise */); 18:34:23 socketio.1 | ^ 18:34:23 socketio.1 | 18:34:23 socketio.1 | Error: getaddrinfo EAI_AGAIN docker-redis-1 18:34:23 socketio.1 | at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) 18:34:23 socketio.1 | Emitted ‘error’ event on RedisClient instance at: 18:34:23 socketio.1 | at RedisSocket. (/home/acer/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/index.js:412:14) 18:34:23 socketio.1 | at RedisSocket.emit (node:events:517:28) 18:34:23 socketio.1 | at RedisSocket._RedisSocket_connect (/home/acer/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/socket.js:166:18) 18:34:23 socketio.1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 18:34:23 socketio.1 | at async RedisClient.connect (/home/acer/frappe-bench/apps/frappe/node_modules/@redis/client/dist/lib/client/index.js:185:9) 18:34:23 socketio.1 | at async /home/acer/frappe-bench/apps/frappe/realtime/index.js:47:2 { 18:34:23 socketio.1 | errno: -3001, 18:34:23 socketio.1 | code: ‘EAI_AGAIN’, 18:34:23 socketio.1 | syscall: ‘getaddrinfo’, 18:34:23 socketio.1 | hostname: ‘docker-redis-1’ 18:34:23 socketio.1 | } 18:34:23 socketio.1 | 18:34:23 socketio.1 | Node.js v18.20.4 18:34:23 system | socketio.1 stopped (rc=1) 18:34:23 system | sending SIGTERM to redis_cache.1 (pid 4194) 18:34:23 system | sending SIGTERM to redis_queue.1 (pid 4199) 18:34:23 system | sending SIGTERM to web.1 (pid 4203) 18:34:23 system | sending SIGTERM to watch.1 (pid 4212) 18:34:23 system | sending SIGTERM to schedule.1 (pid 4210) 18:34:23 system | sending SIGTERM to worker.1 (pid 4216) 18:34:23 redis_cache.1 | 4197:signal-handler (1739797463) Received SIGTERM scheduling shutdown… 18:34:23 redis_queue.1 | 4202:signal-handler (1739797463) Received SIGTERM scheduling shutdown… 18:34:23 system | worker.1 stopped (rc=-15) 18:34:23 system | watch.1 stopped (rc=-15) 18:34:23 system | schedule.1 stopped (rc=-15) 18:34:23 system | web.1 stopped (rc=-15) 18:34:23 redis_cache.1 | 4197:M 17 Feb 2025 18:34:23.958 # User requested shutdown… 18:34:23 redis_cache.1 | 4197:M 17 Feb 2025 18:34:23.958 * Removing the pid file. 18:34:23 redis_cache.1 | 4197:M 17 Feb 2025 18:34:23.958 # Redis is now ready to exit, bye bye… 18:34:23 system | redis_cache.1 stopped (rc=-15) 18:34:23 redis_queue.1 | 4202:M 17 Feb 2025 18:34:23.975 # User requested shutdown… 18:34:23 redis_queue.1 | 4202:M 17 Feb 2025 18:34:23.975 * Saving the final RDB snapshot before exiting. 18:34:24 redis_queue.1 | 4202:M 17 Feb 2025 18:34:24.137 * DB saved on disk 18:34:24 redis_queue.1 | 4202:M 17 Feb 2025 18:34:24.137 * Removing the pid file. 18:34:24 redis_queue.1 | 4202:M 17 Feb 2025 18:34:24.137 # Redis is now ready to exit, bye bye… 18:34:24 system | redis_queue.1 stopped (rc=-15)

Then I got solution from Ai
To change common_config_site.json values name with localhost
Before:
“redis_cache”: “redis://docker-redis-1:6379”,
“redis_queue”: “redis://docker-redis-1:6379”,
“redis_search”: “redis://docker-redis-1:6379”,
“redis_socketio”: “redis://docker-redis-1:6379”,
After
“redis_cache”: “redis://localhost:6379”,
“redis_queue”: “redis://localhost:6379”,
“redis_search”: “redis://localhost:6379”,
“redis_socketio”: “redis://localhost:6379”

Now the bench start is fine.
But it is still not working.
It doesn’t show suggestions.

I cleared the cache from bench site
But nothings happened

Then I run this to see is it response PONG
sukhpreet:~/frappe-bench/apps/helpdesk/docker$ redis-cli -h docker-redis-1 -p 6379
ping Could not connect to Redis at docker-redis-1:6379: Temporary failure in name resolution
But it gives errors.
Ai suggest change name in common_config_site.json with in Redis service name in docker-compose.yml
So I did it to check
I changed with “redis”
But nothing happened in suggestion issues.

Then I run this:
sukhpreet:~/frappe-bench/apps/helpdesk/docker$ redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> PING
PONG

Then I thought it should work now.
But unfortunately its not still working.
It shows this error in console
Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)Understand this errorAI
index-5a17f0b2.js:266 Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 114, in application
response = frappe.api.handle(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/api/init.py”, line 49, in handle
data = endpoint(**arguments)
^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/api/v1.py”, line 36, in handle_rpc_call
return frappe.handler.handle()
^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/handler.py”, line 50, in handle
data = execute_cmd(cmd)
^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/handler.py”, line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/init.py”, line 1726, in call
return fn(*args, **newargs)
^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/utils/typing_validations.py”, line 31, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “apps/helpdesk/helpdesk/api/article.py”, line 39, in search
if noun_phrases := get_noun_phrases(blob):
^^^^^^^^^^^^^^^^^^^^^^
File “apps/helpdesk/helpdesk/api/article.py”, line 18, in get_noun_phrases
return blob.noun_phrases
^^^^^^^^^^^^^^^^^
File “env/lib/python3.12/site-packages/textblob/decorators.py”, line 23, in get
value = obj.dict[self.func.name] = self.func(obj)
^^^^^^^^^^^^^^
File “env/lib/python3.12/site-packages/textblob/blob.py”, line 477, in noun_phrases
for phrase in self.np_extractor.extract(self.raw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “env/lib/python3.12/site-packages/textblob/en/np_extractors.py”, line 143, in extract
self.train()
File “env/lib/python3.12/site-packages/textblob/decorators.py”, line 35, in decorated
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “env/lib/python3.12/site-packages/textblob/en/np_extractors.py”, line 113, in train
train_data = nltk.corpus.brown.tagged_sents(categories=“news”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “env/lib/python3.12/site-packages/nltk/corpus/util.py”, line 120, in getattr
self.__load()
File “env/lib/python3.12/site-packages/nltk/corpus/util.py”, line 95, in __load
args, kwargs = self.__args, self.__kwargs
^^^^^^^^^^^
AttributeError: ‘CategorizedTaggedCorpusReader’ object has no attribute ‘_LazyCorpusLoader__args’

index-5a17f0b2.js:266 Uncaught (in promise) Error: /api/method/helpdesk.api.article.search AttributeError
at Object.transformResponse (index-5a17f0b2.js:266:1880)
at async Proxy.s (index-5a17f0b2.js:263:21657)

Just sharing my experience for Ubuntu 24.04

  1. sudo apt update
  2. sudo apt install redis-redisearch
  3. edit /etc/redis/redis.conf, add the following line
    loadmodule /usr/lib/redis/modules/redisearch.so
  4. If you are use bench setup production, add the loadmodule line to redis_cache.conf and redis_queue.conf in the config directory in your frappe directory.
1 Like

Thanx

A few of observations:

The python version i your post is 3.12 while the Docker from git seems to be 3.11.6, not sure why.

The init.sh script has redis config has --skip-redis-config-generation flag in bench init, , is that a factor?

The error seems to point to a nltk issue

1 Like

Thanks for your observation:
But the issue solved by I changed the common_site_config.json
“redis_cache”: “redis://172.19.0.2:6379”,
“redis_queue”: “redis://172.19.0.2:6379”,
“redis_search”: “redis://172.19.0.2:6379”,
“redis_socketio”: “redis://172.19.0.2:6379”,

Then run the

bench --site [my_site_name] build-search-index
bench --site [my_site_name] migrate
bench restart

Then it working fine.

Ok. So in order to get the feature to work in a Docker installation

Change the docker-compose.yaml redis image to redis/redis-stack-server:latest

In common_site_config.json, change the redis address to the one found in docker inspect?

Then bulid the search index, migrate the site and restart.

Is that essentially correct?

And thanks.

1 Like

Absolutely right.