lang_model.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # -*- coding: utf-8 -*-
  2. from .__load__ import *
  3. class lang_model_path(Load):
  4. @Web.auth
  5. @Web.setting
  6. def get(self):
  7. self.set(
  8. name = u'语言模型'
  9. ,path = '/lang_model/lang_model'
  10. ,width = '600'
  11. ,height = '600'
  12. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'模型名称'))
  13. ,thead = (u'模型名称', u'模型渠道', u'模型标识', u'创建时间')
  14. ,tbody = ('name', 'channel', 'model', 'time')
  15. ,state = True
  16. )
  17. self.list('lang_model')
  18. if self.data['list']:
  19. llm = Demeter.config['llm']
  20. for key, value in enumerate(self.data['list']):
  21. id = str(value['id'])
  22. self.data['list'][key]['time'] = Demeter.date(value['cdate'])
  23. self.data['list'][key]['channel'] = llm[value['channel']]
  24. self.show('list')
  25. class lang_model_update_path(Load):
  26. @Web.auth
  27. @Web.setting
  28. def get(self):
  29. llm = Demeter.config['llm']
  30. channel = []
  31. for key, value in llm.items():
  32. channel.append({'id':key, 'name':value})
  33. status = [
  34. {'id':'1', 'name': '正常'},
  35. {'id':'2', 'name': '封禁'},
  36. ]
  37. self.set(
  38. path = '/lang_model/lang_model'
  39. ,label = (u'模型名称',u'模型渠道',u'模型标识')
  40. ,update = ('name-input-required','channel-select-required','model-input-required')
  41. ,update_channel = channel
  42. #,update_status = status
  43. )
  44. self.one('lang_model')
  45. self.show('update')
  46. @Web.auth
  47. @Web.setting
  48. def post(self):
  49. self.update('lang_model')
  50. @Web.auth
  51. @Web.setting
  52. def delete(self):
  53. self.drop('lang_model')