mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Dbeaver/pro#8655 cb ai functions support (#4254)
* dbeaver/pro#8655 added function confirmation and result events
* dbeaver/pro#8655 refactor action function processing
* dbeaver/pro#8655 support function role
* dbeaver/pro#8655 revert ai function changes
* Revert "dbeaver/pro#8655 support function role"
This reverts commit 7343af5e97.
* dbeaver/pro#8655 simplify types
* dbeaver/pro#8867 Add custom WS event handlers. Move AI-related function top pro.
* dbeaver/pro#8655 Remove async tasks from chat workflow
---------
Co-authored-by: naumov <iamemptyhuh@gmail.com>
Co-authored-by: Serge Rider <serge@jkiss.org>
Co-authored-by: Serge Rider <serge@dbeaver.com>
Co-authored-by: alex <48489896+devnaumov@users.noreply.github.com>
This commit is contained in:
co-authored by
naumov
Serge Rider
Serge Rider
alex
parent
0d17208be4
commit
e81a150287
@@ -607,11 +607,13 @@ public class WebSession extends BaseWebSession
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public WebAsyncTaskInfo createAndRunAsyncTask(@NotNull String taskName, @NotNull WebAsyncTaskProcessor<?> runnable) {
|
||||
WebAsyncTaskInfo asyncTask = createAsyncTask(taskName);
|
||||
return runAsyncTask(asyncTask, runnable);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public WebAsyncTaskInfo runAsyncTask(@NotNull WebAsyncTaskInfo asyncTask, @NotNull WebAsyncTaskProcessor<?> runnable) {
|
||||
AbstractJob job = new AbstractCancelableJob(asyncTask.getName()) {
|
||||
@NotNull
|
||||
|
||||
+13
@@ -25,6 +25,8 @@ import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.websocket.WSUtils;
|
||||
import org.jkiss.dbeaver.model.websocket.event.WSClientEvent;
|
||||
import org.jkiss.dbeaver.model.websocket.registry.WSClientEventDescriptor;
|
||||
import org.jkiss.dbeaver.model.websocket.registry.WSEventRegistry;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
public class CBClientEventProcessor {
|
||||
@@ -50,6 +52,17 @@ public class CBClientEventProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle with custom handlers
|
||||
WSClientEventDescriptor ced = WSEventRegistry.getInstance().getClientEvent(clientEvent.getId());
|
||||
if (ced != null && ced.getHandler() != null) {
|
||||
try {
|
||||
ced.getHandler().handleEvent(webSession, clientEvent);
|
||||
} catch (Exception e) {
|
||||
log.error("Error handling event '" + clientEvent.getId() + "'", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (clientEvent.getId()) {
|
||||
case WSSubscribeOnTopicClientEvent.ID: {
|
||||
webSession.getEventsFilter().subscribeOnEventTopic(clientEvent.getTopicId());
|
||||
|
||||
@@ -9,27 +9,28 @@ import { observer } from 'mobx-react-lite';
|
||||
import { type ReactNode } from 'react';
|
||||
|
||||
import { IconOrImage } from '../IconOrImage.js';
|
||||
import { DisclosureProvider, Disclosure, DisclosureContent } from '@dbeaver/ui-kit';
|
||||
import { DisclosureProvider, Disclosure, DisclosureContent, clsx } from '@dbeaver/ui-kit';
|
||||
import './Expandable.css';
|
||||
|
||||
interface Props {
|
||||
label: string;
|
||||
label: string | ReactNode;
|
||||
children: ReactNode;
|
||||
defaultExpanded?: boolean;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const Expandable = observer(function Expandable({ label, defaultExpanded, disabled, children }: Props) {
|
||||
export const Expandable = observer(function Expandable({ label, defaultExpanded, disabled, children, className }: Props) {
|
||||
return (
|
||||
<div>
|
||||
<DisclosureProvider defaultOpen={defaultExpanded}>
|
||||
<Disclosure disabled={disabled}>
|
||||
<IconOrImage className="disclosure-icon" icon="arrow" />
|
||||
<h2 className="theme-typography--body2 disclosure-label">{label}</h2>
|
||||
{typeof label === 'string' ? <h2 className="theme-typography--body2 disclosure-label">{label}</h2> : label}
|
||||
</Disclosure>
|
||||
<DisclosureContent>
|
||||
<div>
|
||||
<div className="disclosure-content-inner"> {children}</div>
|
||||
<div className={clsx('disclosure-content-inner', className)}> {children}</div>
|
||||
</div>
|
||||
</DisclosureContent>
|
||||
</DisclosureProvider>
|
||||
|
||||
@@ -47,9 +47,9 @@ export { ServerEventId, SessionEventTopic, ClientEventId };
|
||||
|
||||
export type SessionEventId = ServerEventId | ClientEventId | string;
|
||||
|
||||
export interface ISessionEvent extends IBaseServerEvent<SessionEventId, SessionEventTopic> {
|
||||
export interface ISessionEvent<T extends string = SessionEventTopic> extends IBaseServerEvent<SessionEventId, T> {
|
||||
id: SessionEventId;
|
||||
topicId?: SessionEventTopic;
|
||||
topicId?: T;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user