Inclusion Criteria:  Be ≥ 18 years of age; Subjects must have a histopathological or cytological diagnosis of locally advanced or metastatic gallbladder cancer (GBC) or cholangiocarcinoma (CCA); Subjects who have not received prior systemic therapy for advanced disease or who have received adjuvant or neoadjuvant chemotherapy in one regimen and relapsed > 6 months after the end of chemotherapy can be enrolled; Child-Pugh liver function rating: class A (5-6 points) and better class B (7 points) (see Appendix 3); ECOG PS score 0 or 1 (see Appendix 1); Expected survival ≥ 12 weeks; Subjects with at least one measurable lesion (RECIST 1.1 criteria, see Appendix 2); Subject must have adequate major organ and bone marrow functions (no blood transfusion and no use of hematopoietic growth factor within 14 days before the first dose of study treatment):  1) Hematology: neutrophils ≥ 1.5 × 109/L, platelets ≥ 100 × 109/L, and hemoglobin ≥ 90 g/L; 2) International normalized ratio (INR) ≤ 1.5 × upper limit of normal (ULN) and activated partial thromboplastin time (APTT) ≤ 1.5 × ULN; 3) Liver function: serum total bilirubin ≤ 1.5 × ULN or direct bilirubin ≤ ULN for subjects with total bilirubin levels >1.5 ULN; Aspartate aminotransferase (AST [SGOT]) and alanine aminotransferase (ALT [SGPT]) ≤ 2.5 × ULN OR ≤ 5 × ULN for subjects with liver metastases; 4) Renal function: serum creatinine ≤ 1.5 x ULN and creatinine clearance (CCr) > 60 mL/min (assessed with Cockcroft-Gault formula, see Appendix 6); 5) Normal cardiac function with left ventricular ejection fraction (LVEF) ≥ 50% by two-dimensional echocardiography.  9. Subjects must fully understand the study, voluntarily participate, and sign the informed consent form (ICF).  Exclusion Criteria:  Has participated in another clinical trials of other investigational drugs or investigational devices within 4 weeks prior to the first dose of investigational product treatment (palliative radiotherapy for bone metastases completed at least 2 weeks prior to investigational product treatment is allowed); The investigator assesses liver metastases as 50% or more of the total liver volume; Has ascites requiring drainage or treatment with diuretics, or pleural or pericardial effusion requiring drainage and/or associated with symptoms of tachypnea within 4 weeks prior to the first dose of investigational product treatment; Has biliary obstruction with clinical intervention that has not resolved or requires anti-infective therapy as judged by the investigator 14 days prior to the first dose of investigational product treatment; Has prior liver transplantation; Has known active brain metastases or spinal cord compression; subjects with previously treated brain metastases may be enrolled if their clinical condition is stable and radiographic evidence shows no disease progression within 4 weeks prior to the first dose of investigational product treatment, and corticosteroid therapy is not required within 4 weeks prior to the first dose of investigational product treatment; Has a known additional malignant tumor in the past 5 years (except for skin basal cell or squamous cell carcinoma, or cervical, breast and other carcinoma in situ after radical surgery); Has received major surgical procedures (except biopsy) or incomplete healing of surgical wound within 4 weeks prior to the first dose of investigational product treatment; Has any unresolved toxicity (CTCAE Grade ≥ 2) from prior anti-tumor therapy, except for alopecia or Grade 2 peripheral neuropathy or other laboratory abnormalities that are not clinically significant as assessed by the investigator; Has an active autoimmune disease or a documented history of autoimmune disease or syndrome that requires systemic steroids or immunosuppressive agents. Subjects with vitiligo or resolved childhood asthma/atopy would be exception to this rule. Subjects who require intermittent use of bronchodilators or local steroid injections would not be excluded from the study. Subjects with hypothyroidism that is stable on hormone replacement will not be excluded from the study; Has known history of HIV, or active bacterial or fungal infection requiring systemic treatment within 14 days prior to the first dose of investigational product treatment; Has history of interstitial lung disease, drug-induced interstitial lung disease, radiation pneumonitis, symptomatic interstitial lung disease or presence of active pneumonitis on chest CT scan within 4 weeks before the first dose of investigational product treatment; Has active hepatitis B (HBsAg positive and HBV-DNA ≥ 104 copies/mL) or hepatitis C (HCV antibody positive and HCV-RNA quantitative test results greater than the lower limit of detection); Has a history or current evidence of clinically significant cardiovascular diseases, including but not limited to acute myocardial infarction, severe/unstable angina, acute ischemic/hemorrhagic stroke, congestive heart failure (≥ New York Heart Association Class II, see Appendix 4) within 6 months prior to enrollment; arrhythmias requiring treatment with other antiarrhythmic drugs in addition to β-blockers or digoxin; repeat QTcF interval > 450 milliseconds (ms) on ECG (see Appendix 5); hypertension not well controlled with antihypertensive drug therapy (systolic blood pressure > 150 mmHg, diastolic blood pressure > 100 mmHg); Be receiving therapeutic doses of warfarin (low-dose warfarin ≤ 2 mg/day is allowed); or receiving antiplatelet anticoagulant therapy (aspirin doses ≤ 300 mg/day and clopidogrel doses ≤ 75 mg/day are allowed); Has received immunosuppressive drugs within 4 weeks prior to the first dose of investigational product treatment, excluding topical corticosteroids or systemic prednisone ≤ 10 mg/day or equivalent doses of other corticosteroids; Has received live vaccines within 4 weeks before the first dose of investigational product treatment or plan to receive it during the study; Has history of severe allergic reactions to chimeric or human antibodies or fusion proteins, or known allergies to biological products produced with Chinese hamster ovary cells or any component of envafolimab; known or suspected allergy to the chemotherapeutic drug gemcitabine/cisplatin and its components; Be pregnant or breastfeeding; Be childbearing potential but unwilling to accept effective contraceptive measures; Any other disease, metabolic disorder or laboratory abnormalities, that the investigator considers that the subject is not suitable for the investigational product treatment, or will affect the interpretation of the study results, or put the subject at high risk.