저는 최근 프로젝트 소유자인 Majd Al Mounayer와 협력하여 TypeScript를 사용하여 구축한 매우 우수한 채팅 완성 애플리케이션에 처음으로 기여했습니다. Majd는 ESLint부터 CI 작업에 이르기까지 개발에 대해 잘 이해하고 있습니다. 그의 프로젝트를 검토하면서 저는 탄탄한 기본 구조로 인해 애플리케이션이 확장 가능하고 새로운 기여자가 기능을 추가하기가 더 쉬워진다는 사실을 알게 되었습니다.
Groq 인스턴스를 기반으로 --token_usage 또는 -t 옵션을 제공하여 최적화 목적으로 얼마나 많은 토큰이 반환되거나 사용되는지 모니터링하는 것이 좋습니다. 일부 코드 블록은 각 모델에 적용되는 토큰 제한을 초과할 수 있으므로 이는 중요합니다.
여러 의견에 대해 토론하고 이 프로젝트에 이 기능을 추가하려면 어떻게 해야 하는지 이해했습니다.
handleTokenFlag를 추가하여 --token-usage 또는 -tu가 포함된 인수 전달을 확인합니다(예인 경우). 토큰 사용에 대해 표준 오류를 발생시킵니다.
[x] 빌드가 실패하지 않습니다.
[x] 현지에서 테스트되었습니다.
[x] Linting 오류가 해결된 경우.
Adding handleTokenFlag to check argument passing that have --token-usage or -tu if yes we stderr for the token usage.
[x] Build does not fail.
[x] Tested locally.
[x] Linting errors if any are resolved.
The suggested from him pointing out that on the argument checking into CLI we don't need to wrapped it with try-catch block so I fixed and make a change.
Adding handleTokenFlag to check argument passing that have --token-usage or -tu if yes we stderr for the token usage.
[x] Build does not fail.
[x] Tested locally.
[x] Linting errors if any are resolved.
When optimizeit processes several files at once the output can be very big. This would then force the user to scroll all the way up to see the tokens which is not user friendly. I think that the token info needs to be displayed at the bottom most of the program output below all processed file outputs.
From the quote I made a change by calling stderr at the end of application to display the token at the bottom most of the application.
Adding handleTokenFlag to check argument passing that have --token-usage or -tu if yes we stderr for the token usage.
[x] Build does not fail.
[x] Tested locally.
[x] Linting errors if any are resolved.
This bug because of wrong if condition inside completion processing the if condition check the flag of --token-usage being pass to the argument or not but then I'm using it with else condition which throw the error if not found response.token so instead of
if (tokenUsageInformation && chatCompletion?.usage) {
this.saveTokenUsageInfo(chatCompletion?.usage);
} else {
throw new Error(`
Token Usage Information is not available for file: ${fileName}
`);
change to
if (tokenUsageInformation) {
if (!chatCompletion.usage) {
throw new Error('Token usage information is not available');
}
this.accumulateToken(chatCompletion?.usage);
This ensures that the token usage is properly handled, and if the information is unavailable, an appropriate error is raised without breaking the application flow.
Overall, contributing to this project allowed me to learn more about different coding styles and adapt to them. Majd’s consistency in using ESLint made the development pattern very clear, helping ensure a smooth contribution process.
위 내용은 첫 번째 기여의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!