From 1b7fcbf642fee1778e4cbe438f6e5490091306b4 Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Wed, 25 Dec 2024 14:16:29 +0100 Subject: [PATCH] adjustments for video --- .gitignore | 2 +- .../aiproxy/playwright-tests/aiproxy.spec.js | 7 ++- .../playwright-tests/openaimockserver.js | 2 +- examples/aiproxy/web/index.html | 55 ++++++------------- examples/aiproxy/web/main.js | 2 +- 5 files changed, 24 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 8e20e1f..077aa39 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ emsdk /blob-report/ /playwright/.cache/ bin - +*.mp4 diff --git a/examples/aiproxy/playwright-tests/aiproxy.spec.js b/examples/aiproxy/playwright-tests/aiproxy.spec.js index 72d3b9a..81d9964 100644 --- a/examples/aiproxy/playwright-tests/aiproxy.spec.js +++ b/examples/aiproxy/playwright-tests/aiproxy.spec.js @@ -18,9 +18,12 @@ test('ask question', async ({ page }) => { const questionArea = await page.getByPlaceholder('Type your question here...'); await expect(questionArea).toBeEnabled(); questionArea.fill("Hello!"); + await page.waitForTimeout(500); await page.getByRole('button', { name: 'Ask AI' }).click(); - await expect(await page.getByText("I am just a mockserver")).toBeVisible(); + await expect(await page.getByText("Hello! How can I assist you today?")).toBeVisible(); + + await page.waitForTimeout(500); await page.locator("#refundButton").click(); - await expect(await page.locator("#refund_message")).toContainText(`[\"EVENT_JSON:{\\\"standard\\\":\\\"nep141\\\",\\\"version\\\":\\\"1.0.0\\\",\\\"event\\\":\\\"ft_transfer\\\",\\\"data\\\":[{\\\"old_owner_id\\\":\\\"${contractId}\\\",\\\"new_owner_id\\\":\\\"${accountId}\\\",\\\"amount\\\":\\\"127999973\\\"}]}\",\"refunded 127999973 to ${accountId}\",\"\\n\"]`) + await expect(await page.locator("#refund_message")).toContainText(`EVENT_JSON:{"standard":"nep141","version":"1.0.0","event":"ft_transfer","data":[{"old_owner_id":"${contractId}","new_owner_id":"${accountId}","amount":"127999973"}]}\nrefunded 127999973 to ${accountId}`); }); diff --git a/examples/aiproxy/playwright-tests/openaimockserver.js b/examples/aiproxy/playwright-tests/openaimockserver.js index fc703b2..5f1ffc7 100644 --- a/examples/aiproxy/playwright-tests/openaimockserver.js +++ b/examples/aiproxy/playwright-tests/openaimockserver.js @@ -17,7 +17,7 @@ const server = createServer((req, res) => { choices: [ { delta: { - content: "I am just a mockserver\n", + content: "Hello! How can I assist you today?\n", }, }, ], diff --git a/examples/aiproxy/web/index.html b/examples/aiproxy/web/index.html index 665367d..f00b0c2 100644 --- a/examples/aiproxy/web/index.html +++ b/examples/aiproxy/web/index.html @@ -4,53 +4,29 @@ OpenAI Proxy Streaming - + -

OpenAI Proxy Streaming UI

- - " +
+
+ + +
+
-
- - - - +
+ + +
-
-
+
+
-            
+            
         
+
+ \ No newline at end of file diff --git a/examples/aiproxy/web/main.js b/examples/aiproxy/web/main.js index 5b1c1ed..cb6ebc0 100644 --- a/examples/aiproxy/web/main.js +++ b/examples/aiproxy/web/main.js @@ -40,7 +40,7 @@ async function refund() { ...refundMessage } }); - refund_message.innerHTML = JSON.stringify(result.receipts_outcome[0].outcome.logs); + refund_message.innerHTML = result.receipts_outcome[0].outcome.logs.join("\n"); } async function startConversation() {