isrpa 0.9.5__py3-none-any.whl → 0.9.7__py3-none-any.whl
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.
- isrpa/credentials.py +25 -1
- isrpa/llm_chat.py +24 -0
- {isrpa-0.9.5.dist-info → isrpa-0.9.7.dist-info}/METADATA +1 -1
- {isrpa-0.9.5.dist-info → isrpa-0.9.7.dist-info}/RECORD +6 -5
- {isrpa-0.9.5.dist-info → isrpa-0.9.7.dist-info}/WHEEL +0 -0
- {isrpa-0.9.5.dist-info → isrpa-0.9.7.dist-info}/top_level.txt +0 -0
isrpa/credentials.py
CHANGED
@@ -23,7 +23,7 @@ def store_key(key_name,key_value,user_name):
|
|
23
23
|
# 请求体的数据
|
24
24
|
data = {
|
25
25
|
'certificate_key': key_name,
|
26
|
-
'certificate_value': key_value,
|
26
|
+
'certificate_value': encode(key_value),
|
27
27
|
'user_name': user_name
|
28
28
|
}
|
29
29
|
print(data)
|
@@ -108,5 +108,29 @@ def exist(key_name, user_name):
|
|
108
108
|
|
109
109
|
return True
|
110
110
|
|
111
|
+
def encode(certificate_value):
|
112
|
+
"""
|
113
|
+
获取密钥
|
114
|
+
key_name:凭证key
|
115
|
+
"""
|
116
|
+
url = f"{address}/console/api/get_encode_credentials"
|
117
|
+
print(url)
|
118
|
+
headers = {
|
119
|
+
'Content-Type': 'application/json', # 说明请求体是 JSON 格式
|
120
|
+
}
|
121
|
+
# 请求体的数据
|
122
|
+
data = {
|
123
|
+
'certificate_value': certificate_value,
|
124
|
+
}
|
125
|
+
print(data)
|
126
|
+
response = requests.post(url, headers=headers, json=data)
|
127
|
+
if response.status_code != 200:
|
128
|
+
print("请求失败,状态码:", response.status_code)
|
129
|
+
print(response.text)
|
130
|
+
return "failure"
|
131
|
+
json = response.json()
|
132
|
+
return json['certificate_value']
|
133
|
+
|
134
|
+
|
111
135
|
if __name__ == '__main__':
|
112
136
|
print(exist("ccc","zhouly@i-search.com.cn"))
|
isrpa/llm_chat.py
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
from volcenginesdkarkruntime import Ark
|
2
|
+
#暂不统计消耗的token,后续要统计再改,无法传递token没法用dify的大模型,先保证这个功能能用起来
|
3
|
+
|
4
|
+
def ai_talk(input_str):
|
5
|
+
"""使用方舟SDK调用大模型API"""
|
6
|
+
try:
|
7
|
+
# 初始化客户端
|
8
|
+
client = Ark(api_key="f0f8b460-c4ea-42a4-a951-5e2e454022ee")
|
9
|
+
|
10
|
+
# 调用聊天补全API
|
11
|
+
completion = client.chat.completions.create(
|
12
|
+
model="deepseek-v3-250324",
|
13
|
+
messages=[
|
14
|
+
{"role": "user", "content": input_str}
|
15
|
+
],
|
16
|
+
max_tokens=512, # 最大生成token数
|
17
|
+
temperature=0.5 # 温度参数
|
18
|
+
)
|
19
|
+
|
20
|
+
# 返回AI生成的内容
|
21
|
+
return completion.choices[0].message.content
|
22
|
+
|
23
|
+
except Exception as e:
|
24
|
+
return f"ai_talk调用时出错: {str(e)}"
|
@@ -2,10 +2,11 @@ isrpa/OCR.py,sha256=nSDmVLo_z9GV7GUY57xBh2kumERG5_xtpUPxeF6ziQE,2509
|
|
2
2
|
isrpa/Template.py,sha256=UP1uovLvJzXEPGo_hzLrIYOu3vZP8Cf6m3G2hGzQ6XA,1958
|
3
3
|
isrpa/Template_Exception.py,sha256=an6eQ1NMB8a9R-J0yyMdwHIZcZeDtdV5f7fWKZQsZ3s,819
|
4
4
|
isrpa/__init__.py,sha256=pG-YPVG0gJIJ6s4xcAz9S_CnUxpUcz33wl9eNUSgxGk,20
|
5
|
-
isrpa/credentials.py,sha256=
|
5
|
+
isrpa/credentials.py,sha256=Qgitrm2pKgA1E_iGPg12Qq2Ka52pgTQCBHnT2U62ZHs,3999
|
6
|
+
isrpa/llm_chat.py,sha256=lrufXl2JnnezXPF3FOMmmQFbqMTLjhCy7ujJTWeu460,863
|
6
7
|
isrpa/message.py,sha256=N0s6hMaC5S-Pi4EhwcSp-ngfBTBQyW6ymU9sI9dUSeE,11329
|
7
8
|
isrpa/utils.py,sha256=uPCb1A1vDB0nTlII2BJz9kS0amk7mvzVA7ilI-UYA8Q,51439
|
8
|
-
isrpa-0.9.
|
9
|
-
isrpa-0.9.
|
10
|
-
isrpa-0.9.
|
11
|
-
isrpa-0.9.
|
9
|
+
isrpa-0.9.7.dist-info/METADATA,sha256=Y_yaHUXMpR5uicuMfDZ1Mh88aQF_ol7-yiDl-lOdHn0,511
|
10
|
+
isrpa-0.9.7.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
11
|
+
isrpa-0.9.7.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
|
12
|
+
isrpa-0.9.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|