Signed-off-by: -LAN- <laipz8200@outlook.com>tags/0.13.0
| OAUTH_DATASOURCE_PROVIDERS = get_oauth_providers() | OAUTH_DATASOURCE_PROVIDERS = get_oauth_providers() | ||||
| with current_app.app_context(): | with current_app.app_context(): | ||||
| oauth_provider = OAUTH_DATASOURCE_PROVIDERS.get(provider) | oauth_provider = OAUTH_DATASOURCE_PROVIDERS.get(provider) | ||||
| print(vars(oauth_provider)) | |||||
| if not oauth_provider: | if not oauth_provider: | ||||
| return {"error": "Invalid provider"}, 400 | return {"error": "Invalid provider"}, 400 | ||||
| if dify_config.NOTION_INTEGRATION_TYPE == "internal": | if dify_config.NOTION_INTEGRATION_TYPE == "internal": |
| OAUTH_PROVIDERS = get_oauth_providers() | OAUTH_PROVIDERS = get_oauth_providers() | ||||
| with current_app.app_context(): | with current_app.app_context(): | ||||
| oauth_provider = OAUTH_PROVIDERS.get(provider) | oauth_provider = OAUTH_PROVIDERS.get(provider) | ||||
| print(vars(oauth_provider)) | |||||
| if not oauth_provider: | if not oauth_provider: | ||||
| return {"error": "Invalid provider"}, 400 | return {"error": "Invalid provider"}, 400 | ||||
| json_obj = json.loads(action_match.group(0).strip()) | json_obj = json.loads(action_match.group(0).strip()) | ||||
| else: | else: | ||||
| json_obj = [] | json_obj = [] | ||||
| print(f"Could not parse LLM output: {text}") | |||||
| return json_obj | return json_obj |
| except LookupError: | except LookupError: | ||||
| nltk.download("punkt") | nltk.download("punkt") | ||||
| nltk.download("stopwords") | nltk.download("stopwords") | ||||
| print("run download") | |||||
| e_str = re.sub(r"[^\w ]", "", query) | e_str = re.sub(r"[^\w ]", "", query) | ||||
| all_tokens = nltk.word_tokenize(e_str) | all_tokens = nltk.word_tokenize(e_str) | ||||
| stop_words = stopwords.words("english") | stop_words = stopwords.words("english") |
| self.submit_count -= 1 | self.submit_count -= 1 | ||||
| def check_is_full(self) -> None: | def check_is_full(self) -> None: | ||||
| print(f"submit_count: {self.submit_count}, max_submit_count: {self.max_submit_count}") | |||||
| if self.submit_count > self.max_submit_count: | if self.submit_count > self.max_submit_count: | ||||
| raise ValueError(f"Max submit count {self.max_submit_count} of workflow thread pool reached.") | raise ValueError(f"Max submit count {self.max_submit_count} of workflow thread pool reached.") | ||||