TTMSFNCCloudAI Problem with OpenAI threads

Hello,

I have problem with the TTMSFNCCloudAI component. I am using it for for communication with OpenAI Assistants Platform. Firstly, the OpenAI thread is created using the procedure TTMSFNCCloudAI.CreateThread(ACreated) and the thread ID is stored in the database. Then the message is posted within this thread. Next messages are posted within the thread with the threadID stored in the first step and everything works correct.

The problem appears when the application is closed and opened again. I would like to continue in the thread, which is stored in the database, but when I post the message using TTMSFNCCloudAI.CreateMessage() with threadID from the database, I get an error with the bad request url: Invalid URL (GET /v1/threads/runs/run_XXXXXXXXXXXXXXXXXXXXX). I think, that between threads and runs in the url the threadID is missing - should be GET /v1/threads/thread_XXXXXXXXXXXXXXXXXXXXX/runs/run_XXXXXXXXXXXXXXXXXXXXX.

When I tried to resolve this problem using debugger, I found, that you use the private FThreadID property in the procedure TTMSFNCCloudAI.CheckStatus(). This property you assign only in the procedure CreateThread(), so if I skip the CreateThread() step and use directly the threadID from the database, FThreadID is empty and URLs are wrong.

Can you look on this problem?
Thank you very much.
Josef Bambousek

Thanks for reporting this.
To solve this issue, we have added an overload of CheckStatus() where you can pass the ThreadID, so you can also use this method with the ThreadID you saved. This way, you do not need to create a new ThreadID when you had already stored one in your database and can just keep executing the existing one and check the status of an existing one.
This extension will be in the next TMS FNC Cloud Pack release.