Skip to content

Commit b79c64a

Browse files
committed
cleanup
1 parent 247c666 commit b79c64a

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"src/index.node.ts",
3838
"--timeout",
3939
"5000",
40-
"integration/**/prompt-templates.test.ts"
40+
"integration/**/*.test.ts"
4141
],
4242
"env": {
4343
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"

packages/ai/integration/prompt-templates.test.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,16 @@ describe('Prompt templates', function () {
3535
describe(`${testConfig.toString()}`, () => {
3636
describe('Generative Model', () => {
3737
it('successfully generates content', async () => {
38-
const a = new AbortController();
3938
const model = getTemplateGenerativeModel(testConfig.ai, {
4039
baseUrl: STAGING_URL
4140
});
42-
// a.abort();
43-
try {
44-
await model.generateContent(
45-
`sassy-greeting-${templateBackendSuffix(
46-
testConfig.ai.backend.backendType
47-
)}`,
48-
{ name: 'John' },
49-
{ signal: a.signal, timeout: 100 }
50-
);
51-
} catch (e) {
52-
console.error(e);
53-
if ((e as DOMException).name === 'AbortError') {
54-
console.log(1);
55-
}
56-
}
41+
const { response } = await model.generateContent(
42+
`sassy-greeting-${templateBackendSuffix(
43+
testConfig.ai.backend.backendType
44+
)}`,
45+
{ name: 'John' }
46+
);
47+
expect(response.text()).to.contain('John'); // Template asks to address directly by name
5748
});
5849
});
5950
describe('Imagen model', async () => {
@@ -65,8 +56,7 @@ describe('Prompt templates', function () {
6556
`portrait-${templateBackendSuffix(
6657
testConfig.ai.backend.backendType
6758
)}`,
68-
{ animal: 'Rhino' },
69-
{ timeout: 100 }
59+
{ animal: 'Rhino' }
7060
);
7161
expect(images.length).to.equal(2); // We ask for two images in the prompt template
7262
});

packages/ai/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"test:browser": "yarn testsetup && karma start",
4242
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha --require ts-node/register --require src/index.node.ts 'src/**/!(*-browser)*.test.ts' --config ../../config/mocharc.node.js",
4343
"test:integration": "karma start --integration",
44-
"test:integration:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha integration/**/prompt-templates.test.ts --config ../../config/mocharc.node.js",
44+
"test:integration:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha integration/**/*.test.ts --config ../../config/mocharc.node.js",
4545
"api-report": "api-extractor run --local --verbose",
4646
"typings:public": "node ../../scripts/build/use_typings.js ./dist/ai-public.d.ts",
4747
"type-check": "yarn tsc --noEmit",

packages/ai/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const PACKAGE_VERSION = version;
3232

3333
export const LANGUAGE_TAG = 'gl-js';
3434

35-
export const DEFAULT_FETCH_TIMEOUT_MS = 180 * 1000; // TODO: Extend default timeout to accommodate for longer generation requests with pro models.
35+
export const DEFAULT_FETCH_TIMEOUT_MS = 180 * 1000;
3636

3737
/**
3838
* Defines the name of the default in-cloud model to use for hybrid inference.

packages/ai/src/methods/chat-session.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ import { ChromeAdapter } from '../types/chrome-adapter';
3636
/**
3737
* Used to break the internal promise chain when an error is already handled
3838
* by the user, preventing duplicate console logs.
39-
*
40-
* TODO: Refactor to use `Promise.allSettled` to decouple the internal
41-
* sequencing chain from user error handling.
4239
*/
4340
const SILENT_ERROR = 'SILENT_ERROR';
4441

0 commit comments

Comments
 (0)