[PR #727] [CLOSED] fix: model token handling for openai gpt4.1 series #1519

Closed
opened 2026-02-16 10:23:11 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/727
Author: @fdb02983rhy
Created: 4/15/2025
Status: Closed

Base: mainHead: fix-gpt4.1-token-counting-issue


📝 Commits (3)

📊 Changes

2 files changed (+3 additions, -3 deletions)

View changed files

📝 models/openai/manifest.yaml (+1 -1)
📝 models/openai/models/llm/llm.py (+2 -2)

📄 Description

Related Issues or Context

Issues

Context

This PR contains Changes to Non-Plugin

  • Documentation
  • Other

This PR contains Changes to Non-LLM Models Plugin

  • I have Run All Tests Relevant to My Changes

This PR contains Changes to LLM Models Plugin

  • My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking)
  • My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node)
  • My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.)
  • My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.)
  • My Changes Affect Structured Output Format (JSON, XML, etc.)
  • My Changes Affect Token Consumption Metrics

Before
Pasted Graphic 2
After
image
image

  • My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.)
  • Other Changes (Add New Models, etc.)

Version Control (Any Changes to the Plugin Will Require Bumping the Version)

  • I have Bumped Up the Version in Manifest.yaml (Top-Level Version Field, Not in Meta Section)

Environment Verification (If Any Code Changes)

Local Deployment Environment

  • I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration. Dify Version is: 1.2.0

SaaS Environment

  • I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-official-plugins/pull/727 **Author:** [@fdb02983rhy](https://github.com/fdb02983rhy) **Created:** 4/15/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-gpt4.1-token-counting-issue` --- ### 📝 Commits (3) - [`abbe9af`](https://github.com/langgenius/dify-official-plugins/commit/abbe9af03598d7fd2be2c3cdd8990d31bd6f1a7d) fix: model token handling in OpenAILargeLanguageModel - [`b20eb06`](https://github.com/langgenius/dify-official-plugins/commit/b20eb06ef619d55ec6ed2a997c1b227d1992254b) bump ver - [`afa411f`](https://github.com/langgenius/dify-official-plugins/commit/afa411f7caf751bcb9614c3cd5085934748cc002) Update llm.py ### 📊 Changes **2 files changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `models/openai/manifest.yaml` (+1 -1) 📝 `models/openai/models/llm/llm.py` (+2 -2) </details> ### 📄 Description ## Related Issues or Context Issues - https://github.com/langgenius/dify-official-plugins/issues/721 - https://github.com/langgenius/dify/issues/18077 Context - https://github.com/langgenius/dify-official-plugins/pull/724#issuecomment-2805605908 ## This PR contains Changes to *Non-Plugin* <!-- Put an `x` in all the boxes that apply by replacing [ ] with [x] For example: - [x] Documentation --> - [ ] Documentation - [ ] Other ## This PR contains Changes to *Non-LLM Models Plugin* - [ ] I have Run All Tests Relevant to My Changes <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> ## This PR contains Changes to *LLM Models Plugin* <!-- LLM Models Test Example: --> <!-- https://github.com/langgenius/dify-official-plugins/blob/main/.assets/test-examples/llm-plugin-tests/llm_test_example.md --> - [ ] My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Structured Output Format (JSON, XML, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [x] My Changes Affect Token Consumption Metrics <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> Before <img width="1461" alt="Pasted Graphic 2" src="https://github.com/user-attachments/assets/8b218462-7b30-4bd9-8da3-464e8d44cd37" /> After <img width="1428" alt="image" src="https://github.com/user-attachments/assets/85e83eec-6adc-4864-9c42-5854a3b02f5c" /> <img width="392" alt="image" src="https://github.com/user-attachments/assets/7e750b5f-f498-4135-b5d5-786ec2450448" /> - [ ] My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] Other Changes (Add New Models, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> ## Version Control (Any Changes to the Plugin Will Require Bumping the Version) - [x] I have Bumped Up the Version in Manifest.yaml (Top-Level `Version` Field, Not in Meta Section) <!-- ⚠️ NOTE: Version Format: MAJOR.MINOR.PATCH - MAJOR (0.x.x): Reserved for Significant architectural changes or incompatible API modifications - MINOR (x.0.x): For New feature additions while maintaining backward compatibility - PATCH (x.x.0): For Backward-compatible bug fixes and minor improvements - Note: Each Version Component (MAJOR, MINOR, PATCH) Can Be 2 Digits, e.g., 10.11.22 --> ## Environment Verification (If Any Code Changes) <!-- ⚠️ NOTE: At Least One Environment Must Be Tested. --> ### Local Deployment Environment - [x] I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration. Dify Version is: 1.2.0 <!-- - Python Virtual Env Matching Manifest.yaml & requirements.txt - No Breaking Changes in Dify That May Affect the Testing Result --> ### SaaS Environment - [ ] I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration <!-- - Python Virtual Env Matching Manifest.yaml & requirements.txt --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 10:23:11 -05:00
yindo closed this issue 2026-02-16 10:23:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#1519