@tiledesk/tiledesk-tybot-connector 2.1.12 → 2.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dump.rdb ADDED
Binary file
@@ -83,6 +83,16 @@ class TiledeskChatbot {
83
83
  winston.error("(TiledeskChatbot) Error resetting locked intent: ", error);
84
84
  }
85
85
 
86
+ //Checking locked mpc
87
+ const locked_mpc = await this.currentLockedMpc(this.requestId);
88
+ winston.verbose("(TiledeskChatbot) Got locked mpc: -" + locked_mpc + "-");
89
+ if (locked_mpc) {
90
+ winston.verbose("(TiledeskChatbot) Locked mpc. Unlocking mpc and return");
91
+ await this.unlockMpc(this.requestId);
92
+ resolve(true);
93
+ return;
94
+ }
95
+
86
96
  // Checking locked intent (for non-internal intents)
87
97
  // internal intents always "skip" the locked intent
88
98
  const locked_intent = await this.currentLockedIntent(this.requestId);
@@ -489,6 +499,19 @@ class TiledeskChatbot {
489
499
  return null;
490
500
  }
491
501
  }
502
+
503
+ async currentLockedMpc(requestId) {
504
+ if (this.tdcache) {
505
+ return await this.tdcache.get("tilebot:requests:" + requestId + ":mcp:locked");
506
+ }
507
+ else {
508
+ return null;
509
+ }
510
+ }
511
+
512
+ async unlockMpc(requestId) {
513
+ await this.tdcache.del("tilebot:requests:" + requestId + ":mcp:locked");
514
+ }
492
515
 
