MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / handler

Method handler

apps/chat/serializers/chat.py:103–130  ·  view source on GitHub ↗
(self,
                    chat_id,
                    chat_record_id,
                    paragraph_list: List[Paragraph],
                    problem_text: str,
                    answer_text,
                    manage: PipelineManage,
                    step: BaseChatStep,
                    padding_problem_text: str = None,
                    **kwargs)

Source from the content-addressed store, hash-verified

101 class PostHandler(PostResponseHandler):
102
103 def handler(self,
104 chat_id,
105 chat_record_id,
106 paragraph_list: List[Paragraph],
107 problem_text: str,
108 answer_text,
109 manage: PipelineManage,
110 step: BaseChatStep,
111 padding_problem_text: str = None,
112 **kwargs):
113 answer_list = [[Answer(answer_text, 'ai-chat-node', 'ai-chat-node', 'ai-chat-node', {}, 'ai-chat-node',
114 kwargs.get('reasoning_content', '')).to_dict()]]
115 chat_record = ChatRecord(id=chat_record_id,
116 chat_id=chat_id,
117 problem_text=problem_text,
118 answer_text=answer_text,
119 details=manage.get_details(),
120 message_tokens=manage.context['message_tokens'],
121 answer_tokens=manage.context['answer_tokens'],
122 answer_text_list=answer_list,
123 run_time=manage.context['run_time'],
124 index=len(chat_info.chat_record_list) + 1,
125 ip_address=chat_info.ip_address,
126 source=chat_info.source
127 )
128 chat_info.append_chat_record(chat_record)
129 # 重新设置缓存
130 chat_info.set_cache()
131
132 return PostHandler()
133

Callers

nothing calls this directly

Calls 7

AnswerClass · 0.90
ChatRecordClass · 0.90
append_chat_recordMethod · 0.80
set_cacheMethod · 0.80
to_dictMethod · 0.45
getMethod · 0.45
get_detailsMethod · 0.45

Tested by

no test coverage detected