@deepseek-ai/dsh-client-ui-message-feedback 0.1.3-alpha.2 → 0.1.5-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +15 -10
- package/README.zh.md +16 -11
- package/lib/client.js +568 -378
- package/lib/types/client/FeedbackDialog.d.ts +16 -0
- package/lib/types/client/MessageFeedbackActions.d.ts +8 -11
- package/lib/types/client/controller.d.ts +27 -30
- package/lib/types/client/dialog.d.ts +79 -0
- package/lib/types/client/index.d.ts +11 -10
- package/lib/types/client/locales.d.ts +27 -13
- package/lib/types/client/slots.d.ts +40 -20
- package/lib/types/client/surface.d.ts +30 -0
- package/package.json +20 -16
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The feedback dialog and its acknowledgement toast, rendered as one entry
|
|
3
|
+
* of `conversation.input.overlay` so each Session owns exactly one of each.
|
|
4
|
+
* The Modal and the Toast both portal to `document.body`; the overlay slot
|
|
5
|
+
* only supplies the per-session controller and the composer card the toast
|
|
6
|
+
* centers over.
|
|
7
|
+
* @module @deepseek-ai/dsh-client-ui-message-feedback/client/FeedbackDialog
|
|
8
|
+
*/
|
|
9
|
+
import type { FeedbackDialogProps } from './slots.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Render one Session's feedback dialog and toast.
|
|
12
|
+
* @param props - the dialog hook, the draft verbs, and the locale seat.
|
|
13
|
+
* @returns the modal while a target is open, the toast while one is showing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function FeedbackDialog({ useDialog, edit, submit, dismiss, dismissToast, t }: FeedbackDialogProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=FeedbackDialog.d.ts.map
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-message feedback controls:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* conversation column. Portaling out of the column also escapes its `overflow`
|
|
9
|
-
* clip, so the panel cannot be cropped or detached from the message it annotates.
|
|
2
|
+
* Per-message feedback controls: the Like/Dislike pair inside the assistant
|
|
3
|
+
* message's IconActions row, between copy and branch. Like records at once
|
|
4
|
+
* and raises the Session's acknowledgement toast; Dislike opens the Session's
|
|
5
|
+
* feedback dialog, whose submission records the negative judgment with its
|
|
6
|
+
* category and text. Clicking the recorded rating retracts it. A recorded
|
|
7
|
+
* rating shows the filled glyph so the signal survives a pointer leaving the row.
|
|
10
8
|
* @module @deepseek-ai/dsh-client-ui-message-feedback/client/MessageFeedbackActions
|
|
11
9
|
*/
|
|
12
10
|
import type { MessageFeedbackActionProps } from './slots.ts';
|
|
@@ -14,8 +12,7 @@ import type { MessageFeedbackActionProps } from './slots.ts';
|
|
|
14
12
|
* One message's feedback controls.
|
|
15
13
|
* @param props - the owner's message identity, the injected verbs, and the
|
|
16
14
|
* shared feedback hook.
|
|
17
|
-
* @returns the rating buttons
|
|
18
|
-
* portal-open beneath the trigger while it is open.
|
|
15
|
+
* @returns the rating buttons with any failure notice beside them.
|
|
19
16
|
*/
|
|
20
|
-
export declare function MessageFeedbackActions({ messageId, ensure,
|
|
17
|
+
export declare function MessageFeedbackActions({ messageId, ensure, current, toggle, openDialog, acknowledge, useFeedback, t, }: MessageFeedbackActionProps): import("react").JSX.Element;
|
|
21
18
|
//# sourceMappingURL=MessageFeedbackActions.d.ts.map
|
|
@@ -10,6 +10,7 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
|
10
10
|
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots';
|
|
11
11
|
import type { MessageId } from '@deepseek-ai/dsh-api-remotes/client';
|
|
12
12
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
13
|
+
import type { FeedbackRecord } from '@deepseek-ai/dsh-command-feedback/types';
|
|
13
14
|
import type { MessageFeedbackItem, MessageFeedbackRating } from '@deepseek-ai/dsh-message-feedback/types';
|
|
14
15
|
/** Load state of the one list read that seeds every per-message control. */
|
|
15
16
|
export type MessageFeedbackStatus = 'cold' | 'loading' | 'ready' | 'error';
|
|
@@ -21,16 +22,29 @@ export interface MessageFeedbackView {
|
|
|
21
22
|
/** Reason the last load failed, cleared by the next successful load. */
|
|
22
23
|
error: string | null;
|
|
23
24
|
}
|
|
24
|
-
/**
|
|
25
|
-
export
|
|
26
|
-
ok: true;
|
|
27
|
-
} | {
|
|
25
|
+
/** Rejected branch shared by every settled action. */
|
|
26
|
+
export interface MessageFeedbackActionFailure {
|
|
28
27
|
ok: false;
|
|
29
28
|
error: {
|
|
30
29
|
code: string;
|
|
31
30
|
message: string;
|
|
32
31
|
};
|
|
33
|
-
}
|
|
32
|
+
}
|
|
33
|
+
/** Settled action shape rendered by the message-level controls. */
|
|
34
|
+
export type MessageFeedbackActionResult = {
|
|
35
|
+
ok: true;
|
|
36
|
+
} | MessageFeedbackActionFailure;
|
|
37
|
+
/** A settled toggle, carrying the rating now committed so the control can tell a record from a retraction. */
|
|
38
|
+
export type MessageFeedbackToggleResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
rating: MessageFeedbackRating | null;
|
|
41
|
+
} | MessageFeedbackActionFailure;
|
|
42
|
+
/**
|
|
43
|
+
* Human-readable text for one business failure code.
|
|
44
|
+
* @param code - the Host's business failure code.
|
|
45
|
+
* @returns the developer-facing description carried in the failure branch.
|
|
46
|
+
*/
|
|
47
|
+
export declare function describe(code: string): string;
|
|
34
48
|
/**
|
|
35
49
|
* Per-session feedback object layer. One instance backs every per-message
|
|
36
50
|
* control in that Session, so a single list read seeds them all.
|
|
@@ -76,43 +90,26 @@ export declare class MessageFeedbackController implements HostObservable<Message
|
|
|
76
90
|
resync(): Promise<MessageFeedbackActionResult>;
|
|
77
91
|
/**
|
|
78
92
|
* Create or replace feedback for one message, comparing against the version
|
|
79
|
-
* this controller last observed.
|
|
80
|
-
*
|
|
81
|
-
* The note is resolved here rather than by the caller: `mutate` awaits the
|
|
82
|
-
* one list read first, so this body always sees the committed item, while a
|
|
83
|
-
* control that rendered before that read completed would still be holding
|
|
84
|
-
* `undefined`. Omitting `note` therefore keeps whatever is stored; only
|
|
85
|
-
* {@link clearNote} removes one.
|
|
93
|
+
* this controller last observed. The item stores exactly `entry`: an entry
|
|
94
|
+
* without a note or category replaces whatever the stored item carried.
|
|
86
95
|
* @param messageId - target assistant message.
|
|
87
96
|
* @param rating - desired judgment.
|
|
88
|
-
* @param
|
|
97
|
+
* @param entry - explanation and category to store with the judgment.
|
|
89
98
|
* @returns the settled mutation result.
|
|
90
99
|
*/
|
|
91
|
-
rate(messageId: MessageId, rating: MessageFeedbackRating,
|
|
100
|
+
rate(messageId: MessageId, rating: MessageFeedbackRating, entry?: FeedbackRecord): Promise<MessageFeedbackActionResult>;
|
|
92
101
|
/**
|
|
93
102
|
* Replace one message's rating with the opposite judgment, or retract it when
|
|
94
103
|
* the committed rating already matches. The decision reads the committed item
|
|
95
104
|
* inside the serialized mutation, so a click that lands before the first list
|
|
96
105
|
* read still toggles against the stored value rather than the empty view a
|
|
97
|
-
* cold control rendered.
|
|
106
|
+
* cold control rendered. A replacement stores the bare judgment; the note
|
|
107
|
+
* and category of the judgment it replaces do not carry over.
|
|
98
108
|
* @param messageId - target assistant message.
|
|
99
109
|
* @param rating - the judgment the human asked for.
|
|
100
|
-
* @returns the settled mutation result.
|
|
101
|
-
*/
|
|
102
|
-
toggle(messageId: MessageId, rating: MessageFeedbackRating): Promise<MessageFeedbackActionResult>;
|
|
103
|
-
/**
|
|
104
|
-
* Drop the note while keeping the rating. Absent feedback needs no call.
|
|
105
|
-
* @param messageId - target assistant message.
|
|
106
|
-
* @returns the settled mutation result.
|
|
107
|
-
*/
|
|
108
|
-
clearNote(messageId: MessageId): Promise<MessageFeedbackActionResult>;
|
|
109
|
-
/**
|
|
110
|
-
* Remove feedback for one message. A message with no known item is already
|
|
111
|
-
* in the requested state, so no call is made.
|
|
112
|
-
* @param messageId - target assistant message.
|
|
113
|
-
* @returns the settled mutation result.
|
|
110
|
+
* @returns the settled mutation result with the rating now committed.
|
|
114
111
|
*/
|
|
115
|
-
|
|
112
|
+
toggle(messageId: MessageId, rating: MessageFeedbackRating): Promise<MessageFeedbackToggleResult>;
|
|
116
113
|
/** Commit one put against the observed version and reconcile a conflict. */
|
|
117
114
|
private putCommitted;
|
|
118
115
|
/** Commit one delete against the observed version and reconcile a conflict. */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless state of one Session's feedback dialog and its acknowledgement
|
|
3
|
+
* toast. One form serves two targets: the Session itself (a bare `/feedback`)
|
|
4
|
+
* and one assistant message (Dislike). The overlay view renders from the
|
|
5
|
+
* store; the message controls raise the toast after a Like through
|
|
6
|
+
* {@link FeedbackDialogController.acknowledge}.
|
|
7
|
+
* @module @deepseek-ai/dsh-client-ui-message-feedback/client/dialog
|
|
8
|
+
*/
|
|
9
|
+
import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
10
|
+
import type { MessageId } from '@deepseek-ai/dsh-api-remotes/client';
|
|
11
|
+
import type { FeedbackCategory, FeedbackRecord } from '@deepseek-ai/dsh-command-feedback/types';
|
|
12
|
+
import type { MessageFeedbackActionResult } from './controller.ts';
|
|
13
|
+
/** What one open dialog submits to. */
|
|
14
|
+
export type FeedbackDialogTarget = {
|
|
15
|
+
readonly kind: 'session';
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'message';
|
|
18
|
+
readonly messageId: MessageId;
|
|
19
|
+
};
|
|
20
|
+
/** Dialog and toast state the overlay view renders from. */
|
|
21
|
+
export interface FeedbackDialogState {
|
|
22
|
+
/** Target the dialog is open for; null while closed. */
|
|
23
|
+
readonly target: FeedbackDialogTarget | null;
|
|
24
|
+
readonly category: FeedbackCategory | null;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
/** A submission is in flight; the form ignores edits and submits until it settles. */
|
|
27
|
+
readonly submitting: boolean;
|
|
28
|
+
/** Failure code of the last submission from this open; null when none. */
|
|
29
|
+
readonly failure: string | null;
|
|
30
|
+
/** Sequence of the acknowledgement toast on screen; 0 while none. */
|
|
31
|
+
readonly toast: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Record one submission against its target.
|
|
35
|
+
* @param target - the open target.
|
|
36
|
+
* @param entry - the trimmed text and the category, each present only when given.
|
|
37
|
+
*/
|
|
38
|
+
export type FeedbackSubmit = (target: FeedbackDialogTarget, entry: FeedbackRecord) => Promise<MessageFeedbackActionResult>;
|
|
39
|
+
/** Per-session dialog controller; one instance backs the overlay entry and every message control. */
|
|
40
|
+
export declare class FeedbackDialogController {
|
|
41
|
+
private readonly submit;
|
|
42
|
+
/** Dialog state store (the overlay entry subscribes here). */
|
|
43
|
+
readonly state: SnapshotStore<FeedbackDialogState>;
|
|
44
|
+
/** Bumped by every open, dismiss, and dispose so a late settlement can tell its draft is gone. */
|
|
45
|
+
private generation;
|
|
46
|
+
private toastSeq;
|
|
47
|
+
/**
|
|
48
|
+
* @param submit - records one submission; the owner routes it by target.
|
|
49
|
+
*/
|
|
50
|
+
constructor(submit: FeedbackSubmit);
|
|
51
|
+
/**
|
|
52
|
+
* Open the dialog with an empty draft, replacing any open draft.
|
|
53
|
+
* @param target - what the submission records against.
|
|
54
|
+
*/
|
|
55
|
+
open(target: FeedbackDialogTarget): void;
|
|
56
|
+
/** Close the dialog and discard the draft; a toast on screen stays. */
|
|
57
|
+
dismiss(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Replace part of the draft while it is editable.
|
|
60
|
+
* @param draft - the category (null clears it) or the text as typed.
|
|
61
|
+
*/
|
|
62
|
+
edit(draft: Partial<Pick<FeedbackDialogState, 'category' | 'text'>>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Submit the draft; an empty draft is a valid submission. Success closes the
|
|
65
|
+
* dialog and raises the toast; a failure keeps the dialog open with its code.
|
|
66
|
+
* @returns after the submission settles.
|
|
67
|
+
*/
|
|
68
|
+
submitDraft(): Promise<void>;
|
|
69
|
+
/** Show the acknowledgement toast; a toast already on screen restarts. */
|
|
70
|
+
acknowledge(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Retire one toast after its fade; a newer toast is left alone.
|
|
73
|
+
* @param seq - the toast sequence the view finished showing.
|
|
74
|
+
*/
|
|
75
|
+
dismissToast(seq: number): void;
|
|
76
|
+
/** Scope-teardown disposer: drop the draft and the toast, orphan in-flight work. */
|
|
77
|
+
dispose(): void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* conversation.chat.assistant-actions strip
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Feedback surface plugin, browser half: the Like/Dislike entry in the
|
|
3
|
+
* conversation.chat.assistant-actions strip, the feedback dialog and its
|
|
4
|
+
* acknowledgement toast in conversation.input.overlay, and the `/feedback`
|
|
5
|
+
* decoration that opens the dialog from the composer menu or a bare typed
|
|
6
|
+
* command. One FeedbackSurface per Session backs every entry in that Session.
|
|
7
7
|
* @module @deepseek-ai/dsh-client-ui-message-feedback/client
|
|
8
8
|
*/
|
|
9
9
|
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
10
|
-
export type { MessageFeedbackActionResult, MessageFeedbackStatus, MessageFeedbackView, } from './controller.ts';
|
|
11
|
-
export type {
|
|
10
|
+
export type { MessageFeedbackActionFailure, MessageFeedbackActionResult, MessageFeedbackStatus, MessageFeedbackToggleResult, MessageFeedbackView, } from './controller.ts';
|
|
11
|
+
export type { FeedbackDialogState, FeedbackDialogTarget, FeedbackSubmit } from './dialog.ts';
|
|
12
|
+
export type { FeedbackDialogInjected, FeedbackDialogProps, MessageFeedbackActionProps, MessageFeedbackInjected, } from './slots.ts';
|
|
12
13
|
export type { MessageFeedbackKey } from './locales.ts';
|
|
13
|
-
/** Required services: the slot registry, the Remote
|
|
14
|
+
/** Required services: the slot registry, the two Remote namespaces, and the copy. */
|
|
14
15
|
export declare const inject: string[];
|
|
15
16
|
/**
|
|
16
|
-
* Client plugin body: the per-message feedback entry
|
|
17
|
-
*
|
|
17
|
+
* Client plugin body: the per-message feedback entry, the Session's dialog
|
|
18
|
+
* entry, the `/feedback` decoration, and their per-session surfaces.
|
|
18
19
|
* @param ctx - client root context.
|
|
19
20
|
*/
|
|
20
21
|
export declare function apply(ctx: ClientContext): void;
|
|
@@ -5,21 +5,28 @@ export declare const zh: {
|
|
|
5
5
|
'action.likeActive': string;
|
|
6
6
|
'action.dislike': string;
|
|
7
7
|
'action.dislikeActive': string;
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
8
|
+
'dialog.title': string;
|
|
9
|
+
'dialog.categories': string;
|
|
10
|
+
'dialog.detail': string;
|
|
11
|
+
'dialog.hint': string;
|
|
12
|
+
'category.task-result': string;
|
|
13
|
+
'category.instruction-following': string;
|
|
14
|
+
'category.product-interaction': string;
|
|
15
|
+
'category.service-stability': string;
|
|
16
|
+
'category.resource-cost': string;
|
|
17
|
+
'category.security-privacy-permission': string;
|
|
18
|
+
'category.other': string;
|
|
19
|
+
'toast.recorded': string;
|
|
14
20
|
'error.conflict': string;
|
|
15
21
|
'error.load': string;
|
|
16
22
|
'error.generic': string;
|
|
23
|
+
'error.noteTooLarge': string;
|
|
17
24
|
};
|
|
18
25
|
/** The feedback namespace key union. */
|
|
19
26
|
export type MessageFeedbackKey = keyof typeof zh;
|
|
20
27
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
21
28
|
interface LocaleNamespaceMap {
|
|
22
|
-
/** The
|
|
29
|
+
/** The feedback surface's copy: the message controls, the dialog, and the acknowledgement. */
|
|
23
30
|
feedback: MessageFeedbackKey;
|
|
24
31
|
}
|
|
25
32
|
}
|
|
@@ -29,14 +36,21 @@ export declare const en: {
|
|
|
29
36
|
'action.likeActive': string;
|
|
30
37
|
'action.dislike': string;
|
|
31
38
|
'action.dislikeActive': string;
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
39
|
+
'dialog.title': string;
|
|
40
|
+
'dialog.categories': string;
|
|
41
|
+
'dialog.detail': string;
|
|
42
|
+
'dialog.hint': string;
|
|
43
|
+
'category.task-result': string;
|
|
44
|
+
'category.instruction-following': string;
|
|
45
|
+
'category.product-interaction': string;
|
|
46
|
+
'category.service-stability': string;
|
|
47
|
+
'category.resource-cost': string;
|
|
48
|
+
'category.security-privacy-permission': string;
|
|
49
|
+
'category.other': string;
|
|
50
|
+
'toast.recorded': string;
|
|
38
51
|
'error.conflict': string;
|
|
39
52
|
'error.load': string;
|
|
40
53
|
'error.generic': string;
|
|
54
|
+
'error.noteTooLarge': string;
|
|
41
55
|
};
|
|
42
56
|
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
* 'conversation.chat.assistant-actions'
|
|
4
|
-
*
|
|
5
|
-
* merge lives here. Live
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The injected faces of this package's two entries. The
|
|
3
|
+
* 'conversation.chat.assistant-actions' and 'conversation.input.overlay'
|
|
4
|
+
* slots are declared and typed by ui-chat and ui-conversation; this package
|
|
5
|
+
* only contributes entries, so no SlotMap merge lives here. Live state
|
|
6
|
+
* arrives through the `hooks` compartment (the framework standard kit binds
|
|
7
|
+
* `feedback` into `useFeedback` and `dialog` into `useDialog`).
|
|
8
8
|
* @module @deepseek-ai/dsh-client-ui-message-feedback/client/slots
|
|
9
9
|
*/
|
|
10
10
|
import type { HostObservable, InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
11
11
|
import type { MessageId } from '@deepseek-ai/dsh-api-remotes/client';
|
|
12
|
-
import type { MessageFeedbackRating } from '@deepseek-ai/dsh-message-feedback/types';
|
|
13
|
-
import type { MessageFeedbackActionResult, MessageFeedbackView } from './controller.ts';
|
|
12
|
+
import type { MessageFeedbackItem, MessageFeedbackRating } from '@deepseek-ai/dsh-message-feedback/types';
|
|
13
|
+
import type { MessageFeedbackActionResult, MessageFeedbackToggleResult, MessageFeedbackView } from './controller.ts';
|
|
14
|
+
import type { FeedbackDialogState } from './dialog.ts';
|
|
14
15
|
/** Injected business face of one assistant-message feedback entry. */
|
|
15
16
|
export interface MessageFeedbackInjected {
|
|
16
17
|
hooks: {
|
|
@@ -20,12 +21,10 @@ export interface MessageFeedbackInjected {
|
|
|
20
21
|
/** Load the Session's feedback once, on first interaction. */
|
|
21
22
|
ensure: () => Promise<MessageFeedbackActionResult>;
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* The committed item as this Session's controller last observed it.
|
|
24
25
|
* @param messageId - target assistant message.
|
|
25
|
-
* @param rating - desired judgment.
|
|
26
|
-
* @param note - optional explanation.
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
current: (messageId: MessageId) => MessageFeedbackItem | undefined;
|
|
29
28
|
/**
|
|
30
29
|
* Apply the requested judgment, retracting instead when the committed rating
|
|
31
30
|
* already matches. The controller decides from the committed item, so a click
|
|
@@ -33,18 +32,39 @@ export interface MessageFeedbackInjected {
|
|
|
33
32
|
* @param messageId - target assistant message.
|
|
34
33
|
* @param rating - the judgment the human asked for.
|
|
35
34
|
*/
|
|
36
|
-
toggle: (messageId: MessageId, rating: MessageFeedbackRating) => Promise<
|
|
35
|
+
toggle: (messageId: MessageId, rating: MessageFeedbackRating) => Promise<MessageFeedbackToggleResult>;
|
|
37
36
|
/**
|
|
38
|
-
*
|
|
37
|
+
* Open the Session's feedback dialog for one message; its submission
|
|
38
|
+
* records a negative judgment with the dialog's category and text.
|
|
39
39
|
* @param messageId - target assistant message.
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
* @param messageId - target assistant message.
|
|
45
|
-
*/
|
|
46
|
-
clear: (messageId: MessageId) => Promise<MessageFeedbackActionResult>;
|
|
41
|
+
openDialog: (messageId: MessageId) => void;
|
|
42
|
+
/** Show the Session's acknowledgement toast. */
|
|
43
|
+
acknowledge: () => void;
|
|
47
44
|
}
|
|
48
45
|
/** Full props of one assistant-message feedback entry. */
|
|
49
46
|
export type MessageFeedbackActionProps = PropsRuntime<'conversation.chat.assistant-actions'> & InjectFace<MessageFeedbackInjected> & PropsLocale<'feedback'>;
|
|
47
|
+
/** Injected business face of the Session's feedback dialog entry. */
|
|
48
|
+
export interface FeedbackDialogInjected {
|
|
49
|
+
hooks: {
|
|
50
|
+
/** The Session's dialog and toast state. */
|
|
51
|
+
dialog: HostObservable<FeedbackDialogState>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Replace part of the draft: the category (null clears it) or the text.
|
|
55
|
+
* @param draft - the members to replace.
|
|
56
|
+
*/
|
|
57
|
+
edit: (draft: Partial<Pick<FeedbackDialogState, 'category' | 'text'>>) => void;
|
|
58
|
+
/** Submit the draft to the open target. */
|
|
59
|
+
submit: () => Promise<void>;
|
|
60
|
+
/** Close the dialog and discard the draft. */
|
|
61
|
+
dismiss: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Retire the toast the view finished showing.
|
|
64
|
+
* @param seq - the toast sequence.
|
|
65
|
+
*/
|
|
66
|
+
dismissToast: (seq: number) => void;
|
|
67
|
+
}
|
|
68
|
+
/** Full props of the feedback dialog overlay entry. */
|
|
69
|
+
export type FeedbackDialogProps = InjectFace<FeedbackDialogInjected> & PropsLocale<'feedback'>;
|
|
50
70
|
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One Session's feedback surface: the message-feedback object layer and the
|
|
3
|
+
* dialog controller, plus the routing between them. A message target puts a
|
|
4
|
+
* negative judgment through the message controller; the Session target
|
|
5
|
+
* records through the `sessionFeedback` Remote.
|
|
6
|
+
* @module @deepseek-ai/dsh-client-ui-message-feedback/client/surface
|
|
7
|
+
*/
|
|
8
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
9
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
10
|
+
import { MessageFeedbackController } from './controller.ts';
|
|
11
|
+
import { FeedbackDialogController } from './dialog.ts';
|
|
12
|
+
/** The per-session pair behind every entry of one Session. */
|
|
13
|
+
export declare class FeedbackSurface {
|
|
14
|
+
private readonly ctx;
|
|
15
|
+
private readonly sessionId;
|
|
16
|
+
/** The Session's message-feedback object layer, shared by every message control. */
|
|
17
|
+
readonly feedback: MessageFeedbackController;
|
|
18
|
+
/** The Session's dialog and toast state, shared by the overlay entry and the message controls. */
|
|
19
|
+
readonly dialog: FeedbackDialogController;
|
|
20
|
+
/**
|
|
21
|
+
* @param ctx - the browser plugin context carrying both feedback Remotes.
|
|
22
|
+
* @param sessionId - Session owning the transcript and the remark.
|
|
23
|
+
*/
|
|
24
|
+
constructor(ctx: ClientContext, sessionId: SessionId);
|
|
25
|
+
/** Record one Session-level remark through the sessionFeedback Remote. */
|
|
26
|
+
private recordSession;
|
|
27
|
+
/** Drop both controllers when the owning fiber unloads. */
|
|
28
|
+
dispose(): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=surface.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-ui-message-feedback",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"description": "The Web feedback surface: per-message Like/Dislike in the assistant-message action strip and the feedback dialog behind Dislike and /feedback, backed by the messageFeedback and sessionFeedback Host Remotes",
|
|
4
|
+
"version": "0.1.5-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"@deepseek-ai/dsh-api-remotes",
|
|
32
32
|
"@deepseek-ai/dsh-client-locale",
|
|
33
33
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
34
|
-
"@deepseek-ai/dsh-client-ui-renderer"
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-commands"
|
|
35
36
|
],
|
|
36
37
|
"platform": "web"
|
|
37
38
|
}
|
|
@@ -46,20 +47,23 @@
|
|
|
46
47
|
"@types/react-dom": "~18.3.0",
|
|
47
48
|
"react": "^18.2.0",
|
|
48
49
|
"react-dom": "^18.2.0",
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-client-
|
|
52
|
-
"@deepseek-ai/dsh-client-
|
|
53
|
-
"@deepseek-ai/dsh-client-ui-
|
|
54
|
-
"@deepseek-ai/dsh-client-
|
|
55
|
-
"@deepseek-ai/dsh-client-ui-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.5-alpha.2",
|
|
51
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.5-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.5-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-client-test-runtime": "^0.1.5-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.5-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-session": "^0.1.5-alpha.2",
|
|
59
59
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
60
|
-
"@deepseek-ai/dsh-
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-chat": "^0.1.5-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.1.5-alpha.2",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-commands": "^0.1.5-alpha.2",
|
|
63
|
+
"@deepseek-ai/dsh-command-feedback": "^0.1.5-alpha.2",
|
|
64
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.5-alpha.2",
|
|
65
|
+
"@deepseek-ai/dsh-message-feedback": "^0.1.5-alpha.2",
|
|
66
|
+
"@deepseek-ai/dsh-client-store": "^0.1.5-alpha.2"
|
|
63
67
|
},
|
|
64
68
|
"files": [
|
|
65
69
|
"lib/index.js",
|