Closed coderfengyun closed 1 year ago
from langchain.document_loaders import ConfluenceLoader import lxml loader = ConfluenceLoader( url="https://confluence.zhenguanyu.com/", token= {CONFLUENCE_TOKEN}, cloud=False ) page_id = 192873905 raw_cql = f"type = page AND ancestor = {page_id}" documents = loader.load(cql=raw_cql, include_attachments=False, limit=50)
比如上述代码即会报如下错误
start --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[40], line 11 9 page_id = 192873905 10 raw_cql = f"type = page AND ancestor = {page_id}" ---> 11 documents = loader.load(cql=raw_cql, include_attachments=False, limit=50) File ~/code/git/github/langchain/langchain/document_loaders/confluence.py:251, in ConfluenceLoader.load(self, space_key, page_ids, label, cql, include_restricted_content, include_archived_content, include_attachments, include_comments, limit, max_pages) 242 pages = self.paginate_request( 243 self.confluence.cql, 244 cql=cql, (...) 248 expand="body.storage.value", 249 ) 250 print(pages[1]) --> 251 ids_by_cql = [page["content"]["id"] for page in pages] 252 if page_ids: 253 page_ids = list(set(page_ids + ids_by_cql)) File ~/code/git/github/langchain/langchain/document_loaders/confluence.py:251, in <listcomp>(.0) 242 pages = self.paginate_request( 243 self.confluence.cql, 244 cql=cql, (...) 248 expand="body.storage.value", 249 ) 250 print(pages[1]) --> 251 ids_by_cql = [page["content"]["id"] for page in pages] 252 if page_ids: 253 page_ids = list(set(page_ids + ids_by_cql)) TypeError: string indices must be integers, not 'str'
fixed by this PR: https://github.com/hwchase17/langchain/pull/5878
比如上述代码即会报如下错误