Merge 43b5d6ac6a
into a30945312a
This commit is contained in:
commit
139e4870b1
@ -191,8 +191,18 @@ class LLMNode(BaseNode[LLMNodeData]):
|
||||
# deduct quota
|
||||
self.deduct_llm_quota(tenant_id=self.tenant_id, model_instance=model_instance, usage=usage)
|
||||
break
|
||||
outputs = {"text": result_text, "usage": jsonable_encoder(usage), "finish_reason": finish_reason}
|
||||
|
||||
outputs = {
|
||||
"text": result_text,
|
||||
"usage": jsonable_encoder(usage),
|
||||
"finish_reason": finish_reason,
|
||||
"json": {},
|
||||
}
|
||||
if model_config.parameters.get("response_format") in ["json_object", "JSON"]:
|
||||
try:
|
||||
result_dict = json.loads(result_text)
|
||||
except:
|
||||
result_dict = {}
|
||||
outputs.update({"json": result_dict})
|
||||
yield RunCompletedEvent(
|
||||
run_result=NodeRunResult(
|
||||
status=WorkflowNodeExecutionStatus.SUCCEEDED,
|
||||
|
@ -139,7 +139,16 @@ const formatItem = (
|
||||
}
|
||||
|
||||
case BlockEnum.LLM: {
|
||||
res.vars = LLM_OUTPUT_STRUCT
|
||||
res.vars = [
|
||||
...LLM_OUTPUT_STRUCT,
|
||||
...(['json_object', 'JSON'].includes(data.model?.completion_params?.response_format)
|
||||
? [{
|
||||
variable: 'json',
|
||||
type: VarType.object,
|
||||
}]
|
||||
: []),
|
||||
]
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -289,6 +289,14 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||
type='string'
|
||||
description={t(`${i18nPrefix}.outputVars.output`)}
|
||||
/>
|
||||
{['json_object', 'JSON'].includes(model?.completion_params?.response_format)
|
||||
&& (
|
||||
<VarItem
|
||||
name="json"
|
||||
type="object"
|
||||
description={t(`${i18nPrefix}.outputVars.json`)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
</OutputVars>
|
||||
{isShowSingleRun && (
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Generierter Inhalt',
|
||||
usage: 'Nutzungsinformationen des Modells',
|
||||
json: 'Generierter Inhalt JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variable',
|
||||
|
@ -412,6 +412,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Generate content',
|
||||
usage: 'Model Usage Information',
|
||||
json: 'Generate content JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variable',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Generar contenido',
|
||||
usage: 'Información de uso del modelo',
|
||||
json: 'Generar contenido JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variable',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'تولید محتوا',
|
||||
usage: 'اطلاعات استفاده از مدل',
|
||||
json: 'تولید محتوا JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'متغیر',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Contenu généré',
|
||||
usage: 'Informations sur l\'utilisation du modèle',
|
||||
json: 'Contenu généré JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variable',
|
||||
|
@ -412,6 +412,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'सामग्री उत्पन्न करें',
|
||||
usage: 'मॉडल उपयोग जानकारी',
|
||||
json: 'सामग्री उत्पन्न करें JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'वेरिएबल',
|
||||
|
@ -416,6 +416,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Genera contenuto',
|
||||
usage: 'Informazioni sull\'utilizzo del modello',
|
||||
json: 'Genera contenuto JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variabile',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'コンテンツを生成',
|
||||
usage: 'モデルの使用情報',
|
||||
json: 'コンテンツを生成 JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: '変数',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: '생성된 내용',
|
||||
usage: '모델 사용 정보',
|
||||
json: '생성된 내용 JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: '변수',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Generowana treść',
|
||||
usage: 'Informacje o użyciu modelu',
|
||||
json: 'Generowana treść JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Zmienna',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Conteúdo gerado',
|
||||
usage: 'Informações de uso do modelo',
|
||||
json: 'Conteúdo gerado JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variável',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Conținut generat',
|
||||
usage: 'Informații de utilizare a modelului',
|
||||
json: 'Conținut generat JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Variabilă',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Создать контент',
|
||||
usage: 'Информация об использовании модели',
|
||||
json: 'Создать контент JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Переменная',
|
||||
|
@ -348,6 +348,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Generirana vsebina',
|
||||
usage: 'Podatki o uporabi modela',
|
||||
json: 'Generirana vsebina JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Spremenljivka',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'สร้างเนื้อหา',
|
||||
usage: 'ข้อมูลการใช้งานรุ่น',
|
||||
json: 'สร้างเนื้อหา JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'ตัวแปร',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'İçerik Üret',
|
||||
usage: 'Model Kullanım Bilgileri',
|
||||
json: 'İçerik Üret JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Değişken',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Генерований вміст',
|
||||
usage: 'Інформація про використання моделі',
|
||||
json: 'Генерований вміст JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Змінна',
|
||||
|
@ -399,6 +399,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: 'Nội dung được tạo',
|
||||
usage: 'Thông tin sử dụng mô hình',
|
||||
json: 'Nội dung được tạo JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: 'Biến',
|
||||
|
@ -413,6 +413,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: '生成内容',
|
||||
usage: '模型用量信息',
|
||||
json: '生成内容 JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: '变量',
|
||||
|
@ -401,6 +401,7 @@ const translation = {
|
||||
outputVars: {
|
||||
output: '生成內容',
|
||||
usage: '模型用量信息',
|
||||
json: '生成內容 JSON',
|
||||
},
|
||||
singleRun: {
|
||||
variable: '變量',
|
||||
|
Loading…
Reference in New Issue
Block a user