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
e1d22033
Unverified
Commit
e1d22033
authored
Nov 25, 2023
by
takatost
Committed by
GitHub
Nov 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: provider chatglm tests error (#1618)
parent
93467cb3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
test_chatglm_provider.py
...tests/unit_tests/model_providers/test_chatglm_provider.py
+7
-2
No files found.
api/tests/unit_tests/model_providers/test_chatglm_provider.py
View file @
e1d22033
...
...
@@ -2,7 +2,9 @@ import pytest
from
unittest.mock
import
patch
import
json
import
requests
from
langchain.schema
import
LLMResult
,
Generation
,
AIMessage
,
ChatResult
,
ChatGeneration
from
requests
import
Response
from
core.model_providers.providers.base
import
CredentialsValidateFailedError
from
core.model_providers.providers.chatglm_provider
import
ChatGLMProvider
...
...
@@ -26,8 +28,11 @@ def decrypt_side_effect(tenant_id, encrypted_key):
def
test_is_provider_credentials_valid_or_raise_valid
(
mocker
):
mocker
.
patch
(
'langchain.llms.chatglm.ChatGLM._call'
,
return_value
=
"abc"
)
mock_response
=
Response
()
mock_response
.
status_code
=
200
mock_response
.
_content
=
json
.
dumps
({
'models'
:
[]})
.
encode
(
'utf-8'
)
mocker
.
patch
(
'requests.get'
,
return_value
=
mock_response
)
MODEL_PROVIDER_CLASS
.
is_provider_credentials_valid_or_raise
(
VALIDATE_CREDENTIAL
)
...
...
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