resolve conflict

This commit is contained in:
crazywoola 2023-05-14 18:27:40 +08:00
commit 9ccaaa04c3
3 changed files with 16 additions and 18 deletions

View File

@ -1,20 +1,19 @@
# LangGenius Node.js SDK
This is the Node.js SDK for the LangGenius API, which allows you to easily integrate LangGenius into your Node.js applications.
# Dify Node.js SDK
This is the Node.js SDK for the Dify API, which allows you to easily integrate Dify into your Node.js applications.
## Install
```bash
npm install langgenius-client
npm install dify-client
```
## Usage
After installing the SDK, you can use it in your project like this:
```js
import { LangGeniusClient, ChatClient, CompletionClient } from 'langgenius-client'
import { DifyClient, ChatClient, CompletionClient } from 'dify-client'
const API_KEY = 'your-api-key-here';
const APP_ID = 'your-app-id-here';
const user = `user_${APP_ID}:user_id`:
const user = `random-user-id`:
// Create a completion client
const completionClient = new CompletionClient(API_KEY)
@ -33,15 +32,15 @@ chatClient.getConversationMessages(conversationId, user)
chatClient.renameConversation(conversationId, name, user)
const langGeniusClient = new LangGeniusClient(API_KEY)
const client = new DifyClient(API_KEY)
// Fetch application parameters
langGeniusClient.getApplicationParameters(user)
client.getApplicationParameters(user)
// Provide feedback for a message
langGeniusClient.messageFeedback(messageId, rating, user)
client.messageFeedback(messageId, rating, user)
```
Replace 'your-api-key-here' with your actual LangGenius API key.Replace 'your-app-id-here' with your actual LangGenius APP ID.
Replace 'your-api-key-here' with your actual Dify API key.Replace 'your-app-id-here' with your actual Dify APP ID.
## License
This SDK is released under the MIT License.
This SDK is released under the MIT License.

View File

@ -5,7 +5,7 @@ export const BASE_URL = 'https://api.dify.ai/v1'
export const routes = {
application: {
method: 'GET',
url: () => `parameters`
url: () => `/parameters`
},
feedback: {
method: 'POST',
@ -33,7 +33,7 @@ export const routes = {
}
}
export class LangGeniusClient {
export class DifyClient {
constructor(apiKey, baseUrl = BASE_URL) {
this.apiKey = apiKey
this.baseUrl = baseUrl
@ -85,7 +85,7 @@ export class LangGeniusClient {
}
}
export class CompletionClient extends LangGeniusClient {
export class CompletionClient extends DifyClient {
createCompletionMessage(inputs, query, user, responseMode) {
const data = {
inputs,
@ -97,7 +97,7 @@ export class CompletionClient extends LangGeniusClient {
}
}
export class ChatClient extends LangGeniusClient {
export class ChatClient extends DifyClient {
createChatMessage(inputs, query, user, responseMode = 'blocking', conversationId = null) {
const data = {
inputs,

View File

@ -1,11 +1,10 @@
{
"name": "langgenius-client",
"version": "1.1.1",
"name": "dify-client",
"version": "1.0.2",
"description": "This is the Node.js SDK for the Dify.AI API, which allows you to easily integrate Dify.AI into your Node.js applications.",
"main": "index.js",
"type": "module",
"keywords": [
"LangGenius",
"Dify.AI",
"LLM"
],