Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
0b8dcaba
Unverified
Commit
0b8dcaba
authored
Feb 18, 2024
by
TseIan
Committed by
GitHub
Feb 18, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chore: Add type files and unit test ci for Node.js SDK (#2268)
Co-authored-by:
xieweicheng
<
xieweicheng@bytedance.com
>
parent
af6a318a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
1 deletion
+107
-1
tool-test-sdks.yaml
.github/workflows/tool-test-sdks.yaml
+34
-0
index.d.ts
sdks/nodejs-client/index.d.ts
+71
-0
package.json
sdks/nodejs-client/package.json
+2
-1
No files found.
.github/workflows/tool-test-sdks.yaml
0 → 100644
View file @
0b8dcaba
name
:
Run Unit Test For SDKs
on
:
pull_request
:
branches
:
-
main
jobs
:
build
:
name
:
unit test for Node.js SDK
runs-on
:
ubuntu-latest
strategy
:
matrix
:
node-version
:
[
16
,
18
,
20
]
defaults
:
run
:
working-directory
:
sdks/nodejs-client
steps
:
-
uses
:
actions/checkout@v4
-
name
:
Use Node.js ${{ matrix.node-version }}
uses
:
actions/setup-node@v4
with
:
node-version
:
${{ matrix.node-version }}
cache
:
'
'
cache-dependency-path
:
'
yarn.lock'
-
name
:
Install Dependencies
run
:
yarn install
-
name
:
Test
run
:
yarn test
sdks/nodejs-client/index.d.ts
0 → 100644
View file @
0b8dcaba
// Types.d.ts
export
const
BASE_URL
:
string
;
export
type
RequestMethods
=
'GET'
|
'POST'
|
'PATCH'
|
'DELETE'
;
interface
Params
{
[
key
:
string
]:
any
;
}
interface
HeaderParams
{
[
key
:
string
]:
string
;
}
interface
User
{
}
interface
ChatMessageConfig
{
inputs
:
any
;
query
:
string
;
user
:
User
;
stream
?:
boolean
;
conversation_id
?:
string
|
null
;
files
?:
File
[]
|
null
;
}
export
declare
class
DifyClient
{
constructor
(
apiKey
:
string
,
baseUrl
?:
string
);
updateApiKey
(
apiKey
:
string
):
void
;
sendRequest
(
method
:
RequestMethods
,
endpoint
:
string
,
data
?:
any
,
params
?:
Params
,
stream
?:
boolean
,
headerParams
?:
HeaderParams
):
Promise
<
any
>
;
messageFeedback
(
message_id
:
string
,
rating
:
number
,
user
:
User
):
Promise
<
any
>
;
getApplicationParameters
(
user
:
User
):
Promise
<
any
>
;
fileUpload
(
data
:
FormData
):
Promise
<
any
>
;
}
export
declare
class
CompletionClient
extends
DifyClient
{
createCompletionMessage
(
inputs
:
any
,
user
:
User
,
stream
?:
boolean
,
files
?:
File
[]
|
null
):
Promise
<
any
>
;
}
export
declare
class
ChatClient
extends
DifyClient
{
createChatMessage
(
config
:
ChatMessageConfig
):
Promise
<
any
>
;
getConversationMessages
(
user
:
User
,
conversation_id
?:
string
,
first_id
?:
string
|
null
,
limit
?:
number
|
null
):
Promise
<
any
>
;
getConversations
(
user
:
User
,
first_id
?:
string
|
null
,
limit
?:
number
|
null
,
pinned
?:
boolean
|
null
):
Promise
<
any
>
;
renameConversation
(
conversation_id
:
string
,
name
:
string
,
user
:
User
):
Promise
<
any
>
;
deleteConversation
(
conversation_id
:
string
,
user
:
User
):
Promise
<
any
>
;
}
\ No newline at end of file
sdks/nodejs-client/package.json
View file @
0b8dcaba
{
"name"
:
"dify-client"
,
"version"
:
"2.2.
0
"
,
"version"
:
"2.2.
1
"
,
"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"
,
"types"
:
"index.d.ts"
,
"keywords"
:
[
"Dify"
,
"Dify.AI"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment