Skip to content

RealtimeClient.start will not resolve until the data channel is open and more #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion apps/browser-example/src/components/EventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,21 @@ export function EventList({ events }: { events: any[] }) {
}
}, [events])

function saveEvents() {
const blob = new Blob([JSON.stringify(events, null, 2)], {
type: "application/json",
})
const url = URL.createObjectURL(blob)
const a = document.createElement("a")
a.href = url
const timestamp = new Date().toISOString().replace(/[:.]/g, "-")
a.download = `events-${timestamp}.json`
a.click()
}

return (
<div className="card my-2">
<div className="card-header">
<div className="card-header d-flex gap-2">
<div className="dropdown">
<button
type="button"
Expand All @@ -49,6 +61,13 @@ export function EventList({ events }: { events: any[] }) {
>
Filter
</button>
<button
type="button"
className="btn btn-secondary"
onClick={() => saveEvents()}
>
Save Events to File
</button>
<span className="mx-2">Event Count: {events.length}</span>

<form
Expand Down
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"types": "./dist/WebRTC/index.d.ts",
"import": "./dist/WebRTC/index.js"
},
"./openai": {
"types": "./dist/openai/index.d.ts"
},
"./*": {
"types": "./dist/*.d.ts",
"import": "./dist/*.js"
Expand All @@ -35,9 +38,11 @@
},
"devDependencies": {
"@tsconfig/node20": "^20.1.4",
"@types/lodash-es": "^4.17.12",
"type-fest": "^4.33.0"
},
"dependencies": {
"lodash-es": "^4.17.21",
"typescript-event-target": "^1.1.1"
}
}
2 changes: 1 addition & 1 deletion packages/browser/scripts/gen-openai-from-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ parent_dir=$(cd "${this_dir}/.."; pwd)
# https://github.com/openai/openai-openapi
# https://raw.githubusercontent.com/openai/openai-openapi/25be47865ea2df1179a46be045c2f6b65f38e982/openapi.yaml

npx openapi-typescript "https://raw.githubusercontent.com/openai/openai-openapi/25be47865ea2df1179a46be045c2f6b65f38e982/openapi.yaml" -o "${parent_dir}/src/types/openai/openapi.d.ts"
npx openapi-typescript "https://raw.githubusercontent.com/openai/openai-openapi/25be47865ea2df1179a46be045c2f6b65f38e982/openapi.yaml" -o "${parent_dir}/src/openai/openapi.ts"
Loading
Loading