Skip to content

Commit

Permalink
Fix: Repull code from sz134055 #387
Browse files Browse the repository at this point in the history
  • Loading branch information
Samueli924 authored Nov 20, 2024
1 parent f4075d0 commit 2729a3c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/answer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import configparser
import requests
from pathlib import Path
from typing import Optional
import json
from api.logger import logger
import random
Expand All @@ -20,7 +19,7 @@ def __init__(self, file: str = "cache.json"):
self.cacheFile.open("w").write("{}")
self.fp = self.cacheFile.open("r+", encoding="utf8")

def getCache(self, question: str) -> Optional[str]:
def getCache(self, question: str):
self.fp.seek(0)
data = json.load(self.fp)
if isinstance(data, dict):
Expand Down Expand Up @@ -83,7 +82,7 @@ def _init_tiku(self):
# 仅用于题库初始化,例如配置token,交由自定义题库完成
pass

def config_set(self,config:configparser.ConfigParser|None):
def config_set(self,config):
self._conf = config

def _get_conf(self):
Expand All @@ -99,7 +98,7 @@ def _get_conf(self):
self.DISABLE = True
return None

def query(self,q_info:dict) -> str|None:
def query(self,q_info:dict):
if self.DISABLE:
return None

Expand Down

0 comments on commit 2729a3c

Please sign in to comment.