chck for empty string
This commit is contained in:
parent
c9a6622df7
commit
4f940b0d91
|
|
@ -19,6 +19,7 @@ export class SimplePromptModerationRunner implements Moderation {
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
const denyArray = this.denyList.split('\n')
|
const denyArray = this.denyList.split('\n')
|
||||||
for (const denyStr of denyArray) {
|
for (const denyStr of denyArray) {
|
||||||
|
if (!denyStr || denyStr === '') continue
|
||||||
const res = await this.model.invoke(
|
const res = await this.model.invoke(
|
||||||
`Are these two sentences similar to each other? Only return Yes or No.\nFirst sentence: ${input}\nSecond sentence: ${denyStr}`
|
`Are these two sentences similar to each other? Only return Yes or No.\nFirst sentence: ${input}\nSecond sentence: ${denyStr}`
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue