bugfix
This commit is contained in:
parent
a6ba382241
commit
2ae61f7698
@ -1,50 +0,0 @@
|
|||||||
# API tools
|
|
||||||
this tool read api specific file in json format, and generates python code
|
|
||||||
## json file format
|
|
||||||
{
|
|
||||||
"apiname":API name
|
|
||||||
"title":API descriptions
|
|
||||||
"description":
|
|
||||||
"data":{
|
|
||||||
}
|
|
||||||
mapis:{
|
|
||||||
methodname:mapi #each methos a key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mapi has following format
|
|
||||||
{
|
|
||||||
"title":name of the api
|
|
||||||
"descriptions":"description of the api
|
|
||||||
"url":call url for this api
|
|
||||||
"method":http method
|
|
||||||
"headers":haed need to set to
|
|
||||||
"params":data will sent to api server
|
|
||||||
"response_type":json, file,
|
|
||||||
"response_error_type":"json"
|
|
||||||
"response":resposne return from api server
|
|
||||||
"error_field":
|
|
||||||
"error_text_field":
|
|
||||||
"returnData":[
|
|
||||||
{
|
|
||||||
"field":"sssss",
|
|
||||||
"name":"ggggg"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
## header, params, response format
|
|
||||||
{
|
|
||||||
name:
|
|
||||||
type:
|
|
||||||
required:
|
|
||||||
value:
|
|
||||||
description
|
|
||||||
}
|
|
||||||
|
|
||||||
## data in json file
|
|
||||||
Use ${name} format to refer the data in API's data object,
|
|
||||||
if name is not in data, replace ${name} as ""
|
|
||||||
|
|
||||||
## method call logic
|
|
||||||
this tool just build all the method api function for coder, and not call logic implement
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
apikey='eda4e3707f734f1e955d7bba6ebe68d1'
|
|
||||||
apikey2='a9250a0802864b889f882e0751b73807'
|
|
||||||
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Sage 冷备配置 — 修改 STANDBY_IP 后即可使用
|
|
||||||
# 生成时间: 2026-07-04
|
|
||||||
|
|
||||||
# ===== 主机(当前生产) =====
|
|
||||||
PRIMARY_IP="192.168.16.2"
|
|
||||||
PRIMARY_DB_PORT=3306
|
|
||||||
PRIMARY_SAGE_DIR="/d/ymq/repos/sage"
|
|
||||||
PRIMARY_FILES_DIR="${PRIMARY_SAGE_DIR}/files"
|
|
||||||
|
|
||||||
# ===== 备机(必填!) =====
|
|
||||||
STANDBY_IP="" # <-- 改成你的备机 IP
|
|
||||||
STANDBY_SSH_USER="root"
|
|
||||||
STANDBY_SSH_PORT=22
|
|
||||||
STANDBY_SAGE_DIR="/d/ymq/repos/sage"
|
|
||||||
STANDBY_FILES_DIR="${STANDBY_SAGE_DIR}/files"
|
|
||||||
|
|
||||||
# ===== 数据库复制账号 =====
|
|
||||||
REPL_USER="repl"
|
|
||||||
REPL_PASSWORD="Repl...n
|
|
||||||
# ===== lsyncd =====
|
|
||||||
LSYNCD_CONF="/etc/lsyncd/lsyncd.conf.lua"
|
|
||||||
LSYNCD_LOG="/var/log/lsyncd.log"
|
|
||||||
|
|
||||||
# ===== 健康检查 =====
|
|
||||||
HEALTH_CHECK_INTERVAL=10
|
|
||||||
MAX_FAIL_COUNT=3
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# AccessKey = "ALTAKpUCiGSkgJE32uxNACxzZ2"
|
|
||||||
# AccessKeySecret = "2fec1ab19ded48efb81b4564e6986e15"
|
|
||||||
AccessKey = "SjAN4GHU07LuB8ZYOIstB31G"
|
|
||||||
AccessKeySecret = "QbakADoGJsM2qjUzIogTkBZruToxYAve"
|
|
||||||
@ -1,138 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
import ak
|
|
||||||
from appPublic.oauth_client import OAuthClient
|
|
||||||
desc = {
|
|
||||||
"data":{
|
|
||||||
"APIKey":ak.AccessKey,
|
|
||||||
"SecretKey":ak.AccessKeySecret
|
|
||||||
},
|
|
||||||
"mapis":{
|
|
||||||
"get_access_token":{
|
|
||||||
"url":"https://aip.baidubce.com/oauth/2.0/token",
|
|
||||||
"method":"POST",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"grant_type",
|
|
||||||
"value":"client_credentials"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"client_id",
|
|
||||||
"value":"${APIKey}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"client_secret",
|
|
||||||
"value":"${SecretKey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resposne_type":"2",
|
|
||||||
"error_field":"error",
|
|
||||||
"error_msg_field":"error_description",
|
|
||||||
"resp_set_data":[
|
|
||||||
{
|
|
||||||
"field":"access_token",
|
|
||||||
"name":"AccessToken"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field":"expires_in",
|
|
||||||
"name":"TokenExpiresIn"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"chat":{
|
|
||||||
"url":"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro",
|
|
||||||
# "url":"http://localhost/test/show.dspy",
|
|
||||||
"method":"POST",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"access_token",
|
|
||||||
"value":"${AccessToken}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"name":"messages",
|
|
||||||
"value":"${messages}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"temperature",
|
|
||||||
"value":0.1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"top_p",
|
|
||||||
"value":0.8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"penalty_score",
|
|
||||||
"value":1.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"stream",
|
|
||||||
"value":False
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"system",
|
|
||||||
"value":"开元云助手"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"stop",
|
|
||||||
"value":[]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"max_output_token",
|
|
||||||
"value":2048
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resposne_type":"2",
|
|
||||||
"error_field":"error",
|
|
||||||
"error_msg_field":"error_description",
|
|
||||||
"resp_set_data":[
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async def main(desc):
|
|
||||||
qianfanapi = OAuthClient(desc)
|
|
||||||
r = await qianfanapi('get_access_token', {})
|
|
||||||
print(f'get_access_token: response={r}, data={qianfanapi.data}')
|
|
||||||
msgs = []
|
|
||||||
while True:
|
|
||||||
print('prompt:')
|
|
||||||
p = input()
|
|
||||||
if p == '':
|
|
||||||
continue
|
|
||||||
if p == 'quit':
|
|
||||||
break
|
|
||||||
msg = {
|
|
||||||
"role":"user",
|
|
||||||
"content":p
|
|
||||||
}
|
|
||||||
msgs.append(msg)
|
|
||||||
r = await qianfanapi('chat',{"messages":msgs})
|
|
||||||
try:
|
|
||||||
print(r['result'])
|
|
||||||
msg = {
|
|
||||||
"role":"assistant",
|
|
||||||
"content":r['result']
|
|
||||||
}
|
|
||||||
msgs.append(msg)
|
|
||||||
except Exception as e:
|
|
||||||
print(r, e)
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
asyncio.get_event_loop().run_until_complete(main(desc))
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
from appPublic.worker import awaitify
|
|
||||||
from ahserver.serverEnv import ServerEnv
|
|
||||||
from transformers import AutoTokenizer, AutoModel
|
|
||||||
|
|
||||||
class ChatGLM3:
|
|
||||||
def __init__(self, model_path, gpu=False):
|
|
||||||
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
|
||||||
model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
|
|
||||||
if gpu:
|
|
||||||
model = model.cuda()
|
|
||||||
else:
|
|
||||||
model = model.float()
|
|
||||||
model = model.eval()
|
|
||||||
self.model = model
|
|
||||||
self.tokenizer = tokenizer
|
|
||||||
|
|
||||||
def _generate(self, prompt, history=[]):
|
|
||||||
response, history = self.model.chat(self.tokenizer, prompt, history=history)
|
|
||||||
return response, history
|
|
||||||
|
|
||||||
generate = awaitify(_generate)
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
transformers==4.30.2
|
|
||||||
protobuf
|
|
||||||
cpm_kernels
|
|
||||||
torch>=2.0
|
|
||||||
sentencepiece
|
|
||||||
accelerate
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
||||||
tokenizer = AutoTokenizer.from_pretrained("codellama/CodeLlama-7b-hf")
|
|
||||||
tokenizer.save_pretrained('CodeLlama-7b-tokenizer')
|
|
||||||
model = AutoModelForCausalLM.from_pretrained("codellama/CodeLlama-7b-hf")
|
|
||||||
model.save_pretrained('CodeLlama-7b-model')
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
text = params_kw.get('text')
|
|
||||||
lang = params_kw.get('lang', 'cn')
|
|
||||||
if lang == cn:
|
|
||||||
b = await cn_tts.generate(text)
|
|
||||||
return b
|
|
||||||
if lang == en:
|
|
||||||
b = await en_tts.generate(text)
|
|
||||||
return b
|
|
||||||
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
from apppublic.worker import awaitify
|
|
||||||
from coquitts.coqui import CoquiTTS
|
|
||||||
|
|
||||||
g = ServerEnv()
|
|
||||||
# e = CoquiTTS('tts_models/en/ljspeech/vits--neon')
|
|
||||||
# g.en_tts = e
|
|
||||||
e = CoquiTTS('tts_models/zh-CN/baker/tacotron2-DDC-GST')
|
|
||||||
g.cn_tts = e
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import asyncio
|
|
||||||
b = await e.generate('你好吗?我很好。')
|
|
||||||
with open('w.wav','wb') as f:
|
|
||||||
f.write(b)
|
|
||||||
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
# code from https://platform.openai.com/docs/tutorials/web-qa-embeddings
|
|
||||||
import pandas as pd
|
|
||||||
import tiktoken
|
|
||||||
|
|
||||||
max_tokens = 500
|
|
||||||
|
|
||||||
# Function to split the text into chunks of a maximum number of tokens
|
|
||||||
def split_into_many(text, max_tokens = max_tokens):
|
|
||||||
# Split the text into sentences
|
|
||||||
sentences = text.split('. ')
|
|
||||||
|
|
||||||
# Get the number of tokens for each sentence
|
|
||||||
n_tokens = [len(tokenizer.encode(" " + sentence)) for sentence in sentences]
|
|
||||||
|
|
||||||
chunks = []
|
|
||||||
tokens_so_far = 0
|
|
||||||
chunk = []
|
|
||||||
|
|
||||||
# Loop through the sentences and tokens joined together in a tuple
|
|
||||||
for sentence, token in zip(sentences, n_tokens):
|
|
||||||
|
|
||||||
# If the number of tokens so far plus the number of tokens in the current sentence is greater
|
|
||||||
# than the max number of tokens, then add the chunk to the list of chunks and reset
|
|
||||||
# the chunk and tokens so far
|
|
||||||
if tokens_so_far + token > max_tokens:
|
|
||||||
chunks.append(". ".join(chunk) + ".")
|
|
||||||
chunk = []
|
|
||||||
tokens_so_far = 0
|
|
||||||
|
|
||||||
# If the number of tokens in the current sentence is greater than the max number of
|
|
||||||
# tokens, go to the next sentence
|
|
||||||
if token > max_tokens:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Otherwise, add the sentence to the chunk and add the number of tokens to the total
|
|
||||||
chunk.append(sentence)
|
|
||||||
tokens_so_far += token + 1
|
|
||||||
|
|
||||||
return chunks
|
|
||||||
|
|
||||||
def remove_newlines(serie):
|
|
||||||
serie = serie.str.replace('\n', ' ')
|
|
||||||
serie = serie.str.replace('\\n', ' ')
|
|
||||||
serie = serie.str.replace(' ', ' ')
|
|
||||||
serie = serie.str.replace(' ', ' ')
|
|
||||||
return serie
|
|
||||||
|
|
||||||
class EmbeddingsBuilder:
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def txt2csv(self, sourcePath, csvfile):
|
|
||||||
# Create a list to store the text files
|
|
||||||
texts=[]
|
|
||||||
# Get all the text files in the text directory
|
|
||||||
for file in os.listdir(sourcePath):
|
|
||||||
# Open the file and read the text
|
|
||||||
with open(sourcePath + file, "r", encoding="UTF-8") as f:
|
|
||||||
text = f.read()
|
|
||||||
# Omit the first 11 lines and the last 4 lines, then replace -, _, and #update with spaces.
|
|
||||||
texts.append((file, text))
|
|
||||||
|
|
||||||
# Create a dataframe from the list of texts
|
|
||||||
df = pd.DataFrame(texts, columns = ['title', 'text'])
|
|
||||||
# Set the text column to be the raw text with the newlines removed
|
|
||||||
df['text'] = df.fname + ". " + remove_newlines(df.text)
|
|
||||||
|
|
||||||
# Load the cl100k_base tokenizer which is designed to work with the ada-002 model
|
|
||||||
tokenizer = tiktoken.get_encoding("cl100k_base")
|
|
||||||
# Tokenize the text and save the number of tokens to a new column
|
|
||||||
df['n_tokens'] = df.text.apply(lambda x: len(tokenizer.encode(x)))
|
|
||||||
shortened = []
|
|
||||||
# Loop through the dataframe
|
|
||||||
for row in df.iterrows():
|
|
||||||
# If the text is None, go to the next row
|
|
||||||
if row[1]['text'] is None:
|
|
||||||
continue
|
|
||||||
# If the number of tokens is greater than the max number of tokens, split the text into chunks
|
|
||||||
if row[1]['n_tokens'] > max_tokens:
|
|
||||||
shortened += split_into_many(row[1]['text'])
|
|
||||||
# Otherwise, add the text to the list of shortened texts
|
|
||||||
else:
|
|
||||||
shortened.append( row[1]['text'] )
|
|
||||||
df = pd.DataFrame(shortened, columns = ['text'])
|
|
||||||
df['n_tokens'] = df.text.apply(lambda x: len(tokenizer.encode(x)))
|
|
||||||
|
|
||||||
df.to_csv(csvfile)
|
|
||||||
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
import time
|
|
||||||
from fastchat.serve.inference import ChatIO
|
|
||||||
from fastchat.model.model_adapter import (
|
|
||||||
load_model,
|
|
||||||
# get_conversation_template,
|
|
||||||
get_generate_stream_function,
|
|
||||||
)
|
|
||||||
from ahserver.serverenv import ServerEnv
|
|
||||||
from appPublic.worker import awaitify
|
|
||||||
|
|
||||||
class FastChatModel:
|
|
||||||
def __init__(self, model_path, device='cpu',
|
|
||||||
temperature=1.0,
|
|
||||||
context_len=100000,
|
|
||||||
debug=False
|
|
||||||
):
|
|
||||||
self.model_path = model_path
|
|
||||||
self.device = device
|
|
||||||
self.debug = debug
|
|
||||||
self.temperature=temperature
|
|
||||||
self.context_len = context_len
|
|
||||||
self.model, self.tokenizer = load_model(
|
|
||||||
model_path,
|
|
||||||
device=device,
|
|
||||||
debug=debug
|
|
||||||
)
|
|
||||||
self.generate_stream_func = get_generate_stream_function(self.model, self.model_path)
|
|
||||||
|
|
||||||
def _generate(self, prompt):
|
|
||||||
gen_params = {
|
|
||||||
"model": self.model_path,
|
|
||||||
"prompt": prompt,
|
|
||||||
"temperature": self.temperature,
|
|
||||||
"max_new_tokens": self.context_len,
|
|
||||||
"stream":False,
|
|
||||||
"echo": False,
|
|
||||||
}
|
|
||||||
|
|
||||||
output_stream = self.generate_stream_func(
|
|
||||||
self.model,
|
|
||||||
self.tokenizer,
|
|
||||||
gen_params,
|
|
||||||
self.device,
|
|
||||||
context_len=self.context_len
|
|
||||||
)
|
|
||||||
t = time.time()
|
|
||||||
output = ''
|
|
||||||
for i,s in enumerate(output_stream):
|
|
||||||
if self.debug:
|
|
||||||
print(i, ':', s['text'], '\n')
|
|
||||||
return s['text']
|
|
||||||
|
|
||||||
generate = awaitify(_generate)
|
|
||||||
|
|
||||||
g = ServerEnv()
|
|
||||||
# m = FastChatModel('./vicuna-7b-v1.5', device='mps')
|
|
||||||
# m = FastChatModel('/Users/ymq/models/hub/CodeLlama-13b-Instruct-hf')
|
|
||||||
m = FastChatModel('/Users/ymq/models/hub/CodeLlama-13-hf')
|
|
||||||
g.fschat = m
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import asyncio
|
|
||||||
async def main():
|
|
||||||
while True:
|
|
||||||
print('input prompt:')
|
|
||||||
p = input()
|
|
||||||
x = await m.generate(p)
|
|
||||||
print(f'answer:\n{x}')
|
|
||||||
|
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
|
||||||
@ -1 +0,0 @@
|
|||||||
fschat
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
prompt = params_kw.get('prompt')
|
|
||||||
return await gpt4all_engine.generate(prompt)
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
from gpt4all import GPT4All
|
|
||||||
from ahserver.serverenv import ServerEnv
|
|
||||||
from appPublic.worker import awaitify
|
|
||||||
|
|
||||||
class GadgetGpt4all:
|
|
||||||
def __init__(self, model_name):
|
|
||||||
self.model_name = model_name
|
|
||||||
self.model = GPT4All(model_name,device='intel')
|
|
||||||
# device='amd', device='intel'
|
|
||||||
|
|
||||||
def _generate(text):
|
|
||||||
return self.model.generate(text, max_tokens=10000000)
|
|
||||||
|
|
||||||
generate = awaitify(_generate)
|
|
||||||
|
|
||||||
g = ServerEnv()
|
|
||||||
m = GadgetGpt4all('orca-mini-3b-gguf2-q4_0.gguf')
|
|
||||||
g.gpt4all_model = m
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import asyncio
|
|
||||||
asyncio.get_event_loop().run_until_complete(g.generate('what is the color of lotus'))
|
|
||||||
|
|
||||||
output = model.generate("The capital of France is ", max_tokens=3)
|
|
||||||
print(output)
|
|
||||||
@ -1 +0,0 @@
|
|||||||
gpt4all
|
|
||||||
17
initln
17
initln
@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
for m in apppublic sqlor ahserver accounting appbase basellm filemgr msp platformbiz rag rbac uapi
|
|
||||||
do
|
|
||||||
echo $m ...............
|
|
||||||
cd ~/py/$m
|
|
||||||
git pull
|
|
||||||
if [ -f "setup.cfg" ];then
|
|
||||||
pip install .
|
|
||||||
fi
|
|
||||||
if [ -d "json" ];then
|
|
||||||
cd ~/py/$m/json
|
|
||||||
sh ./build.sh
|
|
||||||
cd ~/py/sage/wwwroot
|
|
||||||
ln -s ~/py/$m/wwwroot $m
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@ -1469,7 +1469,7 @@ paths="""/ any
|
|||||||
/imgs/setting.svg any
|
/imgs/setting.svg any
|
||||||
/imgs/userrole.svg any
|
/imgs/userrole.svg any
|
||||||
/appbase/get_code.dspy logined
|
/appbase/get_code.dspy logined
|
||||||
/appbase/get_icon.dspy logined
|
/appbase/show_icon.dspy logined
|
||||||
/shell_theme.css any
|
/shell_theme.css any
|
||||||
/shell_theme.js any
|
/shell_theme.js any
|
||||||
/download/** logined
|
/download/** logined
|
||||||
|
|||||||
Binary file not shown.
267
minimax/api.py
267
minimax/api.py
@ -1,267 +0,0 @@
|
|||||||
from appPublic.dictObject import DictObject
|
|
||||||
from appPublic.oauth_client import OAuthClient
|
|
||||||
api_desc = {
|
|
||||||
"data":{
|
|
||||||
"apikey":'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJHcm91cE5hbWUiOiJtb3FpbmcgeXUiLCJVc2VyTmFtZSI6Im1vcWluZyB5dSIsIkFjY291bnQiOiIiLCJTdWJqZWN0SUQiOiIxNzY4NTM3NjQ1ODMyNDg3NjAyIiwiUGhvbmUiOiIxMzgwMTAxNTI5MiIsIkdyb3VwSUQiOiIxNzY4NTM3NjQ1ODI4MjkyOTMwIiwiUGFnZU5hbWUiOiIiLCJNYWlsIjoiIiwiQ3JlYXRlVGltZSI6IjIwMjQtMDQtMTAgMTg6MDA6NTMiLCJpc3MiOiJtaW5pbWF4In0.VaRRHr9XMUSYhZOKVS2PRZv6Y9VCaW4JX2ks4QZX3aFr_emjnDbGv5HfNskf54piflEAeTMW4Qw1nG7bqhYea7N5LKHGf0YpesPGSoqxwyZUR4oaJNNVUsSe6eiLbdYSDO2wMb_hV5xyawh-lYe1reBKWaPVuOjfTrDhxzA0IBmzl-jAQhL8-kIZet2uX-p3NjxElpo_zjmVV_hA1BJEvTwuAk8ka-1SBZmXciMhBi1fJG4jcqoHCCN_JHJ7pgjKr5bk2Zw5qCqiU2Ecsc-kPIEK1SI5EYoLszT43UpJ8_wV4Pm07UBCn3vktAa0fjKDSUArPkBoYWSkgKDMWlmxig',
|
|
||||||
"group_id":'1768537645828292930'
|
|
||||||
},
|
|
||||||
"sub_account":{
|
|
||||||
"path":"/v1/sub_account",
|
|
||||||
"method":"POST",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Authorization",
|
|
||||||
"value":"Bearer ${apikey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"GroupId",
|
|
||||||
"value":"${group_id}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"name":"account_name",
|
|
||||||
"value":"${account_name}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resp":[
|
|
||||||
{
|
|
||||||
"name":"subject_id",
|
|
||||||
"resp_keys":"subject_id"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"account_name",
|
|
||||||
"resp_keys":"account",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"password",
|
|
||||||
"resp_keys":"password"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"group_id",
|
|
||||||
"resp_keys":"group_id"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"apikey",
|
|
||||||
"resp_keys":"token"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_if":{
|
|
||||||
"error_keys":"base_resp.status_code",
|
|
||||||
"op":"!=",
|
|
||||||
"value":0,
|
|
||||||
"code_keys":"base_resp.status_code",
|
|
||||||
"msg_keys":"base_resp.status_msg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sub_delete":{
|
|
||||||
"path":"/v1/sub_account/${sub_account_id}",
|
|
||||||
"method":"DELETE",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Authorization",
|
|
||||||
"value":"Bearer ${apikey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"GroupId",
|
|
||||||
"value":"${group_id}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_if":{
|
|
||||||
"error_keys":"base_resp.status_code",
|
|
||||||
"op":"!=",
|
|
||||||
"value":0,
|
|
||||||
"code_keys":"base_resp.status_code",
|
|
||||||
"msg_keys":"base_resp.status_msg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"change_sub_status":{
|
|
||||||
"path":"/v1/sub_account/${sub_account_id}/status",
|
|
||||||
"method":"PUT",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Authorization",
|
|
||||||
"value":"Bearer ${apikey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"GroupId",
|
|
||||||
"value":"${group_id}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"name":"status",
|
|
||||||
"value":"${status}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_if":{
|
|
||||||
"error_keys":"base_resp.status_code",
|
|
||||||
"op":"!=",
|
|
||||||
"value":0,
|
|
||||||
"code_keys":"base_resp.status_code",
|
|
||||||
"msg_keys":"base_resp.status_msg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"change_sub_apikey":{
|
|
||||||
"path":"/v1/sub_account/${sub_account_id}/token",
|
|
||||||
"method":"PUT",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Authorization",
|
|
||||||
"value":"Bearer ${apikey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"GroupId",
|
|
||||||
"value":"${group_id}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resp":[
|
|
||||||
{
|
|
||||||
"name":"apikey",
|
|
||||||
"resp_keys":"token"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_if":{
|
|
||||||
"error_keys":"base_resp.status_code",
|
|
||||||
"op":"!=",
|
|
||||||
"value":0,
|
|
||||||
"code_keys":"base_resp.status_code",
|
|
||||||
"msg_keys":"base_resp.status_msg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"get_sub_bill":{
|
|
||||||
"path":"/v1/sub_account/${sub_account_id}/bill",
|
|
||||||
"method":"GET",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Authorization",
|
|
||||||
"value":"Bearer ${apikey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"GroupId",
|
|
||||||
"value":"${group_id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"method",
|
|
||||||
"value":"${bill_type}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resp":[
|
|
||||||
{
|
|
||||||
"name":"bills",
|
|
||||||
"resp_keys":"bill_list"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_if":{
|
|
||||||
"error_keys":"base_resp.status_code",
|
|
||||||
"op":"!=",
|
|
||||||
"value":0,
|
|
||||||
"code_keys":"base_resp.status_code",
|
|
||||||
"msg_keys":"base_resp.status_msg"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"bill":{
|
|
||||||
"path":"/v1/batch_query_bill",
|
|
||||||
"method":"GET",
|
|
||||||
"headers":[
|
|
||||||
{
|
|
||||||
"name":"Content-Type",
|
|
||||||
"value":"application/json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Authorization",
|
|
||||||
"value":"Bearer ${apikey}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
{
|
|
||||||
"name":"GroupId",
|
|
||||||
"value":"${group_id}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"start_date",
|
|
||||||
"value":"${start_date}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"end_date",
|
|
||||||
"value":"${end_date}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resp":[
|
|
||||||
{
|
|
||||||
"name":"bills",
|
|
||||||
"resp_keys":"bill_list"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_if":{
|
|
||||||
"error_keys":"base_resp.status_code",
|
|
||||||
"op":"!=",
|
|
||||||
"value":0,
|
|
||||||
"code_keys":"base_resp.status_code",
|
|
||||||
"msg_keys":"base_resp.status_msg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import asyncio
|
|
||||||
async def main():
|
|
||||||
m = OAuthClient(DictObject(**api_desc))
|
|
||||||
# sub_account test ok
|
|
||||||
# resp = await m('https://api.minimax.chat', 'sub_account', {'account_name':'test1'})
|
|
||||||
# sub_delete test ok
|
|
||||||
# resp = await m('https://api.minimax.chat', 'sub_delete', {'sub_account_id':'1765984131482656836'})
|
|
||||||
# change_sub_status test ok
|
|
||||||
# resp = await m('https://api.minimax.chat', 'change_sub_status',
|
|
||||||
# {'sub_account_id':'1766027179931476048', 'status':0})
|
|
||||||
# change_sub_apikey test ok
|
|
||||||
# resp = await m('https://api.minimax.chat', 'change_sub_apikey',
|
|
||||||
# {'sub_account_id':'1766027179931476048'})
|
|
||||||
# get_sub_bill test, wait data to check
|
|
||||||
# resp = await m('https://api.minimax.chat', 'get_sub_bill',
|
|
||||||
# {'sub_account_id':'1766027179931476048',
|
|
||||||
# bill test ok
|
|
||||||
resp = await m('https://api.minimax.chat', 'bill',
|
|
||||||
{
|
|
||||||
'start_date':'20240419',
|
|
||||||
'end_date':'20240419'})
|
|
||||||
print(resp)
|
|
||||||
|
|
||||||
async def t():
|
|
||||||
for i in range(100):
|
|
||||||
await main()
|
|
||||||
with open('t.py', 'r') as f:
|
|
||||||
print('-------------------',f.fileno())
|
|
||||||
|
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,185 +0,0 @@
|
|||||||
from appPublic.jsonConfig import getConfig
|
|
||||||
from appPublic.oauth_client import OAuthClient
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
from sqlor.dbpools import DBPools
|
|
||||||
|
|
||||||
from ahserver.globalEnv import get_definition
|
|
||||||
from .api import api_desc
|
|
||||||
|
|
||||||
class MinimaxAdm:
|
|
||||||
def __init__(self, dbname, url_base='https://api.minimax.chat'):
|
|
||||||
self.api_desc = api_desc
|
|
||||||
self.name = api_desc.name
|
|
||||||
self.dbname = dbname
|
|
||||||
self.url_base = url_base
|
|
||||||
self.api = OAuthClient(DictObject(**self.api_desc))
|
|
||||||
|
|
||||||
async def write_usage(self, userid, model, usage):
|
|
||||||
ns = {
|
|
||||||
'id':getID(),
|
|
||||||
'userid':userid,
|
|
||||||
'apiname':self.name,
|
|
||||||
'model':model,
|
|
||||||
'u_date':curdate(),
|
|
||||||
'u_time':curtime(),
|
|
||||||
'input_usage':usage.input_token,
|
|
||||||
'output_usage':usage.output_token,
|
|
||||||
'total_usage':usage.total_token
|
|
||||||
}
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext(self.dbname) as sor:
|
|
||||||
await sor.C('token_usage', ns)
|
|
||||||
|
|
||||||
async def get_account(self, userid):
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext(self.dbname) as sor:
|
|
||||||
ns = {'userid':userid}
|
|
||||||
r = await sor.sqlExe('select * from minimax_acc where userid=${userid}$', ns)
|
|
||||||
if len(r) > 0:
|
|
||||||
return r[0]
|
|
||||||
return None
|
|
||||||
asyncdef get_username(self, userid):
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext(self.dbname) as sor:
|
|
||||||
ns = {'userid':userid}
|
|
||||||
r = await sor.sqlExe('select * from users where userid=${userid}$', ns)
|
|
||||||
if len(r) > 0:
|
|
||||||
return r[0].username
|
|
||||||
return None
|
|
||||||
|
|
||||||
async def new_account(self, ns):
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlContext(self.dbname) as sor:
|
|
||||||
await sor.C('minimax_acc', ns)
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def open_accoount(self, userid):
|
|
||||||
acc = await self.get_account(userid)
|
|
||||||
if acc:
|
|
||||||
return acc
|
|
||||||
username = self.get_username(userid)
|
|
||||||
if not username:
|
|
||||||
return False
|
|
||||||
resp = await self.api(self.url_base,
|
|
||||||
'sub_account',
|
|
||||||
{'account_name':username})
|
|
||||||
if resp.status != 'ok':
|
|
||||||
print(resp)
|
|
||||||
return False
|
|
||||||
d = resp.data
|
|
||||||
ns = {
|
|
||||||
'id':getID(),
|
|
||||||
'userid':userid,
|
|
||||||
'acc_id:d.subject_id,
|
|
||||||
'acc_name':d.account,
|
|
||||||
'password':d.password,
|
|
||||||
'apikey':d.token,
|
|
||||||
'groupid':d.group_id,
|
|
||||||
'acc_status':0
|
|
||||||
}
|
|
||||||
r = await self.new_account(self, ns)
|
|
||||||
return r
|
|
||||||
|
|
||||||
async def delete_account(self, ns):
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlContext(self.dbname) as sor:
|
|
||||||
await sor.D('minimax_acc', ns)
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def update_acc(self, ns):
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext(self.dbname) as sor:
|
|
||||||
r = await sor.U('minimax_acc', ns)
|
|
||||||
return r
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def delete_acc(self, userid):
|
|
||||||
acc = await self.get_account(userid)
|
|
||||||
if acc is None:
|
|
||||||
return False
|
|
||||||
if acc.acc_status == 0:
|
|
||||||
print(f'{acc_name} minimax acc is using, please disable it first')
|
|
||||||
return False
|
|
||||||
|
|
||||||
resp = await self.api(self.url_base,
|
|
||||||
'sub_delete',
|
|
||||||
{'sub_account_id':acc.acc_id})
|
|
||||||
if resp.status == 'ok':
|
|
||||||
r = await self.delete_account(acc)
|
|
||||||
return r
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def acc_enable(self, userid):
|
|
||||||
return await self._acc_change_status(self, user, 0)
|
|
||||||
|
|
||||||
async def acc_disable(self, userid):
|
|
||||||
return await self._acc_change_status(self, user, 2)
|
|
||||||
|
|
||||||
async def _acc_change_status(self, userid, status):
|
|
||||||
acc = await self.get_account(userid)
|
|
||||||
if acc is None:
|
|
||||||
return False
|
|
||||||
if acc.acc_status == status:
|
|
||||||
return True
|
|
||||||
resp = await self.api(self.url_base, 'ststus', {
|
|
||||||
'sub_account_id':acc.acc_id,
|
|
||||||
'status':status
|
|
||||||
})
|
|
||||||
if resp.status != 'ok':
|
|
||||||
return False
|
|
||||||
ns = {
|
|
||||||
'id':acc.id,
|
|
||||||
'status':status
|
|
||||||
}
|
|
||||||
return await self.update_acc(ns):
|
|
||||||
|
|
||||||
async def reset_apikey(self, userid):
|
|
||||||
acc = await self.get_account(userid)
|
|
||||||
if acc is None:
|
|
||||||
return False
|
|
||||||
resp = await self.api(self.url_base, 'token', {
|
|
||||||
'sub_account_id':acc.acc_id
|
|
||||||
})
|
|
||||||
if resp.status != 'ok':
|
|
||||||
return False
|
|
||||||
ns = {
|
|
||||||
'id':acc.id,
|
|
||||||
'apikey':resp.apikey
|
|
||||||
}
|
|
||||||
return await self.update_acc(ns):
|
|
||||||
|
|
||||||
async def get_daily_bill(self, dat):
|
|
||||||
acc = await self.get_account(userid)
|
|
||||||
if acc is None:
|
|
||||||
return False
|
|
||||||
d = ''.join(dat.split('-'))
|
|
||||||
resp = await self.api(self.url_base, 'bill', {
|
|
||||||
'start_date':d,
|
|
||||||
'end_date':d
|
|
||||||
})
|
|
||||||
if resp.status != 'ok':
|
|
||||||
return await self.append_bill(resp.data.bills, dat)
|
|
||||||
|
|
||||||
async def append_bill(bills, dat):
|
|
||||||
db = DBPools()
|
|
||||||
for b in bills:
|
|
||||||
ns = {
|
|
||||||
'id':getID(),
|
|
||||||
'acc_id':b.creator_id,
|
|
||||||
'acc_name':b.creator_name,
|
|
||||||
'model':b.model,
|
|
||||||
'consume_time':b.consume_time,
|
|
||||||
'consume_token':b.consume_token,
|
|
||||||
'consume_amt':b.consume_cash,
|
|
||||||
'create_at':b.create_at,
|
|
||||||
'consume_date':dat
|
|
||||||
}
|
|
||||||
r = False
|
|
||||||
async with db.sqlorContext(self.dbname) as sor:
|
|
||||||
sor.C('minimax_bill', ns)
|
|
||||||
r = True
|
|
||||||
if not r:
|
|
||||||
print(f'{ns} write to db error')
|
|
||||||
return True
|
|
||||||
92
minimax/t
92
minimax/t
@ -1,92 +0,0 @@
|
|||||||
{
|
|
||||||
'status': 'ok',
|
|
||||||
'data': {
|
|
||||||
'bills': [
|
|
||||||
{
|
|
||||||
'method': 'chatcompletion-pro',
|
|
||||||
'consume_cash': '0.0075',
|
|
||||||
'consume_token': '75',
|
|
||||||
'created_at': 1713517200,
|
|
||||||
'status': 'SUCCESS',
|
|
||||||
'model': 'abab6-chat',
|
|
||||||
'mail': '主账户',
|
|
||||||
'creator_id': '',
|
|
||||||
'api_token_name': 'open computing',
|
|
||||||
'group_id': '1768537645828292930',
|
|
||||||
'creator_name': '主账户',
|
|
||||||
'ymd': '',
|
|
||||||
'consume_time': '2024年04月19日 17:00-18:00'
|
|
||||||
}, {
|
|
||||||
'method': 'chatcompletion-pro',
|
|
||||||
'consume_cash': '0.0057',
|
|
||||||
'consume_token': '57',
|
|
||||||
'created_at': 1713434400,
|
|
||||||
'status': 'SUCCESS',
|
|
||||||
'model': 'abab6-chat',
|
|
||||||
'mail': '主账户',
|
|
||||||
'creator_id': '',
|
|
||||||
'api_token_name': 'open computing',
|
|
||||||
'group_id': '1768537645828292930',
|
|
||||||
'creator_name': '主账户',
|
|
||||||
'ymd': '',
|
|
||||||
'consume_time': '2024年04月18日 18:00-19:00'
|
|
||||||
}, {
|
|
||||||
'method': 'chatcompletion-pro',
|
|
||||||
'consume_cash': '0.0467',
|
|
||||||
'consume_token': '467',
|
|
||||||
'created_at': 1713430800,
|
|
||||||
'status': 'SUCCESS',
|
|
||||||
'model': 'abab6-chat',
|
|
||||||
'mail': '主账户',
|
|
||||||
'creator_id': '',
|
|
||||||
'api_token_name': 'open computing',
|
|
||||||
'group_id': '1768537645828292930',
|
|
||||||
'creator_name': '主账户',
|
|
||||||
'ymd': '',
|
|
||||||
'consume_time': '2024年04月18日 17:00-18:00'
|
|
||||||
}, {
|
|
||||||
'method': 'chatcompletion-pro',
|
|
||||||
'consume_cash': '0.1040',
|
|
||||||
'consume_token': '1040',
|
|
||||||
'created_at': 1713348000,
|
|
||||||
'status': 'SUCCESS',
|
|
||||||
'model': 'abab6-chat',
|
|
||||||
'mail': '主账户',
|
|
||||||
'creator_id': '',
|
|
||||||
'api_token_name': 'open computing',
|
|
||||||
'group_id': '1768537645828292930',
|
|
||||||
'creator_name': '主账户',
|
|
||||||
'ymd': '',
|
|
||||||
'consume_time': '2024年04月17日 18:00-19:00'
|
|
||||||
}, {
|
|
||||||
'method': 'chatcompletion-pro',
|
|
||||||
'consume_cash': '0.1102',
|
|
||||||
'consume_token': '1102',
|
|
||||||
'created_at': 1713344400,
|
|
||||||
'status': 'SUCCESS',
|
|
||||||
'model': 'abab6-chat',
|
|
||||||
'mail': '主账户',
|
|
||||||
'creator_id': '',
|
|
||||||
'api_token_name': 'open computing',
|
|
||||||
'group_id': '1768537645828292930',
|
|
||||||
'creator_name': '主账户',
|
|
||||||
'ymd': '',
|
|
||||||
'consume_time': '2024年04月17日 17:00-18:00'
|
|
||||||
}, {
|
|
||||||
'method': 'chatcompletion-pro',
|
|
||||||
'consume_cash': '0.0106',
|
|
||||||
'consume_token': '708',
|
|
||||||
'created_at': 1713340800,
|
|
||||||
'status': 'SUCCESS',
|
|
||||||
'model': 'abab5.5-chat',
|
|
||||||
'mail': '主账户',
|
|
||||||
'creator_id': '',
|
|
||||||
'api_token_name': 'open computing',
|
|
||||||
'group_id': '1768537645828292930',
|
|
||||||
'creator_name': '主账户',
|
|
||||||
'ymd': '',
|
|
||||||
'consume_time': '2024年04月17日 16:00-17:00'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "apiparams",
|
|
||||||
"title": "接口参数",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "params_type",
|
|
||||||
"title": "接口名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "objid",
|
|
||||||
"title": "模型或实例id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apidataid",
|
|
||||||
"title": "父数据id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "datatype",
|
|
||||||
"title": "数据类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "value",
|
|
||||||
"title": "数据值",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"apidataid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"apidataid",
|
|
||||||
"params_type",
|
|
||||||
"objid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "params_type",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='params_type'"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "datatype",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='datatype'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "appcodes",
|
|
||||||
"title": "应用编码表",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "编码名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hierarchy_flg",
|
|
||||||
"title": "多级标志",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "hierarchy_flg",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='code_hierarchy'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,54 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "appcodes_kv",
|
|
||||||
"title": "编码键值表",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "parentid",
|
|
||||||
"title": "父id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "k",
|
|
||||||
"title": "键",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "v",
|
|
||||||
"title": "值",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"parentid",
|
|
||||||
"k"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"parentid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,211 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "feelog",
|
|
||||||
"title": "模型计费日志",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"catelog": "entity"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "transdate",
|
|
||||||
"title": "交易日期",
|
|
||||||
"type": "date"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "transtime",
|
|
||||||
"title": "交易时间",
|
|
||||||
"type": "timestamp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modelinstanceid",
|
|
||||||
"title": "模型实例id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modeltypeid",
|
|
||||||
"title": "模型类型id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "customerid",
|
|
||||||
"title": "客户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "userid",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pricing_mode",
|
|
||||||
"title": "计费模式",
|
|
||||||
"type": "str",
|
|
||||||
"length": 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "dialog_file",
|
|
||||||
"title": "会话文件名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_tokens",
|
|
||||||
"title": "输入tokens",
|
|
||||||
"type": "long"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "output_tokens",
|
|
||||||
"title": "输出tokens",
|
|
||||||
"type": "long"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "other_tokens",
|
|
||||||
"title": "其他tokens",
|
|
||||||
"type": "long"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_price",
|
|
||||||
"title": "输入价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "output_price",
|
|
||||||
"title": "输出价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "other_price",
|
|
||||||
"title": "其他价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "timing_price",
|
|
||||||
"title": "计次价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "timing_amount",
|
|
||||||
"title": "计次金额",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_amount",
|
|
||||||
"title": "输入金额",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "output_amount",
|
|
||||||
"title": "输出金额",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "other_amount",
|
|
||||||
"title": "其他金额",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "accounting_status",
|
|
||||||
"title": "记账状态",
|
|
||||||
"type": "str",
|
|
||||||
"length": 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "resp_time",
|
|
||||||
"title": "响应时间",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "finish_time",
|
|
||||||
"title": "完成时间",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "estimate",
|
|
||||||
"title": "评价",
|
|
||||||
"type": "short"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"transdate"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"customerid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx3",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"userid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "modelinstanceid",
|
|
||||||
"table": "modelinstance",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "modeltypeid",
|
|
||||||
"table": "modeltypes",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "customerid",
|
|
||||||
"table": "organization",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "orgname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "userid",
|
|
||||||
"table": "users",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "username"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,110 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "httpapi",
|
|
||||||
"title": "http程序接口",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apiname",
|
|
||||||
"title": "接口名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "label",
|
|
||||||
"title": "接口名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "providerid",
|
|
||||||
"title": "接口提供方",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apiinfo",
|
|
||||||
"title": "接口内容",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apinote",
|
|
||||||
"title": "接口描述",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "use_session",
|
|
||||||
"title": "带历史信息",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "response_mode",
|
|
||||||
"title": "响应模式",
|
|
||||||
"type": "str",
|
|
||||||
"length": 50
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "system_msg_format",
|
|
||||||
"title": "系统消息模版",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "user_msg_format",
|
|
||||||
"title": "用户消息模版",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "llm_msg_format",
|
|
||||||
"title": "模型消息模版",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"apiname"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "providerid",
|
|
||||||
"table": "supplychain.suppliers",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "supplier_name"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "use_session",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='yesno'"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "response_mode",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='resp_mode'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,70 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "minimax_acc",
|
|
||||||
"title": "minimax账号",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "userid",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc_id",
|
|
||||||
"title": "minimax账号id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc_name",
|
|
||||||
"title": "账号名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 300
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"title": "账号密码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apikey",
|
|
||||||
"title": "账号apikey",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "groupid",
|
|
||||||
"title": "组号",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc_status",
|
|
||||||
"title": "账号状态",
|
|
||||||
"type": "short",
|
|
||||||
"default": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"userid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,80 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "minimax_bill",
|
|
||||||
"title": "minimax账单",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "customerid",
|
|
||||||
"title": "客户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc_id",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modelinstanceid",
|
|
||||||
"title": "模型实例id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "acc_name",
|
|
||||||
"title": "账号名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consume_time",
|
|
||||||
"title": "消费时间戳",
|
|
||||||
"type": "timestamp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consume_token",
|
|
||||||
"title": "消费token数",
|
|
||||||
"type": "long"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consume_amt",
|
|
||||||
"title": "消费金额",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "create_at",
|
|
||||||
"title": "创建时间",
|
|
||||||
"type": "timestamp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "consume_date",
|
|
||||||
"title": "消费日期",
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"customerid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modelapi",
|
|
||||||
"title": "模型接口",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modelid",
|
|
||||||
"title": "模型id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apiid",
|
|
||||||
"title": "接口id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modeltypeid",
|
|
||||||
"title": "模型类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "modelid",
|
|
||||||
"table": "models",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "apiid",
|
|
||||||
"table": "httpapi",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "apiname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "modeltypeid",
|
|
||||||
"table": "modeltype",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,73 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modelinstance",
|
|
||||||
"title": "模型实例",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modelid",
|
|
||||||
"title": "模型id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "实例名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "label",
|
|
||||||
"title": "实例名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "description",
|
|
||||||
"title": "实例说明",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "base_url",
|
|
||||||
"title": "接口ur",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ownerid",
|
|
||||||
"title": "属主id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "enable_date",
|
|
||||||
"title": "启动日期",
|
|
||||||
"type": "date"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "expore_date",
|
|
||||||
"title": "失效日期",
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "modelid",
|
|
||||||
"table": "models",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,69 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modeliodata",
|
|
||||||
"title": "模型输入输出数据",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "数据名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "label",
|
|
||||||
"title": "标题",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "datatype",
|
|
||||||
"title": "数据类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "uitype",
|
|
||||||
"title": "输入类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "length",
|
|
||||||
"title": "长度",
|
|
||||||
"type": "short"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "dec",
|
|
||||||
"title": "小数点数",
|
|
||||||
"type": "short"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "uitype",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='uitype'"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "datatype",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='datatype'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,94 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modelpricing",
|
|
||||||
"title": "模型计费",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modelinstanceid",
|
|
||||||
"title": "模型实例id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modeltypeid",
|
|
||||||
"title": "模型类型id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "enable_date",
|
|
||||||
"title": "开始日期",
|
|
||||||
"type": "date"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "expired_date",
|
|
||||||
"title": "失效日期",
|
|
||||||
"type": "date"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pricing_mode",
|
|
||||||
"title": "计费类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "token_cnt",
|
|
||||||
"title": "token数量",
|
|
||||||
"type": "long"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_price",
|
|
||||||
"title": "输入价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "output_price",
|
|
||||||
"title": "输出价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "timing_price",
|
|
||||||
"title": "计次价格",
|
|
||||||
"type": "float",
|
|
||||||
"length": 18,
|
|
||||||
"dec": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "pricing_mode",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='pricing_mode'"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "modelinstanceid",
|
|
||||||
"table": "modelinstance",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "modeltypeid",
|
|
||||||
"table": "modeltype",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modelprovider",
|
|
||||||
"title": "模型供应商",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "供应商名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "label",
|
|
||||||
"title": "供应商名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "description",
|
|
||||||
"title": "说明",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "models",
|
|
||||||
"title": "大模型",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "英文名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "title",
|
|
||||||
"title": "模型名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "description",
|
|
||||||
"title": "模型说明",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "icon_url",
|
|
||||||
"title": "模型图标URL",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "providerid",
|
|
||||||
"title": "供应商id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "providerid",
|
|
||||||
"table": "organization",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "orgname"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,64 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modeltype",
|
|
||||||
"title": "模型类型",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "类型名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "description",
|
|
||||||
"title": "类型说明",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_multiple",
|
|
||||||
"title": "是否多模态",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_fields",
|
|
||||||
"title": "输入字段",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_view",
|
|
||||||
"title": "输入显示",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "output_view",
|
|
||||||
"title": "输出显示",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "is_multiple",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='yesno'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,46 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modeltypein",
|
|
||||||
"title": "模型类型输入数据",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modeltypeid",
|
|
||||||
"title": "模型类型id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "iodataid",
|
|
||||||
"title": "io数据id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "required",
|
|
||||||
"title": "是否必须",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "required",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='yesno'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "modeltypeout",
|
|
||||||
"title": "模型类型输出数据",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modeltypeid",
|
|
||||||
"title": "模型类型id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "iodataid",
|
|
||||||
"title": "io数据id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "resp_keys",
|
|
||||||
"title": "在响应包中的位置",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
6728
models/mysql.ddl.sql
6728
models/mysql.ddl.sql
File diff suppressed because it is too large
Load Diff
@ -1,43 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "org_roles",
|
|
||||||
"title": "机构角色",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgid",
|
|
||||||
"title": "机构编码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "roleid",
|
|
||||||
"title": "角色编码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "del_flg",
|
|
||||||
"title": "删除标志",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "create_at",
|
|
||||||
"title": "创建时间戳",
|
|
||||||
"type": "timestamp"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,127 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "organization",
|
|
||||||
"title": "机构",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "机构编码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgname",
|
|
||||||
"title": "机构名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "alias_name",
|
|
||||||
"title": "机构别名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "contactor",
|
|
||||||
"title": "联系人",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "contactor_phone",
|
|
||||||
"title": "联系人电话",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "province_id",
|
|
||||||
"title": "所在省id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "city_id",
|
|
||||||
"title": "所在城市id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "distinct_id",
|
|
||||||
"title": "所在地区id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "emailaddress",
|
|
||||||
"title": "邮箱",
|
|
||||||
"type": "str",
|
|
||||||
"length": 256
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "address",
|
|
||||||
"title": "地址",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "main_business",
|
|
||||||
"title": "主营业务描述",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgcode",
|
|
||||||
"title": "组织结构代码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "license_img",
|
|
||||||
"title": "营业执照",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "id_img",
|
|
||||||
"title": "身份证",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "parentid",
|
|
||||||
"title": "父机构id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "org_type",
|
|
||||||
"title": "机构类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "accountid",
|
|
||||||
"title": "账号",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "del_flg",
|
|
||||||
"title": "删除标志",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "create_at",
|
|
||||||
"title": "创建时间戳",
|
|
||||||
"type": "timestamp"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "orgtypes",
|
|
||||||
"title": "机构拥有角色",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgid",
|
|
||||||
"title": "机构id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgtypeid",
|
|
||||||
"title": "机构类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "orgtypeid",
|
|
||||||
"table": "appcodes_kv",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='org_type'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,77 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "permission",
|
|
||||||
"title": "权限",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "权限id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "description",
|
|
||||||
"title": "描述",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ptype",
|
|
||||||
"title": "类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 20
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "parentid",
|
|
||||||
"title": "父权限id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"title": "路径",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "title",
|
|
||||||
"title": "标题",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "icon",
|
|
||||||
"title": "图标",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"ptype"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"parentid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "role",
|
|
||||||
"title": " 角色",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "角色id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgtypeid",
|
|
||||||
"title": "机构类型",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "role",
|
|
||||||
"title": "角色",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rolelabel",
|
|
||||||
"title": "角色名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"orgtypeid",
|
|
||||||
" role"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "orgtypeid",
|
|
||||||
"table": "appcodes_kw",
|
|
||||||
"valuefield": "k",
|
|
||||||
"textfield": "v",
|
|
||||||
"cond": "parentid='org_type'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
BIN
models/role.xlsx
BIN
models/role.xlsx
Binary file not shown.
@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "rolepermission",
|
|
||||||
"title": "角色权限表",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "roleid",
|
|
||||||
"title": "角色id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "permid",
|
|
||||||
"title": "权限id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,91 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "token_usgae",
|
|
||||||
"title": "token使用表",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "customerid",
|
|
||||||
"title": "客户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "userid",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "callname",
|
|
||||||
"title": "调用名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "modelinstanceid",
|
|
||||||
"title": "模型实例id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "u_date",
|
|
||||||
"title": "使用日期",
|
|
||||||
"type": "date",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "u_time",
|
|
||||||
"title": "使用时间",
|
|
||||||
"type": "timestamp",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "input_usage",
|
|
||||||
"title": "输入token数",
|
|
||||||
"type": "long"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "output_usage",
|
|
||||||
"title": "输出token数",
|
|
||||||
"type": "long"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"userid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"customerid",
|
|
||||||
"userid",
|
|
||||||
"modelinstanceid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx3",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"customerid",
|
|
||||||
"modelinstanceid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,94 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "userapikey",
|
|
||||||
"title": "用户api密码表",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "providerid",
|
|
||||||
"title": "供应商id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ownerid",
|
|
||||||
"title": "属主id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apikey",
|
|
||||||
"title": "api密钥",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "secretkey",
|
|
||||||
"title": "附属密钥",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rfname",
|
|
||||||
"title": "函数名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apiuser",
|
|
||||||
"title": "api用户",
|
|
||||||
"type": "str",
|
|
||||||
"length": 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apipasswd",
|
|
||||||
"title": "api密码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"providerid",
|
|
||||||
"customerid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"customerid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "providerid",
|
|
||||||
"table": "organization",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "orgname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "ownerid",
|
|
||||||
"table": "organization",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "orgname"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,43 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "userdepartment",
|
|
||||||
"title": "用户部门表",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "userid",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "depid",
|
|
||||||
"title": "部门id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "del_flg",
|
|
||||||
"title": "删除标志",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "create_at",
|
|
||||||
"title": "创建时间戳",
|
|
||||||
"type": "timestamp"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "userrole",
|
|
||||||
"title": "用户角色",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "userid",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "roleid",
|
|
||||||
"title": "角色id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "userid",
|
|
||||||
"table": "users",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "username"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"field": "roleid",
|
|
||||||
"table": "role",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "role"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,90 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "users",
|
|
||||||
"title": "用户",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "用户id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "username",
|
|
||||||
"title": "用户名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "姓名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"title": "密码",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "email",
|
|
||||||
"title": "邮件地址",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "orgid",
|
|
||||||
"title": "所属机构",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "nick_name",
|
|
||||||
"title": "显示名",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "address",
|
|
||||||
"title": "地址",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mobile",
|
|
||||||
"title": "手机",
|
|
||||||
"type": "str",
|
|
||||||
"length": 255
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "user_status",
|
|
||||||
"title": "用户状态",
|
|
||||||
"type": "str",
|
|
||||||
"length": 1,
|
|
||||||
"default": "0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"indexes": [
|
|
||||||
{
|
|
||||||
"name": "idx1",
|
|
||||||
"idxtype": "index",
|
|
||||||
"idxfields": [
|
|
||||||
"orgid"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "idx2",
|
|
||||||
"idxtype": "unique",
|
|
||||||
"idxfields": [
|
|
||||||
"username"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,51 +0,0 @@
|
|||||||
{
|
|
||||||
"summary": [
|
|
||||||
{
|
|
||||||
"name": "xterm",
|
|
||||||
"title": "终端",
|
|
||||||
"primary": [
|
|
||||||
"id"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"title": "终端名称",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hostid",
|
|
||||||
"title": "描述",
|
|
||||||
"type": "str",
|
|
||||||
"length": 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ownerid",
|
|
||||||
"title": "属主id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "cmd",
|
|
||||||
"title": "命令",
|
|
||||||
"type": "str",
|
|
||||||
"length": 2000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"codes": [
|
|
||||||
{
|
|
||||||
"field": "hostid",
|
|
||||||
"table": "hostdev",
|
|
||||||
"valuefield": "id",
|
|
||||||
"textfield": "name"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
sk-fHOyIKC2mlIDfGwUQV6SwjwVJkjBJgkNWYv82yt3OdpYh592
|
|
||||||
113
ollama/api.py
113
ollama/api.py
@ -1,113 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
from appPublic.oauth_client import OAuthClient
|
|
||||||
desc = {
|
|
||||||
"data":{
|
|
||||||
"oops":1
|
|
||||||
},
|
|
||||||
"mapis":{
|
|
||||||
"generate":{
|
|
||||||
"url":"https://sage.opencomputing.cn/ollama/api/generate",
|
|
||||||
"method":"POST",
|
|
||||||
"headers":[
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
],
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"name":"model",
|
|
||||||
"value":"${model}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"prompt",
|
|
||||||
"value":"${prompt}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"context",
|
|
||||||
"value":"${context}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"stream",
|
|
||||||
"value":True
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"resposne_type":"2",
|
|
||||||
"error_field":"error",
|
|
||||||
"error_msg_field":"error_description",
|
|
||||||
"resp_set_data":[
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"chat":{
|
|
||||||
# "url":"https://sage.opencomputing.cn/ollama/api/chat",
|
|
||||||
"url":"http://localhost:11434/api/chat",
|
|
||||||
"method":"POST",
|
|
||||||
"headers":[
|
|
||||||
],
|
|
||||||
"params":[
|
|
||||||
],
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"name":"model",
|
|
||||||
"value":"${model}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"messages",
|
|
||||||
"value":"${messages}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"stream",
|
|
||||||
"value":True
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"resposne_type":"2",
|
|
||||||
"error_field":"error",
|
|
||||||
"error_msg_field":"error_description",
|
|
||||||
"resp_set_data":[
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async def generate(desc):
|
|
||||||
ollama = OAuthClient(desc)
|
|
||||||
context = []
|
|
||||||
while True:
|
|
||||||
print('prompt:')
|
|
||||||
p = input()
|
|
||||||
if p == '':
|
|
||||||
continue
|
|
||||||
if p == 'quit':
|
|
||||||
break
|
|
||||||
r = await ollama('generate', {
|
|
||||||
"model":"llama2:13b",
|
|
||||||
"context":context,
|
|
||||||
"prompt":p
|
|
||||||
})
|
|
||||||
context = r['context']
|
|
||||||
print('ollama:', r['response'])
|
|
||||||
|
|
||||||
async def chat(desc):
|
|
||||||
ollama = OAuthClient(desc)
|
|
||||||
msgs = []
|
|
||||||
while True:
|
|
||||||
print('prompt:')
|
|
||||||
p = input()
|
|
||||||
if p == '':
|
|
||||||
continue
|
|
||||||
if p == 'quit':
|
|
||||||
break
|
|
||||||
msg = {
|
|
||||||
"role":"user",
|
|
||||||
"content":p
|
|
||||||
}
|
|
||||||
msgs.append(msg)
|
|
||||||
r = await ollama('chat', {
|
|
||||||
"model":"llama2:7b",
|
|
||||||
"messages":msgs
|
|
||||||
})
|
|
||||||
msgs.append(r['message'])
|
|
||||||
response = r['message']['content']
|
|
||||||
print('ollama:', response)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
asyncio.get_event_loop().run_until_complete(chat(desc))
|
|
||||||
|
|
||||||
@ -1 +0,0 @@
|
|||||||
apikey='sk-ca5dfeb58d494f32a9cf1e9f064370c8'
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os
|
|
||||||
from http import HTTPStatus
|
|
||||||
import dashscope
|
|
||||||
from dashscope.api_entities.dashscope_response import Role
|
|
||||||
from appPublic.worker import awaitify
|
|
||||||
|
|
||||||
from key import apikey
|
|
||||||
|
|
||||||
def get_user_apikey(apiname, user):
|
|
||||||
return apikey
|
|
||||||
|
|
||||||
class QianWen:
|
|
||||||
def __init__(self, user):
|
|
||||||
self.key = get_user_apikey('qianwen', user)
|
|
||||||
|
|
||||||
def _generate(self, p, model, h, stream):
|
|
||||||
h.append({
|
|
||||||
'role':'user',
|
|
||||||
'content':p
|
|
||||||
})
|
|
||||||
dashscope.api_key = self.key
|
|
||||||
response = dashscope.Generation.call(
|
|
||||||
model,
|
|
||||||
messages=h,
|
|
||||||
stream=stream,
|
|
||||||
incremental_output=True,
|
|
||||||
result_format='message')
|
|
||||||
if stream:
|
|
||||||
return response
|
|
||||||
|
|
||||||
if response.status_code == HTTPStatus.OK:
|
|
||||||
return response
|
|
||||||
raise Exception(f'Qianwen Error:{response.status_code}:{resposne.message}')
|
|
||||||
async def generate(self, p, model='qwen-turbo', h=[], chunk_func=None):
|
|
||||||
reco = awaitify(self._generate)
|
|
||||||
stream = True
|
|
||||||
if chunk_func is None:
|
|
||||||
stream = False
|
|
||||||
resp = await reco(p, model, h, stream)
|
|
||||||
if stream:
|
|
||||||
for r in resp:
|
|
||||||
chunk_func(r.output.choices[0].message.content)
|
|
||||||
else:
|
|
||||||
return resp.choices[0].message.content
|
|
||||||
|
|
||||||
a_content = ''
|
|
||||||
async def main():
|
|
||||||
global a_content
|
|
||||||
def f(t):
|
|
||||||
global a_content
|
|
||||||
a_content += t
|
|
||||||
sys.stdout.write(t)
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
h = []
|
|
||||||
ai = QianWen('aaa')
|
|
||||||
while True:
|
|
||||||
print('prompt:')
|
|
||||||
p = input()
|
|
||||||
if p == '':
|
|
||||||
continue
|
|
||||||
a_content = ''
|
|
||||||
print('answer:')
|
|
||||||
await ai.generate(p, h=h, chunk_func=f)
|
|
||||||
h.append({'role': 'assistant', 'content':a_content})
|
|
||||||
print('\n')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import asyncio
|
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
|
||||||
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
python=3.10
|
|
||||||
dashscope
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
server {
|
|
||||||
server_name cpc.opencomputing.cn;
|
|
||||||
location / {
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
proxy_set_header X-Forwarded-Host $host;
|
|
||||||
proxy_set_header X-Forwarded-server $host;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
|
||||||
proxy_set_header X-Forwarded-Port $server_port;
|
|
||||||
proxy_set_header X-real-ip $remote_addr;
|
|
||||||
proxy_send_timeout 600s;
|
|
||||||
proxy_read_timeout 600s;
|
|
||||||
proxy_pass http://10.60.179.61:30880/;
|
|
||||||
}
|
|
||||||
|
|
||||||
listen 443 ssl; # managed by Certbot
|
|
||||||
ssl_certificate /d/ymq/py/script/fullchain.pem; # managed by Certbot
|
|
||||||
ssl_certificate_key /d/ymq/py/script/privkey.pem; # managed by Certbot
|
|
||||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
if ($host = cpc.opencomputing.cn) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
} # managed by Certbot
|
|
||||||
|
|
||||||
|
|
||||||
listen 80;
|
|
||||||
server_name cpc.opencomputing.cn;
|
|
||||||
return 404; # managed by Certbot
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Deploy sage shell files to production wwwroot
|
|
||||||
# Usage: bash ~/sage/script/deploy_shell.sh
|
|
||||||
#
|
|
||||||
# This script copies index.ui and global_menu.ui from the git repo
|
|
||||||
# to the production wwwroot directory (which is gitignored).
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
SAGE_DIR="${SAGE_HOME:-$HOME/sage}"
|
|
||||||
SAGE_WWWROOT="$SAGE_DIR/wwwroot"
|
|
||||||
SAGE_REPO="$HOME/repos/sage/wwwroot"
|
|
||||||
|
|
||||||
echo "Deploying sage shell files..."
|
|
||||||
echo "Source: $SAGE_REPO"
|
|
||||||
echo "Target: $SAGE_WWWROOT"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Ensure wwwroot exists
|
|
||||||
mkdir -p "$SAGE_WWWROOT"
|
|
||||||
|
|
||||||
# Copy index.ui
|
|
||||||
if [ -f "$SAGE_REPO/index.ui" ]; then
|
|
||||||
cp "$SAGE_REPO/index.ui" "$SAGE_WWWROOT/index.ui"
|
|
||||||
echo "✓ index.ui (Shell layout with sidebar)"
|
|
||||||
else
|
|
||||||
echo "✗ index.ui not found in $SAGE_REPO"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy global_menu.ui
|
|
||||||
if [ -f "$SAGE_REPO/global_menu.ui" ]; then
|
|
||||||
cp "$SAGE_REPO/global_menu.ui" "$SAGE_WWWROOT/global_menu.ui"
|
|
||||||
echo "✓ global_menu.ui (Global navigation menu)"
|
|
||||||
else
|
|
||||||
echo "✗ global_menu.ui not found in $SAGE_REPO"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove old symlinks if exist
|
|
||||||
rm -f "$SAGE_WWWROOT/dashboard_for_sage" 2>/dev/null || true
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Deployed to $SAGE_WWWROOT/"
|
|
||||||
echo ""
|
|
||||||
echo "Next steps:"
|
|
||||||
echo " 1. cd ~/repos/dashboard_for_sage && git pull"
|
|
||||||
echo " 2. cd ~/repos/bricks && git pull && bash build.sh"
|
|
||||||
echo " 3. cd ~/sage && ./stop.sh && ./start.sh"
|
|
||||||
@ -1,122 +0,0 @@
|
|||||||
import sys
|
|
||||||
from traceback import format_exc
|
|
||||||
import asyncio
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
from appPublic.timeUtils import days_between, strdate_add
|
|
||||||
from random import randint, random
|
|
||||||
|
|
||||||
from sqlor.dbpools import DBPools
|
|
||||||
databases = {
|
|
||||||
"sage":{
|
|
||||||
"driver":"aiomysql",
|
|
||||||
"async_mode":True,
|
|
||||||
"coding":"utf8",
|
|
||||||
"maxconn":100,
|
|
||||||
"dbname":"sage",
|
|
||||||
"kwargs":{
|
|
||||||
"user":"test",
|
|
||||||
"db":"sage",
|
|
||||||
"password":"QUZVcXg5V1p1STMybG5Ia6mX9D0v7+g=",
|
|
||||||
"host":"localhost"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_modelid():
|
|
||||||
return sys.argv[4]
|
|
||||||
return 'AuJYPP051dQJW9njyXhIu'
|
|
||||||
|
|
||||||
|
|
||||||
def get_date(d1, d2):
|
|
||||||
days = days_between(d1, d2) - 1
|
|
||||||
if (d1 > d2):
|
|
||||||
d = d2
|
|
||||||
d2 = d1
|
|
||||||
d1 = d
|
|
||||||
return strdate_add(d1, days=random() * (days + 1))
|
|
||||||
|
|
||||||
def get_time(d):
|
|
||||||
tf = 7 * 60 * 60
|
|
||||||
tt = 21 * 60 * 60
|
|
||||||
ti = tf + int(random() * (tt - tf))
|
|
||||||
h = int(ti / 3600)
|
|
||||||
m = int((ti - h * 3600) / 60)
|
|
||||||
s = ti % 60
|
|
||||||
return '%s %02d:%02d:%02d' % (d, h, m, s)
|
|
||||||
|
|
||||||
async def get_users(sor):
|
|
||||||
sql = "select id from users"
|
|
||||||
users = await sor.sqlExe(sql, {})
|
|
||||||
return users
|
|
||||||
|
|
||||||
def get_user(users):
|
|
||||||
cnt = len(users)
|
|
||||||
return users[randint(0, cnt - 1)].id
|
|
||||||
|
|
||||||
async def get_modeltype(sor, mii):
|
|
||||||
try:
|
|
||||||
sql = """select b.modeltypeid
|
|
||||||
from modelinstance a, modelapi b
|
|
||||||
where a.modelid = b.modelid
|
|
||||||
and a.id = ${id}$"""
|
|
||||||
recs = await sor.sqlExe(sql, {'id':mii})
|
|
||||||
if len(recs) > 0:
|
|
||||||
cnt = len(recs)
|
|
||||||
return recs[randint(0,cnt-1)].modeltypeid
|
|
||||||
else:
|
|
||||||
print(f'{sql=}, {mii=} not found')
|
|
||||||
return None
|
|
||||||
except Exception as e:
|
|
||||||
tbc = format_exc()
|
|
||||||
print(f'{e}, {tbc=}')
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
db = DBPools(databases)
|
|
||||||
mti_tokens = {
|
|
||||||
'semanticsunderstanding':8839818053,
|
|
||||||
'dialogsemantics':4475142259,
|
|
||||||
'textclassify':6931846764,
|
|
||||||
'textmatching':3896737113
|
|
||||||
}
|
|
||||||
|
|
||||||
async with db.sqlorContext('sage') as sor:
|
|
||||||
userids = await get_users(sor)
|
|
||||||
mii = 'AuJYPP051dQJW9njyXhIu'
|
|
||||||
for mti, max_token in mti_tokens.items():
|
|
||||||
while max_token > 0:
|
|
||||||
input_t = 1000 + randint(0, 1000000)
|
|
||||||
output_t = 1000 + randint(0, 1000000)
|
|
||||||
token_cnt = input_t + output_t
|
|
||||||
if token_cnt > max_token:
|
|
||||||
t = int (token_cnt - max_token) / 2
|
|
||||||
input_t -= t
|
|
||||||
output_t = max_token - input_t
|
|
||||||
max_token = 0
|
|
||||||
else:
|
|
||||||
max_token -= token_cnt
|
|
||||||
|
|
||||||
transdate = get_date('2024-11-01', '2024-12-01')
|
|
||||||
transtime = get_time(transdate)
|
|
||||||
modeltypeid = mti
|
|
||||||
userid = get_user(userids)
|
|
||||||
pricing_mode = 'token'
|
|
||||||
accounting_status = 'not_accounting_yet'
|
|
||||||
id = getID()
|
|
||||||
d = {
|
|
||||||
"id":id,
|
|
||||||
"transdate":transdate,
|
|
||||||
"transtime":transtime,
|
|
||||||
"modelinstanceid":mii,
|
|
||||||
"modeltypeid":modeltypeid,
|
|
||||||
"userid":userid,
|
|
||||||
"pricing_mode":pricing_mode,
|
|
||||||
"input_tokens":input_t,
|
|
||||||
"output_tokens":output_t,
|
|
||||||
"token_cnt":token_cnt,
|
|
||||||
"accounting_status":accounting_status
|
|
||||||
}
|
|
||||||
await sor.C('feelog', d)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
|
||||||
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
ps -ef|grep "$1"|grep -v grep|awk '{print("kill -9", $2)}'|sh
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
合并所有模块的i18n到wwwroot/i18n目录
|
|
||||||
|
|
||||||
用法: python3 script/merge_i18n.py
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
from collections import OrderedDict
|
|
||||||
|
|
||||||
|
|
||||||
def parse_msg_txt(filepath):
|
|
||||||
"""解析msg.txt文件,返回字典"""
|
|
||||||
result = OrderedDict()
|
|
||||||
if not os.path.exists(filepath):
|
|
||||||
return result
|
|
||||||
|
|
||||||
with open(filepath, 'r', encoding='utf-8') as f:
|
|
||||||
for line in f:
|
|
||||||
line = line.strip()
|
|
||||||
if not line or line.startswith('#'):
|
|
||||||
continue
|
|
||||||
if ':' in line:
|
|
||||||
key, value = line.split(':', 1)
|
|
||||||
result[key.strip()] = value.strip()
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def write_msg_txt(data, filepath):
|
|
||||||
"""写入msg.txt文件"""
|
|
||||||
os.makedirs(os.path.dirname(filepath), exist_ok=True)
|
|
||||||
with open(filepath, 'w', encoding='utf-8') as f:
|
|
||||||
for key, value in data.items():
|
|
||||||
f.write(f"{key}: {value}\n")
|
|
||||||
|
|
||||||
|
|
||||||
def write_i18n_json(data, filepath):
|
|
||||||
"""写入i18n.json文件"""
|
|
||||||
os.makedirs(os.path.dirname(filepath), exist_ok=True)
|
|
||||||
with open(filepath, 'w', encoding='utf-8') as f:
|
|
||||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
|
||||||
|
|
||||||
|
|
||||||
def get_modules_from_lnwww():
|
|
||||||
"""从lnwww.sh读取模块列表"""
|
|
||||||
lnwww_path = Path(__file__).parent.parent / 'wwwroot' / 'lnwww.sh'
|
|
||||||
if not lnwww_path.exists():
|
|
||||||
print(f"警告: {lnwww_path} 不存在")
|
|
||||||
return []
|
|
||||||
|
|
||||||
modules = []
|
|
||||||
with open(lnwww_path, 'r', encoding='utf-8') as f:
|
|
||||||
for line in f:
|
|
||||||
line = line.strip()
|
|
||||||
if line.startswith('for m in'):
|
|
||||||
# "for m in xxx yyy zzz" -> "xxx yyy zzz"
|
|
||||||
parts = line.split('for m in ', 1)[1].strip().split()
|
|
||||||
modules = [p for p in parts if p != 'do']
|
|
||||||
break
|
|
||||||
return modules
|
|
||||||
|
|
||||||
|
|
||||||
def merge_i18n():
|
|
||||||
"""主函数:合并i18n"""
|
|
||||||
sage_root = Path(__file__).parent.parent
|
|
||||||
wwwroot_i18n = sage_root / 'wwwroot' / 'i18n'
|
|
||||||
base_i18n = sage_root / 'i18n'
|
|
||||||
|
|
||||||
# 获取模块列表
|
|
||||||
modules = get_modules_from_lnwww()
|
|
||||||
print(f"发现模块: {', '.join(modules)}")
|
|
||||||
|
|
||||||
# 语言列表
|
|
||||||
languages = ['zh', 'en', 'jp', 'ko']
|
|
||||||
|
|
||||||
for lang in languages:
|
|
||||||
print(f"\n处理语言: {lang}")
|
|
||||||
|
|
||||||
# 从基础i18n开始
|
|
||||||
merged = OrderedDict()
|
|
||||||
base_msg = base_i18n / lang / 'msg.txt'
|
|
||||||
if base_msg.exists():
|
|
||||||
merged.update(parse_msg_txt(base_msg))
|
|
||||||
print(f" ✓ 加载基础i18n: {len(merged)} 条")
|
|
||||||
|
|
||||||
# 合并每个模块的i18n
|
|
||||||
for module in modules:
|
|
||||||
# 模块可能在 ~/py/<module>/i18n 或 ~/repos/<module>/i18n
|
|
||||||
module_i18n_paths = [
|
|
||||||
Path.home() / 'py' / module / 'i18n' / lang / 'msg.txt',
|
|
||||||
Path.home() / 'repos' / module / 'i18n' / lang / 'msg.txt',
|
|
||||||
]
|
|
||||||
|
|
||||||
for msg_path in module_i18n_paths:
|
|
||||||
if msg_path.exists():
|
|
||||||
before = len(merged)
|
|
||||||
merged.update(parse_msg_txt(msg_path))
|
|
||||||
added = len(merged) - before
|
|
||||||
print(f" ✓ {module}: +{added} 条 (共 {len(merged)} 条)")
|
|
||||||
break
|
|
||||||
|
|
||||||
# 写入结果
|
|
||||||
out_msg = wwwroot_i18n / lang / 'msg.txt'
|
|
||||||
out_json = wwwroot_i18n / lang / 'i18n.json'
|
|
||||||
|
|
||||||
write_msg_txt(merged, out_msg)
|
|
||||||
write_i18n_json(merged, out_json)
|
|
||||||
|
|
||||||
print(f" → 写入 {out_msg}")
|
|
||||||
print(f" → 写入 {out_json}")
|
|
||||||
|
|
||||||
print("\n✓ 合并完成")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
merge_i18n()
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
from traceback import format_exc
|
|
||||||
import asyncio
|
|
||||||
from appPublic.uniqueID import getID
|
|
||||||
from appPublic.timeUtils import days_between, strdate_add
|
|
||||||
from appPublic.jsonConfig import getConfig
|
|
||||||
from random import randint, random
|
|
||||||
from appPublic.folderUtils import listFile
|
|
||||||
|
|
||||||
from sqlor.dbpools import DBPools
|
|
||||||
databases = {
|
|
||||||
"sage":{
|
|
||||||
"driver":"aiomysql",
|
|
||||||
"async_mode":True,
|
|
||||||
"coding":"utf8",
|
|
||||||
"maxconn":100,
|
|
||||||
"dbname":"sage",
|
|
||||||
"kwargs":{
|
|
||||||
"user":"test",
|
|
||||||
"db":"sage",
|
|
||||||
"password":"QUZVcXg5V1p1STMybG5Ia6mX9D0v7+g=",
|
|
||||||
"host":"localhost"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async def insert_perm(path):
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext('sage') as sor:
|
|
||||||
ns = {
|
|
||||||
'id':getID(),
|
|
||||||
'path':path
|
|
||||||
}
|
|
||||||
await sor.C('permission', ns)
|
|
||||||
|
|
||||||
av_folders = [
|
|
||||||
'/index.ui',
|
|
||||||
'/user.ui',
|
|
||||||
'/top.ui',
|
|
||||||
'/center',
|
|
||||||
'/bottom.ui',
|
|
||||||
'/app_panel.ui',
|
|
||||||
'/bricks',
|
|
||||||
'/imgs',
|
|
||||||
'/login.ui',
|
|
||||||
'/up_login.dspy',
|
|
||||||
'/public',
|
|
||||||
'/tmp'
|
|
||||||
]
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
root = os.path.abspath('../wwwroot')
|
|
||||||
for f in listFile(root, rescursive=True):
|
|
||||||
cnt = len(root)
|
|
||||||
pth = f[cnt:]
|
|
||||||
print(f'{f=},{root=},{pth=}, {cnt=}')
|
|
||||||
act = True
|
|
||||||
for f in av_folders:
|
|
||||||
if pth.startswith(f):
|
|
||||||
act = False
|
|
||||||
break
|
|
||||||
if act:
|
|
||||||
await insert_perm(pth)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
DBPools(databases)
|
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
|
||||||
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
server {
|
|
||||||
autoindex on;
|
|
||||||
client_max_body_size 20m;
|
|
||||||
server_name pd4e.com;
|
|
||||||
|
|
||||||
index index.html index.htm;
|
|
||||||
proxy_buffering off;
|
|
||||||
|
|
||||||
location ~^/ip$ {
|
|
||||||
return 200 "$remote_addr";
|
|
||||||
}
|
|
||||||
|
|
||||||
location /wss/ {
|
|
||||||
proxy_pass http://localhost:9081/;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_set_header X-Forwarded-Path 'wss';
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
proxy_set_header X-Forwarded-Host $host;
|
|
||||||
proxy_set_header X-Forwarded-server $host;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
|
||||||
proxy_set_header X-Forwarded-Port $server_port;
|
|
||||||
proxy_set_header X-Forwarded-Url "$scheme://$host:$server_port$request_uri";
|
|
||||||
proxy_set_header X-real-ip $remote_addr;
|
|
||||||
proxy_send_timeout 600s;
|
|
||||||
proxy_read_timeout 600s;
|
|
||||||
proxy_pass http://localhost:9180/;
|
|
||||||
}
|
|
||||||
|
|
||||||
listen 10443 ssl; # managed by Certbot
|
|
||||||
ssl_certificate /etc/letsencrypt/live/pd4e.com/fullchain.pem; # managed by Certbot
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/pd4e.com/privkey.pem; # managed by Certbot
|
|
||||||
}
|
|
||||||
server {
|
|
||||||
if ($host = pd4e.com) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
} # managed by Certbot
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
path = params_kw.get('audiofile')
|
|
||||||
print(f'whisper.generate.dspy, {params_kw=}, {file_realpath=}, {stt_engine=}' )
|
|
||||||
x = await stt_engine.stt(file_realpath(path))
|
|
||||||
return x
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
from ahserver.serverenv import ServerEnv
|
|
||||||
from appPublic.worker import awaitify
|
|
||||||
import whisper
|
|
||||||
class Whisper:
|
|
||||||
def __init__(self, model_name):
|
|
||||||
self.model = whisper.load_model(model_name)
|
|
||||||
|
|
||||||
def _stt(self, filepath):
|
|
||||||
return self.model.transcribe(filepath)
|
|
||||||
|
|
||||||
stt = awaitify(_stt)
|
|
||||||
|
|
||||||
w = Whisper('medium')
|
|
||||||
g = ServerEnv()
|
|
||||||
g.stt_engine = w
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import asyncio
|
|
||||||
import sys
|
|
||||||
async def main():
|
|
||||||
t = await g.stt_engine.stt(sys.argv[1])
|
|
||||||
print(t)
|
|
||||||
|
|
||||||
asyncio.get_event_loop().run_until_complete(main())
|
|
||||||
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
openai-whisper
|
|
||||||
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
apikey='ffd0affcb6b5f9368f517c09c75a6817.jp9DdpcgwdxXvDiT'
|
|
||||||
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
from zhipuai import ZhipuAI
|
|
||||||
from ahserver.globalEnv import ServerEnv
|
|
||||||
from appPublic.worker import awaitify
|
|
||||||
from key import apikey
|
|
||||||
from aiohttp import web
|
|
||||||
|
|
||||||
def get_user_apikey(appname, user):
|
|
||||||
return apikey
|
|
||||||
|
|
||||||
class ZhiPuAi:
|
|
||||||
def __init__(self, user):
|
|
||||||
apikey = get_user_apikey('zhipuai', user)
|
|
||||||
if apikey is None:
|
|
||||||
raise Exception(f'{user} not registered zhipuAI appkey')
|
|
||||||
self.client = ZhipuAI(api_key=apikey)
|
|
||||||
|
|
||||||
def _generate(self, p, model, h, stream):
|
|
||||||
h.append({
|
|
||||||
'role':'user',
|
|
||||||
'content':p
|
|
||||||
})
|
|
||||||
resp = self.client.chat.completions.create(model=model, messages=h, stream=stream)
|
|
||||||
return resp
|
|
||||||
|
|
||||||
def generate(self, p, model='glm-4', history=[], stream=True, chunk_func=None):
|
|
||||||
reco = awaitify(self._generate)
|
|
||||||
resp = await reco(p, model, history, stream)
|
|
||||||
if stream:
|
|
||||||
for chunk in resp:
|
|
||||||
await chunk_func(chunk.choices[0].delta.content)
|
|
||||||
else:
|
|
||||||
return resp.choices[0].message.content
|
|
||||||
|
|
||||||
def zhipuai_chat():
|
|
||||||
user = get_user()
|
|
||||||
resp = web.StreamResponse()
|
|
||||||
resp.prepare(request)
|
|
||||||
p = params_kw.get('prompt')
|
|
||||||
model = params_kw.get('model', 'glm-4')
|
|
||||||
h = params_kw.get('history', [])
|
|
||||||
stream = params_kw.get('stream', True)
|
|
||||||
ai = ZhiPuAi(user)
|
|
||||||
content = await ai.generate(p, model, h, stream, resp.write)
|
|
||||||
if stream:
|
|
||||||
return resp
|
|
||||||
return content
|
|
||||||
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
zhipuai
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user