493
516
  async unlockIntent(requestId) {
494
517
  await DirUnlockIntent.unlockIntent(this.tdcache, requestId);
package/logs/app1.log CHANGED
@@ -4914,3 +4914,229 @@ info: (Tilebot) Redis connected
4914
4914
  info: (Tilebot) Tilebot started
4915
4915
  info: Tilebot route successfully started.
4916
4916
  info: Tilebot connector listening on port 10001
4917
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
4918
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
4919
+ info: AI_MODELS not defined
4920
+ info: AI Models:
4921
+ info: AI_MODELS not defined
4922
+ info: AI Models:
4923
+ info: Starting tilebot server...
4924
+ info: (Tilebot) Starting Tilebot..
4925
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
4926
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
4927
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
4928
+ info: (Tilebot) Log Level: info
4929
+ info: (Tilebot) MAX_STEPS: 1000
4930
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
4931
+ info: (Tilebot) Starting Tilebot connector v2.1.12
4932
+ info: (Tilebot) Using static bots
4933
+ info: (Tilebot) Connecting Redis...
4934
+ info: (Tilebot) Redis connected
4935
+ info: (Tilebot) Tilebot started
4936
+ info: Tilebot route successfully started.
4937
+ info: Tilebot connector listening on port
4938
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 19.01ms (HTTP 200) [keep-alive client: off]
4939
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/vllm completed in 2.51ms (HTTP 200) [keep-alive client: off]
4940
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/ask completed in 1.84ms (HTTP 200) [keep-alive client: off]
4941
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.72ms (HTTP 200) [keep-alive client: off]
4942
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.42ms (HTTP 200) [keep-alive client: off]
4943
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 1.05ms (HTTP 200) [keep-alive client: off]
4944
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/ask completed in 1.91ms (HTTP 200) [keep-alive client: off]
4945
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.88ms (HTTP 200) [keep-alive client: off]
4946
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.46ms (HTTP 200) [keep-alive client: off]
4947
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 1.19ms (HTTP 200) [keep-alive client: off]
4948
+ error: Error: DirAiPrompt agentplatform integration not resolved: llmServer attribute is undefined
4949
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 0.93ms (HTTP 200) [keep-alive client: off]
4950
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 0.98ms (HTTP 200) [keep-alive client: off]
4951
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 1.19ms (HTTP 200) [keep-alive client: off]
4952
+ error: Error: DirAiPrompt agentplatform integration not resolved: agentplatform server 'missing-server' not found
4953
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.59ms (HTTP 200) [keep-alive client: off]
4954
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 0.93ms (HTTP 200) [keep-alive client: off]
4955
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 1.21ms (HTTP 200) [keep-alive client: off]
4956
+ error: Error: DirAiPrompt agentplatform integration not resolved: Project for agentplatform is empty or invalid
4957
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.22ms (HTTP 200) [keep-alive client: off]
4958
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.02ms (HTTP 200) [keep-alive client: off]
4959
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 0.90ms (HTTP 200) [keep-alive client: off]
4960
+ error: Error: DirAiPrompt agentplatform integration not resolved: Location for agentplatform is empty or invalid
4961
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.08ms (HTTP 200) [keep-alive client: off]
4962
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
4963
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
4964
+ info: AI_MODELS not defined
4965
+ info: AI Models:
4966
+ info: AI_MODELS not defined
4967
+ info: AI Models:
4968
+ info: Starting tilebot server...
4969
+ info: (Tilebot) Starting Tilebot..
4970
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
4971
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
4972
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
4973
+ info: (Tilebot) Log Level: info
4974
+ info: (Tilebot) MAX_STEPS: 1000
4975
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
4976
+ info: (Tilebot) Starting Tilebot connector v2.1.12
4977
+ info: (Tilebot) Using static bots
4978
+ info: (Tilebot) Connecting Redis...
4979
+ info: AI_MODELS not defined
4980
+ info: AI Models:
4981
+ info: AI_MODELS not defined
4982
+ info: AI Models:
4983
+ info: Starting tilebot server...
4984
+ info: (Tilebot) Starting Tilebot..
4985
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
4986
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
4987
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
4988
+ info: (Tilebot) Log Level: info
4989
+ info: (Tilebot) MAX_STEPS: 1000
4990
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
4991
+ info: (Tilebot) Starting Tilebot connector v2.1.12
4992
+ info: (Tilebot) Using static bots
4993
+ info: (Tilebot) Connecting Redis...
4994
+ info: (Tilebot) Redis connected
4995
+ info: (Tilebot) Redis connected
4996
+ info: (Tilebot) Tilebot started
4997
+ info: Tilebot route successfully started.
4998
+ info: Tilebot connector listening on port 10001
4999
+ error: uncaughtException: listen EADDRINUSE: address already in use :::10001
5000
+ Error: listen EADDRINUSE: address already in use :::10001
5001
+ at Server.setupListenHandle [as _listen2] (node:net:1432:16)
5002
+ at listenInCluster (node:net:1480:12)
5003
+ at Server.listen (node:net:1568:7)
5004
+ at Function.listen (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/express/lib/application.js:635:24)
5005
+ at /Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/test/conversation-ai_condition_test.js:47:32
5006
+ at Object.startApp (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/index.js:811:7)
5007
+ at processTicksAndRejections (node:internal/process/task_queues:96:5) {"date":"Mon Sep 21 2026 11:40:52 GMT+0200 (Central European Summer Time)","error":{"address":"::","code":"EADDRINUSE","errno":-48,"port":10001,"syscall":"listen"},"exception":true,"os":{"loadavg":[2.64892578125,4.55078125,6.7392578125],"uptime":248557},"process":{"argv":["/Users/johnny/.nvm/versions/node/v16.17.0/bin/node","/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/.bin/mocha","--timeout","60000","--exit","test/conversation-ai_condition_test.js","--grep","vllm"],"cwd":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute","execPath":"/Users/johnny/.nvm/versions/node/v16.17.0/bin/node","gid":20,"memoryUsage":{"arrayBuffers":18940232,"external":25348877,"heapTotal":82296832,"heapUsed":41573400,"rss":131973120},"pid":72935,"uid":501,"version":"v16.17.0"},"stack":"Error: listen EADDRINUSE: address already in use :::10001\n at Server.setupListenHandle [as _listen2] (node:net:1432:16)\n at listenInCluster (node:net:1480:12)\n at Server.listen (node:net:1568:7)\n at Function.listen (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/express/lib/application.js:635:24)\n at /Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/test/conversation-ai_condition_test.js:47:32\n at Object.startApp (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/index.js:811:7)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)","trace":[{"column":16,"file":"node:net","function":"Server.setupListenHandle [as _listen2]","line":1432,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"node:net","function":"listenInCluster","line":1480,"method":null,"native":false},{"column":7,"file":"node:net","function":"Server.listen","line":1568,"method":"listen","native":false},{"column":24,"file":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/express/lib/application.js","function":"Function.listen","line":635,"method":"listen","native":false},{"column":32,"file":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/test/conversation-ai_condition_test.js","function":null,"line":47,"method":null,"native":false},{"column":7,"file":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/index.js","function":"Object.startApp","line":811,"method":"startApp","native":false},{"column":5,"file":"node:internal/process/task_queues","function":"processTicksAndRejections","line":96,"method":null,"native":false}]}
5008
+ info: (Tilebot) Tilebot started
5009
+ info: Tilebot route successfully started.
5010
+ error: uncaughtException: listen EADDRINUSE: address already in use :::10001
5011
+ Error: listen EADDRINUSE: address already in use :::10001
5012
+ at Server.setupListenHandle [as _listen2] (node:net:1432:16)
5013
+ at listenInCluster (node:net:1480:12)
5014
+ at Server.listen (node:net:1568:7)
5015
+ at Function.listen (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/express/lib/application.js:635:24)
5016
+ at /Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/test/conversation-ai_condition_test.js:47:32
5017
+ at Object.startApp (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/index.js:811:7)
5018
+ at processTicksAndRejections (node:internal/process/task_queues:96:5) {"date":"Mon Sep 21 2026 11:40:52 GMT+0200 (Central European Summer Time)","error":{"address":"::","code":"EADDRINUSE","errno":-48,"port":10001,"syscall":"listen"},"exception":true,"os":{"loadavg":[2.64892578125,4.55078125,6.7392578125],"uptime":248557},"process":{"argv":["/Users/johnny/.nvm/versions/node/v16.17.0/bin/node","/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/.bin/mocha","--timeout","60000","--exit","test/conversation-ai_condition_test.js","--grep","vllm"],"cwd":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute","execPath":"/Users/johnny/.nvm/versions/node/v16.17.0/bin/node","gid":20,"memoryUsage":{"arrayBuffers":18932016,"external":25340621,"heapTotal":82296832,"heapUsed":41476040,"rss":131973120},"pid":72935,"uid":501,"version":"v16.17.0"},"stack":"Error: listen EADDRINUSE: address already in use :::10001\n at Server.setupListenHandle [as _listen2] (node:net:1432:16)\n at listenInCluster (node:net:1480:12)\n at Server.listen (node:net:1568:7)\n at Function.listen (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/express/lib/application.js:635:24)\n at /Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/test/conversation-ai_condition_test.js:47:32\n at Object.startApp (/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/index.js:811:7)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)","trace":[{"column":16,"file":"node:net","function":"Server.setupListenHandle [as _listen2]","line":1432,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"node:net","function":"listenInCluster","line":1480,"method":null,"native":false},{"column":7,"file":"node:net","function":"Server.listen","line":1568,"method":"listen","native":false},{"column":24,"file":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/node_modules/express/lib/application.js","function":"Function.listen","line":635,"method":"listen","native":false},{"column":32,"file":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/test/conversation-ai_condition_test.js","function":null,"line":47,"method":null,"native":false},{"column":7,"file":"/Users/johnny/Documents/Tiledesk/tiledesk-chatbot/tybotRoute/index.js","function":"Object.startApp","line":811,"method":"startApp","native":false},{"column":5,"file":"node:internal/process/task_queues","function":"processTicksAndRejections","line":96,"method":null,"native":false}]}
5019
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 12.07ms (HTTP 200) [keep-alive client: off]
5020
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 2.72ms (HTTP 200) [keep-alive client: off]
5021
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/kb/namespace/all completed in 1.90ms (HTTP 200) [keep-alive client: off]
5022
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/qa completed in 2.48ms (HTTP 200) [keep-alive client: off]
5023
+ info: [HttpUtils] POST http://127.0.0.1:10002/projectID/kb/answered/ completed in 4.00ms (HTTP 200) [keep-alive client: off]
5024
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 3.46ms (HTTP 200) [keep-alive client: off]
5025
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.61ms (HTTP 200) [keep-alive client: off]
5026
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 1.34ms (HTTP 200) [keep-alive client: off]
5027
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.54ms (HTTP 200) [keep-alive client: off]
5028
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
5029
+ info: AI_MODELS not defined
5030
+ info: AI Models:
5031
+ info: AI_MODELS not defined
5032
+ info: AI Models:
5033
+ info: Starting tilebot server...
5034
+ info: (Tilebot) Starting Tilebot..
5035
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
5036
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
5037
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
5038
+ info: (Tilebot) Log Level: info
5039
+ info: (Tilebot) MAX_STEPS: 1000
5040
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
5041
+ info: (Tilebot) Starting Tilebot connector v2.1.12
5042
+ info: (Tilebot) Using static bots
5043
+ info: (Tilebot) Connecting Redis...
5044
+ info: (Tilebot) Redis connected
5045
+ info: (Tilebot) Tilebot started
5046
+ info: Tilebot route successfully started.
5047
+ info: Tilebot connector listening on port 10001
5048
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 14.48ms (HTTP 200) [keep-alive client: off]
5049
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 2.14ms (HTTP 200) [keep-alive client: off]
5050
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/kb/namespace/all completed in 1.34ms (HTTP 200) [keep-alive client: off]
5051
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/qa completed in 2.14ms (HTTP 200) [keep-alive client: off]
5052
+ info: [HttpUtils] POST http://127.0.0.1:10002/projectID/kb/answered/ completed in 3.29ms (HTTP 200) [keep-alive client: off]
5053
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 2.81ms (HTTP 200) [keep-alive client: off]
5054
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.33ms (HTTP 200) [keep-alive client: off]
5055
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/agentplatform completed in 1.43ms (HTTP 200) [keep-alive client: off]
5056
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.62ms (HTTP 200) [keep-alive client: off]
5057
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
5058
+ info: AI_MODELS not defined
5059
+ info: AI Models:
5060
+ info: AI_MODELS not defined
5061
+ info: AI Models:
5062
+ info: Starting tilebot server...
5063
+ info: (Tilebot) Starting Tilebot..
5064
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
5065
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
5066
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
5067
+ info: (Tilebot) Log Level: info
5068
+ info: (Tilebot) MAX_STEPS: 1000
5069
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
5070
+ info: (Tilebot) Starting Tilebot connector v2.1.12
5071
+ info: (Tilebot) Using static bots
5072
+ info: (Tilebot) Connecting Redis...
5073
+ info: (Tilebot) Redis connected
5074
+ info: (Tilebot) Tilebot started
5075
+ info: Tilebot route successfully started.
5076
+ info: Tilebot connector listening on port
5077
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 11.90ms (HTTP 200) [keep-alive client: off]
5078
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/vllm completed in 2.36ms (HTTP 200) [keep-alive client: off]
5079
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/ask completed in 1.61ms (HTTP 200) [keep-alive client: off]
5080
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.70ms (HTTP 200) [keep-alive client: off]
5081
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
5082
+ info: AI_MODELS not defined
5083
+ info: AI Models:
5084
+ info: AI_MODELS not defined
5085
+ info: AI Models:
5086
+ info: Starting tilebot server...
5087
+ info: (Tilebot) Starting Tilebot..
5088
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
5089
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
5090
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
5091
+ info: (Tilebot) Log Level: info
5092
+ info: (Tilebot) MAX_STEPS: 1000
5093
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
5094
+ info: (Tilebot) Starting Tilebot connector v2.1.12
5095
+ info: (Tilebot) Using static bots
5096
+ info: (Tilebot) Connecting Redis...
5097
+ info: (Tilebot) Redis connected
5098
+ info: (Tilebot) Tilebot started
5099
+ info: Tilebot route successfully started.
5100
+ info: Tilebot connector listening on port 10001
5101
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 11.90ms (HTTP 200) [keep-alive client: off]
5102
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/google completed in 2.05ms (HTTP 200) [keep-alive client: off]
5103
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/kb/namespace/all completed in 1.78ms (HTTP 200) [keep-alive client: off]
5104
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/qa completed in 1.67ms (HTTP 200) [keep-alive client: off]
5105
+ info: [HttpUtils] POST http://127.0.0.1:10002/projectID/kb/answered/ completed in 3.41ms (HTTP 200) [keep-alive client: off]
5106
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 2.87ms (HTTP 200) [keep-alive client: off]
5107
+ info: [HttpUtils] HTTP client keep-alive: disabled (default). Set TYBOT_HTTP_KEEP_ALIVE=1|true|yes|on to enable. Verbose logs include round-trip time (ms) and [keep-alive client: off].
5108
+ info: AI_MODELS not defined
5109
+ info: AI Models:
5110
+ info: AI_MODELS not defined
5111
+ info: AI Models:
5112
+ info: Starting tilebot server...
5113
+ info: (Tilebot) Starting Tilebot..
5114
+ info: (Tilebot) settings.API_ENDPOINT:http://127.0.0.1:10002
5115
+ info: (Tilebot) settings.API_URL:http://127.0.0.1:10002
5116
+ info: (Tilebot) settings.TILEBOT_ENDPOINT:http://127.0.0.1:10001
5117
+ info: (Tilebot) Log Level: info
5118
+ info: (Tilebot) MAX_STEPS: 1000
5119
+ info: (Tilebot) MAX_EXECUTION_TIME: 28800000
5120
+ info: (Tilebot) Starting Tilebot connector v2.1.12
5121
+ info: (Tilebot) Using static bots
5122
+ info: (Tilebot) Connecting Redis...
5123
+ info: (Tilebot) Redis connected
5124
+ info: (Tilebot) Tilebot started
5125
+ info: Tilebot route successfully started.
5126
+ info: Tilebot connector listening on port
5127
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 12.27ms (HTTP 200) [keep-alive client: off]
5128
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/openrouter completed in 2.35ms (HTTP 200) [keep-alive client: off]
5129
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/ask completed in 1.75ms (HTTP 200) [keep-alive client: off]
5130
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.79ms (HTTP 200) [keep-alive client: off]
5131
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.62ms (HTTP 200) [keep-alive client: off]
5132
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/openrouter completed in 1.19ms (HTTP 200) [keep-alive client: off]
5133
+ error: Error: DirAiPrompt openrouter integration not resolved: The key provided for openrouter is not valid or undefined
5134
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.01ms (HTTP 200) [keep-alive client: off]
5135
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.32ms (HTTP 200) [keep-alive client: off]
5136
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/openrouter completed in 1.20ms (HTTP 200) [keep-alive client: off]
5137
+ info: [HttpUtils] POST http://127.0.0.1:10002/api/ask completed in 1.34ms (HTTP 200) [keep-alive client: off]
5138
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.36ms (HTTP 200) [keep-alive client: off]
5139
+ info: [HttpUtils] POST http://127.0.0.1:10001/ext/botID completed in 1.18ms (HTTP 200) [keep-alive client: off]
5140
+ info: [HttpUtils] GET http://127.0.0.1:10002/projectID/integration/name/openrouter completed in 0.96ms (HTTP 200) [keep-alive client: off]
5141
+ error: Error: DirAiCondition openrouter integration not resolved: The key provided for openrouter is not valid or undefined
5142
+ info: [HttpUtils] POST http://127.0.0.1:10001/exec/botID completed in 1.75ms (HTTP 200) [keep-alive client: off]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.1.12",
3
+ "version": "2.1.14",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,10 +1,63 @@
1
1
  const integrationService = require("./IntegrationService");
2
+ const { buildOpenRouterModel } = require("../utils/openrouterUtils");
2
3
 
3
4
  class AIController {
4
5
 
5
6
  constructor() {}
6
7
 
7
- async resolveLLMConfig(id_project, provider = 'openai', model, token, vllmServer) {
8
+ // llmServer is the generic named-server key. vllm still accepts the 5th
9
+ // positional argument as vllmServer for existing actions.
10
+ async resolveLLMConfig(id_project, provider = 'openai', model, token, llmServer) {
11
+
12
+ if (provider === 'openrouter') {
13
+ const integration = await integrationService.getIntegration(id_project, provider, token);
14
+ if (!integration?.value?.apikey) {
15
+ throw { code: 422, error: "The key provided for openrouter is not valid or undefined" };
16
+ }
17
+
18
+ return buildOpenRouterModel(integration.value, model);
19
+ }
20
+
21
+ if (provider === 'agentplatform') {
22
+ const integration = await integrationService.getIntegration(id_project, provider, token);
23
+ if (!integration?.value) {
24
+ throw { code: 404, error: "integration agentplatform not found" };
25
+ }
26
+
27
+ const value = integration.value;
28
+ if (!Array.isArray(value.servers)) {
29
+ throw { code: 422, error: "agentplatform servers list is missing or invalid" };
30
+ }
31
+ if (!llmServer) {
32
+ throw { code: 422, error: "llmServer attribute is undefined" };
33
+ }
34
+ const server = value.servers.find(s => s.name === llmServer);
35
+ if (!server) {
36
+ throw { code: 422, error: `agentplatform server '${llmServer}' not found` };
37
+ }
38
+ if (!server.project || typeof server.project !== 'string') {
39
+ throw { code: 422, error: "Project for agentplatform is empty or invalid" };
40
+ }
41
+ if (!server.location || typeof server.location !== 'string') {
42
+ throw { code: 422, error: "Location for agentplatform is empty or invalid" };
43
+ }
44
+ return {
45
+ provider: "google",
46
+ name: model,
47
+ api_key: server.apikey,
48
+ project: server.project,
49
+ location: server.location
50
+ };
51
+ }
52
+
53
+ if (provider === 'openrouter') {
54
+ const integration = await integrationService.getIntegration(id_project, provider, token);
55
+ if (!integration?.value?.apikey) {
56
+ throw { code: 422, error: "The key provided for openrouter is not valid or undefined" };
57
+ }
58
+
59
+ return buildOpenRouterModel(integration.value, model);
60
+ }
8
61
 
9
62
  if (provider === 'ollama' || provider === 'vllm') {
10
63
  const integration = await integrationService.getIntegration(id_project, provider, token);
@@ -15,12 +68,12 @@ class AIController {
15
68
  const value = integration.value;
16
69
 
17
70
  if (provider === 'vllm' && Array.isArray(value.servers)) {
18
- if (!vllmServer) {
71
+ if (!llmServer) {
19
72
  throw { code: 422, error: "vllmServer attribute is undefined" };
20
73
  }
21
- const server = value.servers.find(s => s.name === vllmServer);
74
+ const server = value.servers.find(s => s.name === llmServer);
22
75
  if (!server) {
23
- throw { code: 422, error: `vllm server '${vllmServer}' not found` };
76
+ throw { code: 422, error: `vllm server '${llmServer}' not found` };
24
77
  }
25
78
  if (!server.url) {
26
79
  throw { code: 422, error: "Server url for vllm is empty or invalid" };
@@ -11,6 +11,7 @@ const Utils = require("../../utils/HttpUtils");
11
11
  const utils = require("../../utils/HttpUtils");
12
12
  const httpUtils = require("../../utils/HttpUtils");
13
13
  const integrationService = require("../../services/IntegrationService");
14
+ const aiController = require("../../services/AIController");
14
15
  const { Logger } = require("../../Logger");
15
16
  const { randomUUID } = require("crypto");
16
17
 
@@ -123,6 +124,8 @@ class DirAiCondition {
123
124
  let publicKey = false;
124
125
  let ollama_integration;
125
126
  let vllm_server_config;
127
+ let openrouter_model;
128
+ let agentplatform_model;
126
129
 
127
130
  if (action.llm === 'ollama') {
128
131
  ollama_integration = await integrationService.getIntegration(this.projectId, action.llm, this.token).catch( async (err) => {
@@ -198,6 +201,59 @@ class DirAiCondition {
198
201
  return;
199
202
  }
200
203
 
204
+ } else if (action.llm === 'openrouter') {
205
+ // The model object carries provider_routing, which decides the upstream
206
+ // provider; sending the bare model name would silently drop it and let
207
+ // OpenRouter route on its own (unlike /llm/preview in tiledesk-server).
208
+ try {
209
+ openrouter_model = await aiController.resolveLLMConfig(this.projectId, action.llm, filled_model, this.token);
210
+ key = openrouter_model.api_key;
211
+ } catch (err) {
212
+ this.logger.error("[AI Condition] llm key not found in openrouter integration");
213
+ winston.error("Error: DirAiCondition openrouter integration not resolved: " + (err?.error || err?.message));
214
+ await this.chatbot.addParameter("flowError", "AiCondition Error: missing key for llm " + action.llm);
215
+ if (errorIntent) {
216
+ await this.#executeIntent(errorIntent);
217
+ callback(true);
218
+ return;
219
+ }
220
+ callback();
221
+ return;
222
+ }
223
+
224
+ } else if (action.llm === 'agentplatform') {
225
+ try {
226
+ const filled_llm_server = filler.fill(action.llmServer, requestVariables);
227
+ agentplatform_model = await aiController.resolveLLMConfig(
228
+ this.projectId, action.llm, filled_model, this.token, filled_llm_server);
229
+ key = agentplatform_model.api_key;
230
+ } catch (err) {
231
+ const errorMsg = err?.error || err?.message || "integration agentplatform not found";
232
+ this.logger.error("[AI Condition] agentplatform integration not resolved: ", errorMsg);
233
+ winston.error("Error: DirAiCondition agentplatform integration not resolved: " + errorMsg);
234
+ await this.chatbot.addParameter("flowError", "AiCondition Error: " + errorMsg);
235
+ if (errorIntent) {
236
+ await this.#executeIntent(errorIntent);
237
+ callback(true);
238
+ return;
239
+ }
240
+ callback();
241
+ return;
242
+ }
243
+
244
+ if (!key) {
245
+ this.logger.error("[AI Condition] llm key not found in agentplatform integration");
246
+ winston.error("Error: DirAiCondition llm key not found in agentplatform integration");
247
+ await this.chatbot.addParameter("flowError", "AiCondition Error: missing key for llm " + action.llm);
248
+ if (errorIntent) {
249
+ await this.#executeIntent(errorIntent);
250
+ callback(true);
251
+ return;
252
+ }
253
+ callback();
254
+ return;
255
+ }
256
+
201
257
  } else {
202
258
  key = await integrationService.getKeyFromIntegrations(this.projectId, action.llm, this.token);
203
259
 
@@ -289,6 +345,15 @@ class DirAiCondition {
289
345
  console.log("set json.model to: ", json.model);
290
346
  }
291
347
 
348
+ if (action.llm === 'openrouter') {
349
+ json.model = openrouter_model;
350
+ }
351
+
352
+ if (action.llm === 'agentplatform') {
353
+ json.llm = 'google';
354
+ json.model = agentplatform_model;
355
+ }
356
+
292
357
  winston.debug("DirAiCondition json: ", json);
293
358
 
294
359
  const HTTPREQUEST = {
@@ -8,6 +8,7 @@ require('dotenv').config();
8
8
  const winston = require('../../utils/winston');
9
9
  const httpUtils = require("../../utils/HttpUtils");
10
10
  const integrationService = require("../../services/IntegrationService");
11
+ const aiController = require("../../services/AIController");
11
12
  const { Logger } = require("../../Logger");
12
13
  const assert = require("assert");
13
14
  const quotasService = require("../../services/QuotasService");
@@ -123,6 +124,8 @@ class DirAiPrompt {
123
124
  let publicKey = false;
124
125
  let ollama_integration;
125
126
  let vllm_server_config;
127
+ let openrouter_model;
128
+ let agentplatform_model;
126
129
 
127
130
  if (action.llm === 'ollama') {
128
131
  ollama_integration = await integrationService.getIntegration(this.projectId, action.llm, this.token).catch( async (err) => {
@@ -198,6 +201,59 @@ class DirAiPrompt {
198
201
  return;
199
202
  }
200
203
 
204
+ } else if (action.llm === 'openrouter') {
205
+ // The model object carries provider_routing, which decides the upstream
206
+ // provider; sending the bare model name would silently drop it and let
207
+ // OpenRouter route on its own (unlike /llm/preview in tiledesk-server).
208
+ try {
209
+ openrouter_model = await aiController.resolveLLMConfig(this.projectId, action.llm, filled_model, this.token);
210
+ key = openrouter_model.api_key;
211
+ } catch (err) {
212
+ this.logger.error("[AI Prompt] llm key not found in openrouter integration");
213
+ winston.error("Error: DirAiPrompt openrouter integration not resolved: " + (err?.error || err?.message));
214
+ await this.chatbot.addParameter("flowError", "AiPrompt Error: missing key for llm " + action.llm);
215
+ if (falseIntent) {
216
+ await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
217
+ callback(true);
218
+ return;
219
+ }
220
+ callback();
221
+ return;
222
+ }
223
+
224
+ } else if (action.llm === 'agentplatform') {
225
+ try {
226
+ const filled_llm_server = filler.fill(action.llmServer, requestVariables);
227
+ agentplatform_model = await aiController.resolveLLMConfig(
228
+ this.projectId, action.llm, filled_model, this.token, filled_llm_server);
229
+ key = agentplatform_model.api_key;
230
+ } catch (err) {
231
+ const errorMsg = err?.error || err?.message || "integration agentplatform not found";
232
+ this.logger.error("[AI Prompt] agentplatform integration not resolved: ", errorMsg);
233
+ winston.error("Error: DirAiPrompt agentplatform integration not resolved: " + errorMsg);
234
+ await this.chatbot.addParameter("flowError", "AiPrompt Error: " + errorMsg);
235
+ if (falseIntent) {
236
+ await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
237
+ callback(true);
238
+ return;
239
+ }
240
+ callback();
241
+ return;
242
+ }
243
+
244
+ if (!key) {
245
+ this.logger.error("[AI Prompt] llm key not found in agentplatform integration");
246
+ winston.error("Error: DirAiPrompt llm key not found in agentplatform integration");
247
+ await this.chatbot.addParameter("flowError", "AiPrompt Error: missing key for llm " + action.llm);
248
+ if (falseIntent) {
249
+ await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
250
+ callback(true);
251
+ return;
252
+ }
253
+ callback();
254
+ return;
255
+ }
256
+
201
257
  } else {
202
258
  key = await integrationService.getKeyFromIntegrations(this.projectId, action.llm, this.token);
203
259
 
@@ -289,6 +345,15 @@ class DirAiPrompt {
289
345
  console.log("set json.model to: ", json.model);
290
346
  }
291
347
 
348
+ if (action.llm === 'openrouter') {
349
+ json.model = openrouter_model;
350
+ }
351
+
352
+ if (action.llm === 'agentplatform') {
353
+ json.llm = 'google';
354
+ json.model = agentplatform_model;
355
+ }
356
+
292
357
  if (action.attach) {
293
358
  json.attach = await this.detectAttach(action.attach);
294
359
  }
@@ -141,6 +141,7 @@ class DirAskGPTV2 {
141
141
  skip_unanswered = false,
142
142
  use_hyde = false,
143
143
  use_cache = false,
144
+ llmServer = null,
144
145
  vllmServer = null,
145
146
  } = action;
146
147
 
@@ -181,7 +182,12 @@ class DirAskGPTV2 {
181
182
  let engine;
182
183
 
183
184
  try {
184
- model = await aiController.resolveLLMConfig(this.projectId, llm, filled_model, this.token, vllmServer);
185
+ // agentplatform uses llmServer; vllm keeps vllmServer and accepts llmServer as fallback
186
+ const filled_llm_server = filler.fill(
187
+ llm === 'vllm' ? (llmServer || vllmServer) : llmServer,
188
+ requestVariables
189
+ );
190
+ model = await aiController.resolveLLMConfig(this.projectId, llm, filled_model, this.token, filled_llm_server);
185
191
  } catch (err) {
186
192
  const errorMsg = err?.error || `${llm} integration not found`;
187
193
  this.logger.error(`[Ask Knowledge Base] Error getting ${llm} integration: `, errorMsg);
@@ -0,0 +1,89 @@
1
+ /**
2
+ * OpenRouter provider routing.
3
+ *
4
+ * The dashboard stores, per model, which upstream providers may serve it and
5
+ * in what order:
6
+ *
7
+ * integration.value = {
8
+ * apikey: "sk-or-...",
9
+ * models: [
10
+ * { id: "openai/gpt-4o", name: "GPT-4o",
11
+ * providers: ["azure", "openai"], allow_fallbacks: true, sort: "price" }
12
+ * ]
13
+ * }
14
+ *
15
+ * This turns one of those entries into the routing object the LLM microservice
16
+ * forwards to OpenRouter as the request's "provider" block.
17
+ */
18
+
19
+ const OPENROUTER_BASE_URL = 'https://openrouter.ai/api/v1';
20
+
21
+ const SORT_VALUES = ['price', 'throughput', 'latency'];
22
+
23
+ /** The stored configuration for one model id, or undefined when it has none. */
24
+ function findModelConfig(value, model) {
25
+ const models = value && Array.isArray(value.models) ? value.models : [];
26
+ const wanted = String(model || '').trim();
27
+ if (!wanted) {
28
+ return undefined;
29
+ }
30
+ return models.find((entry) => entry && String(entry.id || '').trim() === wanted);
31
+ }
32
+
33
+ /**
34
+ * Build the routing block for a model.
35
+ *
36
+ * Returns undefined when the model carries nothing worth routing, so an
37
+ * unconfigured model behaves exactly like any other OpenAI-compatible
38
+ * provider instead of being pinned to an empty provider list.
39
+ */
40
+ function buildProviderRouting(value, model) {
41
+ const config = findModelConfig(value, model);
42
+ if (!config) {
43
+ return undefined;
44
+ }
45
+
46
+ const routing = {};
47
+
48
+ const order = (Array.isArray(config.providers) ? config.providers : [])
49
+ .map((provider) => String(provider || '').trim())
50
+ .filter((provider) => !!provider);
51
+ if (order.length > 0) {
52
+ routing.order = order;
53
+ }
54
+
55
+ // true is OpenRouter's own default, so only the restrictive choice is worth sending.
56
+ if (config.allow_fallbacks === false) {
57
+ routing.allow_fallbacks = false;
58
+ }
59
+
60
+ const sort = String(config.sort || '').trim().toLowerCase();
61
+ if (SORT_VALUES.includes(sort)) {
62
+ routing.sort = sort;
63
+ }
64
+
65
+ return Object.keys(routing).length > 0 ? routing : undefined;
66
+ }
67
+
68
+ /**
69
+ * The model object the LLM microservice expects for an OpenRouter call.
70
+ * `provider_routing` is omitted entirely when there is nothing to route.
71
+ */
72
+ function buildOpenRouterModel(value, model) {
73
+ const routing = buildProviderRouting(value, model);
74
+
75
+ return {
76
+ provider: 'openrouter',
77
+ name: model,
78
+ url: OPENROUTER_BASE_URL,
79
+ api_key: (value && value.apikey) || '',
80
+ ...(routing && { provider_routing: routing })
81
+ };
82
+ }
83
+
84
+ module.exports = {
85
+ OPENROUTER_BASE_URL,
86
+ findModelConfig,
87
+ buildProviderRouting,
88
+ buildOpenRouterModel
89
+ };