Skip to content

Commit

Permalink
🐛 fix: refactor and fix the react usage to client exports (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Sep 6, 2023
1 parent 78778d9 commit cb5e5e1
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 14 deletions.
100 changes: 100 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,106 @@

# Changelog

### [Version 1.16.1-alpha.4](https://github.com/lobehub/chat-plugin-sdk/compare/v1.16.1-alpha.3...v1.16.1-alpha.4)

<sup>Released on **2023-09-06**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor to client mode.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

- **misc**: Refactor to client mode ([035a990](https://github.com/lobehub/chat-plugin-sdk/commit/035a990))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.16.1-alpha.3](https://github.com/lobehub/chat-plugin-sdk/compare/v1.16.1-alpha.2...v1.16.1-alpha.3)

<sup>Released on **2023-09-06**</sup>

#### 🐛 Bug Fixes

- **misc**: Try to fix build.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **misc**: Try to fix build ([0887276](https://github.com/lobehub/chat-plugin-sdk/commit/0887276))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.16.1-alpha.2](https://github.com/lobehub/chat-plugin-sdk/compare/v1.16.1-alpha.1...v1.16.1-alpha.2)

<sup>Released on **2023-09-06**</sup>

#### 🐛 Bug Fixes

- **misc**: Try to fix build.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **misc**: Try to fix build ([abda1a2](https://github.com/lobehub/chat-plugin-sdk/commit/abda1a2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.16.1-alpha.1](https://github.com/lobehub/chat-plugin-sdk/compare/v1.16.0...v1.16.1-alpha.1)

<sup>Released on **2023-09-06**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix export.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **misc**: Fix export ([9834327](https://github.com/lobehub/chat-plugin-sdk/commit/9834327))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

## [Version 1.16.0](https://github.com/lobehub/chat-plugin-sdk/compare/v1.15.2...v1.16.0)

<sup>Released on **2023-09-05**</sup>
Expand Down
1 change: 1 addition & 0 deletions client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './es/client';
1 change: 1 addition & 0 deletions client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './es/client';
2 changes: 1 addition & 1 deletion docs/api/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const fetchPluginMessage = <T = any>() => Promise<T>;
### 示例

```ts
import { fetchPluginMessage } from '@lobehub/chat-plugin-sdk';
import { fetchPluginMessage } from '@lobehub/chat-plugin-sdk/client';

fetchPluginMessage()
.then((message) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/api/use-watch-plugin-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { data, loading } = useWatchPluginMessage<T>();
## 示例

```tsx | pure
import { useWatchPluginMessage } from '@lobehub/chat-plugin-sdk';
import { useWatchPluginMessage } from '@lobehub/chat-plugin-sdk/client';

const Demo = () => {
const { data, loading } = useWatchPluginMessage();
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lobehub/chat-plugin-sdk",
"version": "1.16.0",
"version": "1.16.1-alpha.4",
"description": "Lobe Chat Plugin SDK, help you to build an amazing chat plugin for Lobe Chat",
"keywords": [
"lobehub",
Expand All @@ -21,12 +21,14 @@
"license": "MIT",
"author": "LobeHub <[email protected]>",
"sideEffects": false,
"main": "lib/index.js",
"module": "es/index.js",
"types": "lib/index.d.ts",
"main": "./lib/index.js",
"module": "./es/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib",
"es"
"es",
"client.d.ts",
"client.js"
],
"scripts": {
"build": "father build",
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/render/index.ts → src/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './const';
export * from './hooks';
export { fetchPluginMessage } from './message';
export * from './type';
export * from './useWatchPluginMessage';
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions src/render/hooks.ts → src/client/useWatchPluginMessage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useEffect, useState } from 'react';

import { PluginRenderProps } from '@/types';

import { PluginChannel } from './const';
import { PluginRenderProps } from './type';
import { onReceiveData } from './utils';

export const useWatchPluginMessage = <T = any>() => {
Expand Down
3 changes: 1 addition & 2 deletions src/render/utils.ts → src/client/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { PluginRenderProps } from '@/types';

import { PluginChannel } from './const';
import { PluginRenderProps } from './type';

export const onReceiveData = <T>(e: MessageEvent, onData: (data: PluginRenderProps<T>) => void) => {
if (e.data.type === PluginChannel.renderPlugin) {
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './error';
export * from './render';
export * from './request';
export * from './schema/manifest';
export * from './schema/market';
Expand Down
1 change: 0 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './chatGPT';
export * from './client';
export * from './manifest';
export * from './market';

0 comments on commit cb5e5e1

Please sign in to comment.