Skip to content
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

feat(client): realtime state machine impl #32

Merged
merged 9 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
5 changes: 3 additions & 2 deletions apps/demo-nextjs-app-router/app/realtime/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/* eslint-disable @next/next/no-img-element */
import * as fal from '@fal-ai/serverless-client';
import { DrawingCanvas } from '../../components/drawing';
import { useState } from 'react';
import { DrawingCanvas } from '../../components/drawing';

fal.config({
proxyUrl: '/api/fal/proxy',
Expand All @@ -14,8 +14,9 @@ const PROMPT = 'a moon in a starry night sky';
export default function RealtimePage() {
const [image, setImage] = useState<string | null>(null);

const { send } = fal.realtime.connect('110602490-shared-lcm-test', {
const { send } = fal.realtime.connect('110602490-lcm-sd15-i2i', {
connectionKey: 'realtime-demo',
throttleInterval: 128,
onResult(result) {
if (result.images && result.images[0]) {
setImage(result.images[0].url);
Expand Down
7 changes: 5 additions & 2 deletions libs/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fal-ai/serverless-client",
"description": "The fal serverless JS/TS client",
"version": "0.6.1",
"version": "0.7.0",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -14,5 +14,8 @@
"client",
"ai",
"ml"
]
],
"dependencies": {
"robot3": "^0.4.1"
}
}
2 changes: 1 addition & 1 deletion libs/client/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
withMiddleware,
withProxy,
type RequestMiddleware,
withMiddleware,
} from './middleware';
import type { ResponseHandler } from './response';
import { defaultResponseHandler } from './response';
Expand All @@ -13,7 +13,7 @@
host?: string;
proxyUrl?: string;
requestMiddleware?: RequestMiddleware;
responseHandler?: ResponseHandler<any>;

Check warning on line 16 in libs/client/src/config.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
};

export type RequiredConfig = Required<Config>;
Expand Down
2 changes: 1 addition & 1 deletion libs/client/src/function.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getConfig } from './config';
import { storageImpl } from './storage';
import { dispatchRequest } from './request';
import { storageImpl } from './storage';
import { EnqueueResult, QueueStatus } from './types';
import { isUUIDv4, isValidUrl } from './utils';

Expand Down
Loading
Loading