ant-design-x-vue 0.0.7 → 0.0.9

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.
@@ -2,7 +2,7 @@ import type { CSSInterpolation, CSSObject, TokenType } from '../../cssinjs';
2
2
  import { useStyleRegister } from '../../cssinjs';
3
3
  import type { ComponentTokenKey, GlobalTokenWithComponent, TokenMap, TokenMapKey, UseComponentStyleResult } from '../interface';
4
4
  import type AbstractCalculator from './calc/calculator';
5
- import { MaybeRefOrGetter, type VNode } from 'vue';
5
+ import { type MaybeRefOrGetter, type VNode } from 'vue';
6
6
  import type { UseCSP } from '../hooks/useCSP';
7
7
  import type { UsePrefix } from '../hooks/usePrefix';
8
8
  import type { UseToken } from '../hooks/useToken';
@@ -8,3 +8,4 @@ export * from './attachments';
8
8
  export * from './thought-chain';
9
9
  export * from './x-stream';
10
10
  export * from './x-request';
11
+ export * from './use-x-agent';
@@ -1,5 +1,5 @@
1
- import { ComputedRef } from "vue";
2
- import { ThoughtChainNodeContextProps } from "./interface";
1
+ import { type ComputedRef } from "vue";
2
+ import type { ThoughtChainNodeContextProps } from "./interface";
3
3
  export declare const globalThoughtChainNodeContextApi: import("vue").ShallowRef<ThoughtChainNodeContextProps, ThoughtChainNodeContextProps>;
4
4
  export declare const useThoughtChainNodeContextProvider: (value: ComputedRef<ThoughtChainNodeContextProps>) => void;
5
5
  export declare const useThoughtChainNodeContextInject: () => ComputedRef<ThoughtChainNodeContextProps>;
@@ -0,0 +1,4 @@
1
+ import useXAgent, { XAgent } from './use-x-agent';
2
+ export type { RequestFn, XAgentConfigPreset, XAgentConfigCustom, XAgentConfig } from './use-x-agent';
3
+ export { useXAgent, XAgent };
4
+ export default useXAgent;
@@ -0,0 +1,33 @@
1
+ import type { AnyObject } from '../_util/type';
2
+ interface RequestFnInfo<Message> extends Partial<XAgentConfigPreset>, AnyObject {
3
+ messages?: Message[];
4
+ message?: Message;
5
+ }
6
+ export type RequestFn<Message> = (info: RequestFnInfo<Message>, callbacks: {
7
+ onUpdate: (message: Message) => void;
8
+ onSuccess: (message: Message) => void;
9
+ onError: (error: Error) => void;
10
+ }) => void;
11
+ export interface XAgentConfigPreset {
12
+ baseURL: string;
13
+ key: string;
14
+ model: string;
15
+ dangerouslyApiKey: string;
16
+ }
17
+ export interface XAgentConfigCustom<Message> {
18
+ request?: RequestFn<Message>;
19
+ }
20
+ export type XAgentConfig<Message> = Partial<XAgentConfigPreset> & XAgentConfigCustom<Message>;
21
+ /** This is a wrap class to avoid developer can get too much on origin object */
22
+ export declare class XAgent<Message = string> {
23
+ config: XAgentConfig<Message>;
24
+ private requestingMap;
25
+ constructor(config: XAgentConfig<Message>);
26
+ private finishRequest;
27
+ request: RequestFn<Message>;
28
+ isRequesting(): boolean;
29
+ }
30
+ export default function useXAgent<Message = string>(config: XAgentConfig<Message>): {
31
+ agent: import("vue").ComputedRef<XAgent<Message>>;
32
+ };
33
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ant-design-x-vue",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "A vue library developed with dumi",
5
5
  "scripts": {
6
6
  "build": "vite build && vue-tsc --project ./tsconfig.build.json",