| from core.model_manager import ModelInstance, ModelManager | from core.model_manager import ModelInstance, ModelManager | ||||
| from core.model_runtime.entities.llm_entities import LLMUsage | from core.model_runtime.entities.llm_entities import LLMUsage | ||||
| from core.model_runtime.entities.model_entities import AIModelEntity, ModelType | from core.model_runtime.entities.model_entities import AIModelEntity, ModelType | ||||
| from core.model_runtime.utils.encoders import jsonable_encoder | |||||
| from core.plugin.entities.request import InvokeCredentials | from core.plugin.entities.request import InvokeCredentials | ||||
| from core.plugin.impl.exc import PluginDaemonClientSideError | from core.plugin.impl.exc import PluginDaemonClientSideError | ||||
| from core.plugin.impl.plugin import PluginInstaller | from core.plugin.impl.plugin import PluginInstaller | ||||
| yield RunCompletedEvent( | yield RunCompletedEvent( | ||||
| run_result=NodeRunResult( | run_result=NodeRunResult( | ||||
| status=WorkflowNodeExecutionStatus.SUCCEEDED, | status=WorkflowNodeExecutionStatus.SUCCEEDED, | ||||
| outputs={"text": text, "files": ArrayFileSegment(value=files), "json": json_output, **variables}, | |||||
| outputs={ | |||||
| "text": text, | |||||
| "usage": jsonable_encoder(llm_usage), | |||||
| "files": ArrayFileSegment(value=files), | |||||
| "json": json_output, | |||||
| **variables, | |||||
| }, | |||||
| metadata={ | metadata={ | ||||
| **agent_execution_metadata, | **agent_execution_metadata, | ||||
| WorkflowNodeExecutionMetadataKey.TOOL_INFO: tool_info, | WorkflowNodeExecutionMetadataKey.TOOL_INFO: tool_info, |
| BlockEnum.Agent, | BlockEnum.Agent, | ||||
| ] | ] | ||||
| export const AGENT_OUTPUT_STRUCT: Var[] = [ | |||||
| { | |||||
| variable: 'usage', | |||||
| type: VarType.object, | |||||
| }, | |||||
| ] | |||||
| export const LLM_OUTPUT_STRUCT: Var[] = [ | export const LLM_OUTPUT_STRUCT: Var[] = [ | ||||
| { | { | ||||
| variable: 'text', | variable: 'text', |
| import type { Field as StructField } from '@/app/components/workflow/nodes/llm/types' | import type { Field as StructField } from '@/app/components/workflow/nodes/llm/types' | ||||
| import { | import { | ||||
| AGENT_OUTPUT_STRUCT, | |||||
| HTTP_REQUEST_OUTPUT_STRUCT, | HTTP_REQUEST_OUTPUT_STRUCT, | ||||
| KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, | KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, | ||||
| LLM_OUTPUT_STRUCT, | LLM_OUTPUT_STRUCT, | ||||
| res.vars = [ | res.vars = [ | ||||
| ...outputs, | ...outputs, | ||||
| ...TOOL_OUTPUT_STRUCT, | ...TOOL_OUTPUT_STRUCT, | ||||
| ...AGENT_OUTPUT_STRUCT, | |||||
| ] | ] | ||||
| break | break | ||||
| } | } |
| type='String' | type='String' | ||||
| description={t(`${i18nPrefix}.outputVars.text`)} | description={t(`${i18nPrefix}.outputVars.text`)} | ||||
| /> | /> | ||||
| <VarItem | |||||
| name='usage' | |||||
| type='object' | |||||
| description={t(`${i18nPrefix}.outputVars.usage`)} | |||||
| /> | |||||
| <VarItem | <VarItem | ||||
| name='files' | name='files' | ||||
| type='Array[File]' | type='Array[File]' |
| transfer_method: 'Übertragungsmethode. Wert ist remote_url oder local_file', | transfer_method: 'Übertragungsmethode. Wert ist remote_url oder local_file', | ||||
| }, | }, | ||||
| text: 'Von Agenten generierte Inhalte', | text: 'Von Agenten generierte Inhalte', | ||||
| usage: 'Nutzungsinformationen des Modells', | |||||
| json: 'Vom Agenten generiertes JSON', | json: 'Vom Agenten generiertes JSON', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| }, | }, | ||||
| outputVars: { | outputVars: { | ||||
| text: 'agent generated content', | text: 'agent generated content', | ||||
| usage: 'Model Usage Information', | |||||
| files: { | files: { | ||||
| title: 'agent generated files', | title: 'agent generated files', | ||||
| type: 'Support type. Now only support image', | type: 'Support type. Now only support image', |
| }, | }, | ||||
| json: 'JSON generado por el agente', | json: 'JSON generado por el agente', | ||||
| text: 'Contenido generado por el agente', | text: 'Contenido generado por el agente', | ||||
| usage: 'Información de uso del modelo', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: 'Estrategia no seleccionada', | strategyNotSelected: 'Estrategia no seleccionada', |
| type: 'نوع پشتیبانی. اکنون فقط از تصویر پشتیبانی می کند', | type: 'نوع پشتیبانی. اکنون فقط از تصویر پشتیبانی می کند', | ||||
| }, | }, | ||||
| text: 'محتوای تولید شده توسط عامل', | text: 'محتوای تولید شده توسط عامل', | ||||
| usage: 'اطلاعات استفاده از مدل', | |||||
| json: 'عامل JSON را تولید کرد', | json: 'عامل JSON را تولید کرد', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| }, | }, | ||||
| json: 'JSON généré par l’agent', | json: 'JSON généré par l’agent', | ||||
| text: 'Contenu généré par l’agent', | text: 'Contenu généré par l’agent', | ||||
| usage: 'Informations sur l’utilisation du modèle', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: 'Stratégie non sélectionnée', | strategyNotSelected: 'Stratégie non sélectionnée', |
| title: 'एजेंट द्वारा उत्पन्न फ़ाइलें', | title: 'एजेंट द्वारा उत्पन्न फ़ाइलें', | ||||
| }, | }, | ||||
| text: 'एजेंट द्वारा उत्पन्न सामग्री', | text: 'एजेंट द्वारा उत्पन्न सामग्री', | ||||
| usage: 'मॉडल उपयोग जानकारी', | |||||
| json: 'एजेंट द्वारा उत्पन्न जेसन', | json: 'एजेंट द्वारा उत्पन्न जेसन', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| upload_file_id: 'Carica l\'ID del file', | upload_file_id: 'Carica l\'ID del file', | ||||
| }, | }, | ||||
| text: 'Contenuto generato dall\'agente', | text: 'Contenuto generato dall\'agente', | ||||
| usage: 'Informazioni sull\'utilizzo del modello', | |||||
| json: 'JSON generato dall\'agente', | json: 'JSON generato dall\'agente', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| }, | }, | ||||
| text: 'エージェント生成コンテンツ', | text: 'エージェント生成コンテンツ', | ||||
| json: 'エージェント生成の JSON', | json: 'エージェント生成の JSON', | ||||
| usage: 'モデル使用量', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: '戦略が選択されていません', | strategyNotSelected: '戦略が選択されていません', |
| }, | }, | ||||
| json: '에이전트 생성 JSON', | json: '에이전트 생성 JSON', | ||||
| text: '상담원이 생성한 콘텐츠', | text: '상담원이 생성한 콘텐츠', | ||||
| usage: '모델 사용 정보', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: '전략이 선택되지 않음', | strategyNotSelected: '전략이 선택되지 않음', |
| }, | }, | ||||
| json: 'Kod JSON wygenerowany przez agenta', | json: 'Kod JSON wygenerowany przez agenta', | ||||
| text: 'Treści generowane przez agentów', | text: 'Treści generowane przez agentów', | ||||
| usage: 'Informacje o użyciu modelu', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: 'Nie wybrano strategii', | strategyNotSelected: 'Nie wybrano strategii', |
| }, | }, | ||||
| json: 'JSON gerado pelo agente', | json: 'JSON gerado pelo agente', | ||||
| text: 'Conteúdo gerado pelo agente', | text: 'Conteúdo gerado pelo agente', | ||||
| usage: 'Informações de uso do modelo', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: 'Estratégia não selecionada', | strategyNotSelected: 'Estratégia não selecionada', |
| url: 'Adresa URL a imaginii', | url: 'Adresa URL a imaginii', | ||||
| }, | }, | ||||
| text: 'Conținut generat de agent', | text: 'Conținut generat de agent', | ||||
| usage: 'Informații de utilizare a modelului', | |||||
| json: 'JSON generat de agent', | json: 'JSON generat de agent', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| title: 'Файлы, созданные агентом', | title: 'Файлы, созданные агентом', | ||||
| }, | }, | ||||
| text: 'Контент, генерируемый агентом', | text: 'Контент, генерируемый агентом', | ||||
| usage: 'Информация об использовании модели', | |||||
| json: 'JSON, сгенерированный агентом', | json: 'JSON, сгенерированный агентом', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| }, | }, | ||||
| json: 'agent generiran json', | json: 'agent generiran json', | ||||
| text: 'vsebina, ki jo je ustvaril agent', | text: 'vsebina, ki jo je ustvaril agent', | ||||
| usage: 'informacije o uporabi modela', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: 'Strategija ni izbrana', | strategyNotSelected: 'Strategija ni izbrana', |
| type: 'ประเภทการสนับสนุน ตอนนี้รองรับเฉพาะรูปภาพ', | type: 'ประเภทการสนับสนุน ตอนนี้รองรับเฉพาะรูปภาพ', | ||||
| }, | }, | ||||
| text: 'เนื้อหาที่สร้างตัวแทน', | text: 'เนื้อหาที่สร้างตัวแทน', | ||||
| usage: 'ข้อมูลการใช้งานรุ่น', | |||||
| json: 'ตัวแทนสร้าง JSON', | json: 'ตัวแทนสร้าง JSON', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| url: 'Resim url\'si', | url: 'Resim url\'si', | ||||
| }, | }, | ||||
| text: 'Temsilci Tarafından Oluşturulan İçerik', | text: 'Temsilci Tarafından Oluşturulan İçerik', | ||||
| usage: 'Model Kullanım Bilgileri', | |||||
| json: 'Aracı tarafından oluşturulan JSON', | json: 'Aracı tarafından oluşturulan JSON', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| title: 'Файли, створені агентом', | title: 'Файли, створені агентом', | ||||
| }, | }, | ||||
| text: 'Контент, створений агентом', | text: 'Контент, створений агентом', | ||||
| usage: 'Інформація про використання моделі', | |||||
| json: 'Агент згенерував JSON', | json: 'Агент згенерував JSON', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |
| }, | }, | ||||
| json: 'JSON do tác nhân tạo', | json: 'JSON do tác nhân tạo', | ||||
| text: 'Nội dung do tác nhân tạo', | text: 'Nội dung do tác nhân tạo', | ||||
| usage: 'Thông tin sử dụng mô hình', | |||||
| }, | }, | ||||
| checkList: { | checkList: { | ||||
| strategyNotSelected: 'Chiến lược không được chọn', | strategyNotSelected: 'Chiến lược không được chọn', |
| }, | }, | ||||
| outputVars: { | outputVars: { | ||||
| text: 'agent 生成的内容', | text: 'agent 生成的内容', | ||||
| usage: '模型用量信息', | |||||
| files: { | files: { | ||||
| title: 'agent 生成的文件', | title: 'agent 生成的文件', | ||||
| type: '支持类型。现在只支持图片', | type: '支持类型。现在只支持图片', |
| upload_file_id: '上傳檔 ID', | upload_file_id: '上傳檔 ID', | ||||
| }, | }, | ||||
| text: '代理生成的內容', | text: '代理生成的內容', | ||||
| usage: '模型用量信息', | |||||
| json: '代理生成的 JSON', | json: '代理生成的 JSON', | ||||
| }, | }, | ||||
| checkList: { | checkList: { |