-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ts' into updating-package-and-some-minor-fixes
- Loading branch information
Showing
12 changed files
with
75 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
JS/edgechains/examples/chat-with-pdf/src/tests/chat-with-pdf.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { test, expect } from 'vitest' | ||
import { test, expect } from "vitest"; | ||
|
||
test('should be return expected answer', async () => { | ||
const res = await fetch("http://localhost:3000/chatWithpdf?question=who is Nirmala Sitharaman") | ||
test("should be return expected answer", async () => { | ||
const res = await fetch("http://localhost:3000/chatWithpdf?question=who is Nirmala Sitharaman"); | ||
|
||
const data = await res.json() | ||
expect(data.res).toString() | ||
}, 40000); | ||
const data = await res.json(); | ||
expect(data.res).toString(); | ||
}, 40000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { configDefaults, defineConfig } from 'vitest/config' | ||
import { configDefaults, defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
exclude: [...configDefaults.exclude, 'packages/template/*'], | ||
}, | ||
}) | ||
test: { | ||
exclude: [...configDefaults.exclude, "packages/template/*"], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
|
||
import { ArakooServer } from "arakoodev/arakooserver"; | ||
import { ReactChainRouter } from "./routes/react-chain.js"; | ||
|
||
const server = new ArakooServer(); | ||
|
||
const app = server.createApp(); | ||
|
||
app.route("/", ReactChainRouter); | ||
|
||
server.listen(5000) | ||
|
||
import { ArakooServer } from "arakoodev/arakooserver"; | ||
import { ReactChainRouter } from "./routes/react-chain.js"; | ||
|
||
const server = new ArakooServer(); | ||
|
||
const app = server.createApp(); | ||
|
||
app.route("/", ReactChainRouter); | ||
|
||
server.listen(5000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 11 additions & 12 deletions
23
JS/edgechains/examples/react-chain/src/lib/getExtractedSummary.cts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
const axios = require('axios'); | ||
const axios = require("axios"); | ||
|
||
function getExtractedSummary() { | ||
return function (pageId: string) { | ||
const url = 'https://en.wikipedia.org/w/api.php'; | ||
const url = "https://en.wikipedia.org/w/api.php"; | ||
const queryParams = new URLSearchParams({ | ||
action: 'query', | ||
format: 'json', | ||
exintro: '', | ||
explaintext: '', | ||
prop: 'extracts', | ||
redirects: '1', | ||
action: "query", | ||
format: "json", | ||
exintro: "", | ||
explaintext: "", | ||
prop: "extracts", | ||
redirects: "1", | ||
pageids: pageId, | ||
}); | ||
const apiUrl = `${url}?${queryParams.toString()}`; | ||
try { | ||
return axios(apiUrl).then((res: any) => { | ||
return res.data.query.pages[pageId].extract; | ||
}); | ||
} | ||
catch (err) { | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
module.exports = getExtractedSummary; | ||
module.exports = getExtractedSummary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
JS/edgechains/examples/react-chain/src/test/react-chain.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { test, expect, } from 'vitest' | ||
import { test, expect } from "vitest"; | ||
|
||
test('should be return expected answer', async () => { | ||
const res = await fetch("http://localhost:5000?question=Author David Chanoff has collaborated with a U.S. Navy admiral who served as the ambassador to the United Kingdom under which President?") | ||
test("should be return expected answer", async () => { | ||
const res = await fetch( | ||
"http://localhost:5000?question=Author David Chanoff has collaborated with a U.S. Navy admiral who served as the ambassador to the United Kingdom under which President?" | ||
); | ||
|
||
const data = await res.json() | ||
expect(data).toContain("Bill Clinton") | ||
}, 40000); | ||
const data = await res.json(); | ||
expect(data).toContain("Bill Clinton"); | ||
}, 40000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"moduleResolution": "NodeNext", | ||
"module": "NodeNext", | ||
"rootDir": "./src", | ||
"outDir": "./dist", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true | ||
}, | ||
"exclude": ["./**/*.test.ts", "vitest.config.ts"] | ||
} | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"moduleResolution": "NodeNext", | ||
"module": "NodeNext", | ||
"rootDir": "./src", | ||
"outDir": "./dist", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true | ||
}, | ||
"exclude": ["./**/*.test.ts", "vitest.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { configDefaults, defineConfig } from 'vitest/config' | ||
import { configDefaults, defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
exclude: [...configDefaults.exclude, 'packages/template/*'], | ||
}, | ||
}) | ||
test: { | ||
exclude: [...configDefaults.exclude, "packages/template/*"], | ||
}, | ||
}); |