Thanks for you answer.

We have solved the problem of the delay in BP, and now, the number of new instances of BS has been drastically reduced.

We are talking with the customer to upgrade the actor pool number to create a 3 new instances of the BP. The customer is worried that this increase in instances could affect memory performance, because more instances created, more memory it requires.

Hi,

In iris.script add the following line:

zpm "install iris-deploy-tools -v" 

In TgGptProduction.cls remove the settings of Token and ApiKey

<Item Name="Telegram.InboundService" Category="" ClassName="Telegram.LongPollingService" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Adapter" Name="SSLConfig">tg</Setting>
    <Setting Target="Host" Name="Target">GPTRouter</Setting>
</Item>
....
<Item Name="St.OpenAi.BO.Api.Connect" Category="" ClassName="St.OpenAi.BO.Api.Connect" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Host" Name="Organization"></Setting>
    <Setting Target="Adapter" Name="SSLConfig">tg</Setting>
</Item>

In Setup.cls, extends the class to St.Tools.Deploy and modify the loop to add the default configuration.

Class shvarov.telegramgpt.Setup Extends St.Tools.Deploy
{
ClassMethod Init(TgToken As %String, GPTKey As %String) As %Status
{
    set st=$$$OK
    set production="shvarov.telegramgpt.i14y.TgGptProduction"
    for item="Telegram.InboundService","Telegram.OutboundOperation" {
        set st = ..AddDefaultSetting("*",item,,"Token",TgToken)
        quit:$$$ISERR(st)
    }
    set item="St.OpenAi.BO.Api.Connect"
    set st = ..AddDefaultSetting("*",item,,"ApiKey",GPTKey)
    return st
}
....
}

I hope you find it useful