@@ -9,6 +9,7 @@ class LLMInstance(db.Model):
99 id = db .Column (db .Integer , primary_key = True , autoincrement = True , comment = '自增id' )
1010 llm_code = db .Column (db .String (255 ), comment = '基模型实例编号' )
1111 llm_name = db .Column (db .String (255 ), nullable = False , comment = '基模型名称' )
12+ llm_label = db .Column (db .String (255 ), nullable = False , comment = '模型显示标签' )
1213 user_id = db .Column (db .Integer , nullable = False , comment = '创建用户' )
1314 llm_api_secret_key = db .Column (db .String (1000 ), comment = '基模型认证钥匙' )
1415 llm_api_access_key = db .Column (db .String (1000 ), comment = '基模型访问钥匙' )
@@ -35,14 +36,19 @@ class LLMInstance(db.Model):
3536 is_std_openai = db .Column (db .Boolean , default = True , comment = '是否支持openai-sdk' )
3637 support_vis = db .Column (db .Boolean , default = False , comment = '是否支持视觉' )
3738 support_file = db .Column (db .Boolean , default = False , comment = '是否支持文件' )
39+ extra_headers = db .Column (db .JSON , comment = '请求头' , default = {})
40+ extra_body = db .Column (db .JSON , comment = '请求体' , default = {})
41+ use_default = db .Column (db .Boolean , default = True , comment = '是否使用默认配置' )
3842 create_time = db .Column (db .TIMESTAMP , server_default = func .now (), comment = '创建时间' )
3943 update_time = db .Column (db .TIMESTAMP , server_default = func .now (), comment = '更新时间' )
4044
4145 def to_dict (self ):
4246 return {
4347 "llm_code" : self .llm_code ,
4448 "llm_name" : self .llm_name ,
49+ "llm_label" : self .llm_label ,
4550 "user_id" : self .user_id ,
51+ "llm_icon" : self .llm_icon ,
4652 "llm_type" : self .llm_type ,
4753 "llm_desc" : self .llm_desc ,
4854 "llm_tags" : self .llm_tags ,
@@ -53,7 +59,6 @@ def to_dict(self):
5359 "llm_status" : self .llm_status ,
5460 "llm_source" : self .llm_source ,
5561 "llm_is_public" : self .llm_is_public ,
56- "llm_icon" : self .llm_icon if self .llm_icon else "" ,
5762 "create_time" : self .create_time .strftime ('%Y-%m-%d %H:%M:%S' ),
5863 "update_time" : self .update_time .strftime ('%Y-%m-%d %H:%M:%S' ),
5964 "frequency_penalty" : self .frequency_penalty ,
@@ -68,19 +73,105 @@ def to_dict(self):
6873 "is_std_openai" : self .is_std_openai ,
6974 "support_file" : self .support_file ,
7075 "support_vis" : self .support_vis ,
76+ "extra_headers" : self .extra_headers ,
77+ "extra_body" : self .extra_body ,
78+ "use_default" : self .use_default ,
7179 }
7280
7381 def show_info (self ):
7482 return {
83+ "user_id" : self .user_id ,
7584 "llm_code" : self .llm_code ,
7685 "llm_name" : self .llm_name ,
86+ "llm_company" : self .llm_company if self .llm_company else "未知厂商" ,
87+ "llm_label" : self .llm_label if self .llm_label else "" ,
7788 "llm_type" : self .llm_type ,
7889 "llm_desc" : self .llm_desc ,
7990 "llm_icon" : self .llm_icon ,
91+ "llm_tags" : self .llm_tags ,
8092 "llm_status" : self .llm_status ,
8193 "llm_is_proxy" : self .llm_is_proxy ,
8294 "support_vis" : self .support_vis ,
8395 "support_file" : self .support_file ,
8496 "create_time" : self .create_time .strftime ('%Y-%m-%d %H:%M:%S' ),
8597 "update_time" : self .update_time .strftime ('%Y-%m-%d %H:%M:%S' ),
86- }
98+ }
99+
100+
101+ class LLMInstanceAuthorizeInfo (db .Model ):
102+ """
103+ 基模型实例授权信息表
104+ """
105+ __tablename__ = 'llm_instance_authorize_info'
106+ id = db .Column (db .Integer , primary_key = True , autoincrement = True , comment = '自增id' )
107+ user_id = db .Column (db .Integer , nullable = False , comment = '用户id' )
108+ model_id = db .Column (db .Integer , nullable = False , comment = '模型id' )
109+ auth_colleague_id = db .Column (db .Integer , comment = '被授权用户id' )
110+ auth_department_id = db .Column (db .Integer , comment = '被授权部门id' )
111+ auth_company_id = db .Column (db .Integer , comment = '被授权公司id' )
112+ auth_friend_id = db .Column (db .Integer , comment = '被授权联系人id' )
113+ auth_type = db .Column (db .String (255 ), nullable = False , comment = '授权类型' )
114+ auth_status = db .Column (db .String (255 ), nullable = False , comment = '授权状态' )
115+ create_time = db .Column (db .TIMESTAMP , server_default = func .now (), comment = '创建时间' )
116+ update_time = db .Column (db .TIMESTAMP , server_default = func .now (), comment = '更新时间' )
117+
118+ def to_dict (self ):
119+ return {
120+ "id" : self .id ,
121+ "user_id" : self .user_id ,
122+ "model_id" : self .model_id ,
123+ "auth_colleague_id" : self .auth_colleague_id ,
124+ "auth_department_id" : self .auth_department_id ,
125+ "auth_company_id" : self .auth_company_id ,
126+ "auth_friend_id" : self .auth_friend_id ,
127+ "auth_type" : self .auth_type ,
128+ "auth_status" : self .auth_status ,
129+ "create_time" : self .create_time .strftime ('%Y-%m-%d %H:%M:%S' ),
130+ "update_time" : self .update_time .strftime ('%Y-%m-%d %H:%M:%S' ),
131+ }
132+
133+
134+ class LLMSupplierInfo (db .Model ):
135+ """
136+ 基模型厂商信息表
137+ """
138+ __tablename__ = 'llm_supplier_info'
139+ id = db .Column (db .Integer , primary_key = True , autoincrement = True , comment = '自增id' )
140+ supplier_code = db .Column (db .String (255 ), nullable = False , comment = '基模型厂商编号' )
141+ supplier_name = db .Column (db .String (255 ), nullable = False , comment = '基模型厂商名称' )
142+ supplier_desc = db .Column (db .Text , comment = '基模型厂商描述' )
143+ supplier_icon = db .Column (db .Text , comment = '基模型厂商图标' )
144+ supplier_type = db .Column (db .String (10 ), comment = '基模型厂商类型' )
145+ supplier_website = db .Column (db .String (255 ), comment = '基模型厂商官网' )
146+ supplier_models = db .Column (db .JSON , comment = '基模型厂商支持的模型列表' )
147+ supplier_api_url = db .Column (db .Text , comment = '基模型厂商API地址' )
148+ supplier_status = db .Column (db .String (255 ), comment = '基模型厂商状态' , default = '正常' )
149+ create_time = db .Column (db .TIMESTAMP , server_default = func .now (), comment = '创建时间' )
150+ update_time = db .Column (db .TIMESTAMP , server_default = func .now (), comment = '更新时间' )
151+
152+ def to_dict (self ):
153+ return {
154+ "id" : self .id ,
155+ "supplier_code" : self .supplier_code ,
156+ "supplier_name" : self .supplier_name ,
157+ "supplier_desc" : self .supplier_desc ,
158+ "supplier_icon" : self .supplier_icon ,
159+ "supplier_website" : self .supplier_website ,
160+ "supplier_models" : self .supplier_models ,
161+ "supplier_api_url" : self .supplier_api_url ,
162+ "supplier_type" : self .supplier_type ,
163+ "supplier_status" : self .supplier_status ,
164+ "create_time" : self .create_time .strftime ('%Y-%m-%d %H:%M:%S' ),
165+ "update_time" : self .update_time .strftime ('%Y-%m-%d %H:%M:%S' ),
166+ }
167+
168+ def show_info (self ):
169+ return {
170+ "id" : self .id ,
171+ "supplier_code" : self .supplier_code ,
172+ "supplier_name" : self .supplier_name ,
173+ "supplier_desc" : self .supplier_desc ,
174+ "supplier_icon" : self .supplier_icon ,
175+ "supplier_type" : self .supplier_type ,
176+ }
177+
0 commit comments