openvibers/openvibe.exchange Commits

Move comparison links and vhost to Compare (#194)

OP OpenVibers committed 2 days ago · bbe8919f07 · 4 files, +12 −12

* Point comparisons at the dedicated Compare service

* Assert the request token without a clock-boundary race

Changes

ddiff --git a/deploy/nginx/openvibe.compare.conf b/deploy/nginx/openvibe.compare.conf
iindex 4b4aa1b..32fff5b 100644
---- a/deploy/nginx/openvibe.compare.conf
++++ b/deploy/nginx/openvibe.compare.conf
@@@ -1,9 +1,8 @@
## ═══════════════════════════════════════════════════════════════
## openvibe.compare — reference vhost for ov-vhost-install.
##
--## The comparison site is served by OpenVibe.Exchange's process on 127.0.0.1:5150 (the same app, behind its own
--## name: server/http/compare-site.js). This vhost passes the name through in Host, which is what makes the request
--## the compare site's; every other name reaches Exchange's own pages. No proxy_cache: the app decides cacheability.
++## Compare now runs in OpenVibe.Compare on port 5280. Kept here so an Exchange deployment
++## cannot restore the retired shared-process target. Canonical vhost: OpenVibe.Compare/deploy/nginx/.
## ═══════════════════════════════════════════════════════════════
limit_req_zone $binary_remote_addr zone=compare_auth:10m rate=10r/m;
@@@ -68,26 +67,26 @@ server {
location = /auth/me {
limit_req zone=compare_api burst=30 nodelay;
limit_req_status 429;
-- proxy_pass http://127.0.0.1:5150;
++ proxy_pass http://127.0.0.1:5280;
}
location /auth/ {
limit_req zone=compare_auth burst=10 nodelay;
limit_req_status 429;
-- proxy_pass http://127.0.0.1:5150;
++ proxy_pass http://127.0.0.1:5280;
}
location /api/ {
limit_req zone=compare_api burst=20 nodelay;
limit_req_status 429;
-- proxy_pass http://127.0.0.1:5150;
++ proxy_pass http://127.0.0.1:5280;
}
# A reader's remark is the only form on the site.
location = /remarks {
limit_req zone=compare_forms burst=10 nodelay;
limit_req_status 429;
-- proxy_pass http://127.0.0.1:5150;
++ proxy_pass http://127.0.0.1:5280;
}
# Host-local scrapers only; OpenVibe.Events' account delivery is loopback-only.
@@@ -95,7 +94,7 @@ server {
location ~* ^/internal(/|$) { return 404; }
location / {
-- proxy_pass http://127.0.0.1:5150;
++ proxy_pass http://127.0.0.1:5280;
}
location ~ /\.(?!well-known) {
ddiff --git a/server/views/exchange.js b/server/views/exchange.js
iindex a212a17..33e90cc 100644
---- a/server/views/exchange.js
++++ b/server/views/exchange.js
@@@ -383,7 +383,7 @@ ${kit.head({ title: model.name, sub: `${familyLabel(model)}${model.variant ? `
${stats.length ? kit.stats(stats) : ''}
${model.description ? `<p class="ex-prose">${esc(model.description)}</p>` : ''}
${panel({ title: 'Every offer that serves it', note: 'Price in, out and cached per million tokens; speed and uptime from the last seven days of real requests; the privacy label and the provider’s own data policy.', id: 'offers', body: kit.table({ columns, rows, label: `Offers for ${model.name}`, empty: 'No live offer serves this model right now.' }) })}
--<p class="ex-more"><a href="https://openvibe.compare/models/${String(model.slug).split('/').map(encodeURIComponent).join('/')}">Compare ${esc(model.name)} with another model →</a></p>
++<p class="ex-more"><a href="https://openvibe.compare/things/${encodeURIComponent(model.slug)}">Compare ${esc(model.name)} with another model →</a></p>
${activityPanel(model.activity)}
${require('./analysis').modelFacts(analysis)}
${panel({ title: 'Presets', note: 'A preset fixes the router’s floor, ceiling and policy, and you name it as the model.', id: 'presets', body: presetsBox() })}
ddiff --git a/server/views/platform.js b/server/views/platform.js
iindex 0d087a8..2c73f70 100644
---- a/server/views/platform.js
++++ b/server/views/platform.js
@@@ -30,7 +30,7 @@ const best = (m) =>
const chat = (m) =>
`https://openvibe.chat/vibe?models=${encodeURIComponent(id(m))}`;
const rank = (m) =>
-- `https://openvibe.report/ai/models/${encodeURIComponent(id(m))}`;
++ `https://openvibe.compare/things/${encodeURIComponent(id(m))}`;
const section = (title, body) => kit.section({ title, body });
const code = (m) =>
kit.snippet({
ddiff --git a/test/companions-group.test.js b/test/companions-group.test.js
iindex 92c2b7c..3fa3e68 100644
---- a/test/companions-group.test.js
++++ b/test/companions-group.test.js
@@@ -153,11 +153,12 @@ const { createFakeAi } = require('./helpers/ai');
assert.strictEqual(talk.status, 303, talk.text.slice(0, 200));
chatId = String(talk.headers.get('location')).split('/').pop();
ttsCalls.length = 0;
-- const sent = await t.get('/talk/' + chatId + '/send', { as: alice, form: { text: 'Hello Ada' } });
++ const voiceToken = t.network.userToken(alice);
++ const sent = await t.get('/talk/' + chatId + '/send', { as: alice, cookie: `exchange_at=${voiceToken}`, form: { text: 'Hello Ada' } });
assert.strictEqual(sent.status, 303);
assert.strictEqual(ttsCalls.length, 1, 'the answer is read aloud exactly once');
assert.strictEqual(ttsCalls[0].body.voice, 'gary', 'in the voice the card names');
-- assert.strictEqual(ttsCalls[0].auth, 'Bearer ' + t.network.userToken(alice), 'the call carries the person\'s own token');
++ assert.strictEqual(ttsCalls[0].auth, 'Bearer ' + voiceToken, 'the call carries the person\'s own token');
const page = await t.get('/talk/' + chatId, { as: alice });
assert.strictEqual((page.text.match(/<audio/g) || []).length, 1, 'one sound on the page');
assert.ok(page.text.includes('voice: gary'));