fix(ai): extend default HTTP timeout
This commit is contained in:
parent
97efdcf638
commit
69e9ee3164
@ -1,6 +1,6 @@
|
|||||||
local PING_PROMPT = 'reply with exactly: pong';
|
local PING_PROMPT = 'reply with exactly: pong';
|
||||||
|
|
||||||
local DEFAULT_TIMEOUT_SECONDS = 60;
|
local DEFAULT_TIMEOUT_SECONDS = 120;
|
||||||
local MAX_TIMEOUT_SECONDS = 120;
|
local MAX_TIMEOUT_SECONDS = 120;
|
||||||
local DEFAULT_POLL_TIMEOUT_SECONDS = 600;
|
local DEFAULT_POLL_TIMEOUT_SECONDS = 600;
|
||||||
local DEFAULT_POLL_INTERVAL_SECONDS = 2;
|
local DEFAULT_POLL_INTERVAL_SECONDS = 2;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
"trapos-boot": "0.3.2",
|
"trapos-boot": "0.3.2",
|
||||||
"trapos-net": "0.3.0",
|
"trapos-net": "0.3.0",
|
||||||
"trapos-ui": "0.2.2",
|
"trapos-ui": "0.2.2",
|
||||||
"trapos-ai": "0.6.9",
|
"trapos-ai": "0.6.10",
|
||||||
"trapos-sandbox": "0.2.2",
|
"trapos-sandbox": "0.2.2",
|
||||||
"trapos": "0.8.11"
|
"trapos": "0.8.11"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trapos-ai",
|
"name": "trapos-ai",
|
||||||
"version": "0.6.9",
|
"version": "0.6.10",
|
||||||
"description": "TrapOS AI client for opencode serve",
|
"description": "TrapOS AI client for opencode serve",
|
||||||
"dependencies": ["trapos-core"],
|
"dependencies": ["trapos-core"],
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
15
tests/ai.lua
15
tests/ai.lua
@ -847,6 +847,21 @@ testlib.test('ask polling default timeout allows ten minute replies', function()
|
|||||||
testlib.assertEquals(#httpStub.getCalls, 3);
|
testlib.assertEquals(#httpStub.getCalls, 3);
|
||||||
end);
|
end);
|
||||||
|
|
||||||
|
testlib.test('ask uses two minute HTTP timeout by default', function()
|
||||||
|
local httpStub = fakeHttp(
|
||||||
|
{ sessionResp('ses_1'), messageResp('reply') },
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
local settingsStub = fakeSettings({ ['opencc.server_url'] = 'http://host' });
|
||||||
|
local ai = createAi({ http = httpStub, settings = settingsStub });
|
||||||
|
|
||||||
|
local ok = ai.ask('hello');
|
||||||
|
|
||||||
|
testlib.assertTrue(ok);
|
||||||
|
testlib.assertEquals(httpStub.postCalls[1].timeout, 120);
|
||||||
|
testlib.assertEquals(httpStub.postCalls[2].timeout, 120);
|
||||||
|
end);
|
||||||
|
|
||||||
testlib.test('ask caps per-call HTTP timeout at two minutes', function()
|
testlib.test('ask caps per-call HTTP timeout at two minutes', function()
|
||||||
local httpStub = fakeHttp(
|
local httpStub = fakeHttp(
|
||||||
{ sessionResp('ses_1'), messageResp('reply') },
|
{ sessionResp('ses_1'), messageResp('reply') },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user