-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix: MiniMax output long content interrupted by non-existent error (#…
…4088) * Update index.ts * Update index.test.ts * Update index.ts * Update minimax.ts * Update minimax.ts * fix * Update minimax.ts * Create minimax.test.ts * Update minimax.ts * Update minimax.ts * Update minimax.ts
- Loading branch information
Showing
4 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { processDoubleData } from './minimax'; // 假设文件名为 minimax.ts | ||
|
||
describe('processDoubleData', () => { | ||
it('should remove the second "data: {"id": and everything after it when matchCount is 2', () => { | ||
const chunkValue = `data: {"id":"first"} some other text | ||
data: {"id":"second"} more text`; | ||
const result = processDoubleData(chunkValue); | ||
expect(result).toBe('data: {"id":"first"} some other text'); | ||
}); | ||
|
||
it('should not modify chunkValue when matchCount is not 2', () => { | ||
const chunkValue = `data: {"id":"first"} some other text`; | ||
const result = processDoubleData(chunkValue); | ||
expect(result).toBe(chunkValue); | ||
}); | ||
|
||
it('should not modify chunkValue when matchCount is more than 2', () => { | ||
const chunkValue = `data: {"id":"first"} some other text data: {"id":"second"} more text data: {"id":"third"} even more text`; | ||
const result = processDoubleData(chunkValue); | ||
expect(result).toBe(chunkValue); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters