-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(claude): fix claude web api request failure
- Loading branch information
1 parent
2173b48
commit 3347723
Showing
10 changed files
with
236 additions
and
1,902 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
import initCycleTLS, { type CycleTLSRequestOptions } from 'cycletls' | ||
export * from './message' | ||
export default initCycleTLS | ||
export { | ||
type CycleTLSRequestOptions, | ||
} |
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,14 @@ | ||
/** | ||
* 将 claude web api 返回格式转为正常文本内容 | ||
*/ | ||
export function formatConversion(result: string) { | ||
let content: string = ''; | ||
const lines = result.split("\n\n"); | ||
lines.map((line) => line.replace(/^data: /, "").trim()) | ||
.filter((line) => line !== "") | ||
.forEach((line) => { | ||
const te = JSON.parse(line); | ||
content += te.completion ? te.completion : ''; | ||
}); | ||
return content; | ||
} |
Oops, something went wrong.