rm deprecated codes
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
import streamlit as st
|
||||
from langchain.chains import LLMChain
|
||||
from langchain.prompts import PromptTemplate
|
||||
from langchain_community.chat_models import ChatOllama
|
||||
from langchain_ollama import ChatOllama
|
||||
from utils import parse_config
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class TranslatorApp:
|
||||
input_variables=['input_text', 'source_lang', 'target_lang', 'rule'],
|
||||
template=template
|
||||
)
|
||||
return LLMChain(llm=llm, prompt=prompt)
|
||||
return prompt | llm
|
||||
|
||||
def run(self) -> None:
|
||||
""" Run the Streamlit app """
|
||||
@ -75,12 +75,12 @@ class TranslatorApp:
|
||||
with st.spinner('翻譯中...'):
|
||||
|
||||
source_lang, target_lang, rule = self._lang_directions[direction]
|
||||
result = self._chain.run({
|
||||
result = self._chain.invoke({
|
||||
'input_text': input_text,
|
||||
'source_lang': source_lang,
|
||||
'target_lang': target_lang,
|
||||
'rule': rule
|
||||
}).strip()
|
||||
}).content
|
||||
|
||||
output_container.text_area(
|
||||
label='Output',
|
||||
|
||||
Reference in New Issue
Block a user