from aiohttp import web from api.controller.ChatComplete import ChatComplete from api.controller.Hanzi import Hanzi from api.controller.Index import Index from api.controller.Kanji import Kanji from api.controller.Hanja import Hanja from api.controller.EmbeddingSearch import EmbeddingSearch def init(app: web.Application): app.router.add_routes([ web.route('*', '/hanzi/pinyin/', Hanzi.hanziToPinyin), web.route('*', '/hanzi/split/', Hanzi.splitHanzi), web.route('*', '/kanji/romaji/', Kanji.kanji2romaji), web.route('*', '/hanja/romaja/', Hanja.hanja2roma), web.route('*', '/title/info', Index.update_title_info), web.route('*', '/title/search', Index.search_title), web.route('*', '/user/info', Index.get_user_info), web.route('*', '/conversation/list', Index.get_conversation_list), web.route('*', '/conversation/info', Index.get_conversation_info), web.route('POST', '/conversation/remove', Index.remove_conversation), web.route('DELETE', '/conversation/remove', Index.remove_conversation), web.route('POST', '/conversation/set_pinned', Index.set_conversation_pinned), web.route('POST', '/conversation/set_title', Index.set_conversation_title), web.route('*', '/embedding_search/index_page', EmbeddingSearch.index_page), web.route('*', '/embedding_search/search', EmbeddingSearch.search), web.route('POST', '/sys/embedding_search/title/update', EmbeddingSearch.sys_update_title_info), web.route('*', '/chatcomplete/conversation_chunk/list', ChatComplete.get_conversation_chunk_list), web.route('*', '/chatcomplete/conversation_chunk/info', ChatComplete.get_conversation_chunk), web.route('POST', '/chatcomplete/conversation/fork', ChatComplete.fork_conversation), web.route('POST', '/chatcomplete/message', ChatComplete.start_chat_complete), web.route('GET', '/chatcomplete/message/stream', ChatComplete.chat_complete_stream), web.route('POST', '/chatcomplete/get_point_cost', ChatComplete.get_point_cost), web.route('*', '/chatcomplete/persona/list', ChatComplete.get_persona_list), web.route('*', '/chatcomplete/persona/info', ChatComplete.get_persona_info), ])