Skip to content

Commit

Permalink
Merge branch 'fix/conversation-object-var' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
YIXIAO0 committed Dec 4, 2024
2 parents 3930328 + 360ddb4 commit 0dcb03f
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parameter_rules:
zh_Hans: 对于每个后续标记,仅从前 K 个选项中进行采样。使用 top_k 删除长尾低概率响应。
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
pricing:
input: '0.0008'
output: '0.0016'
input: '0.00006'
output: '0.00024'
unit: '0.001'
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parameter_rules:
zh_Hans: 对于每个后续标记,仅从前 K 个选项中进行采样。使用 top_k 删除长尾低概率响应。
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
pricing:
input: '0.0008'
output: '0.0016'
input: '0.000035'
output: '0.00014'
unit: '0.001'
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ parameter_rules:
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
pricing:
input: '0.0008'
output: '0.0016'
output: '0.0032'
unit: '0.001'
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parameter_rules:
zh_Hans: 对于每个后续标记,仅从前 K 个选项中进行采样。使用 top_k 删除长尾低概率响应。
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
pricing:
input: '0.0008'
output: '0.0016'
input: '0.00006'
output: '0.00024'
unit: '0.001'
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parameter_rules:
zh_Hans: 对于每个后续标记,仅从前 K 个选项中进行采样。使用 top_k 删除长尾低概率响应。
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
pricing:
input: '0.0008'
output: '0.0016'
input: '0.000035'
output: '0.00014'
unit: '0.001'
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ parameter_rules:
en_US: Only sample from the top K options for each subsequent token. Use top_k to remove long tail low probability responses.
pricing:
input: '0.0008'
output: '0.0016'
output: '0.0032'
unit: '0.001'
currency: USD
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ def search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:
for result in results:
if result:
document = self._document_from_scored_point(result, Field.CONTENT_KEY.value, Field.METADATA_KEY.value)
document.metadata["vector"] = result.vector
documents.append(document)

return documents
Expand All @@ -394,6 +393,7 @@ def _document_from_scored_point(
) -> Document:
return Document(
page_content=scored_point.payload.get(content_payload_key),
vector=scored_point.vector,
metadata=scored_point.payload.get(metadata_payload_key) or {},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { useAppContext } from '@/context/app-context'
import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { useFeatures } from '@/app/components/base/features/hooks'
import type { InputForm } from '@/app/components/base/chat/chat/type'
import { getLastAnswer } from '@/app/components/base/chat/utils'

type ChatItemProps = {
modelAndParameter: ModelAndParameter
Expand Down Expand Up @@ -101,7 +102,7 @@ const ChatItem: FC<ChatItemProps> = ({
query: message,
inputs,
model_config: configData,
parent_message_id: chatListRef.current.at(-1)?.id || null,
parent_message_id: getLastAnswer(chatListRef.current)?.id || null,
}

if ((config.file_upload as any).enabled && files?.length && supportVision)
Expand Down
47 changes: 47 additions & 0 deletions web/app/components/base/skeleton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { ComponentProps, FC } from 'react'
import classNames from '@/utils/classnames'

type SkeletonProps = ComponentProps<'div'>

export const SkeletonContanier: FC<SkeletonProps> = (props) => {
const { className, children, ...rest } = props
return (
<div className={classNames('flex flex-col gap-1', className)} {...rest}>
{children}
</div>
)
}

export const SkeletonRow: FC<SkeletonProps> = (props) => {
const { className, children, ...rest } = props
return (
<div className={classNames('flex items-center gap-2', className)} {...rest}>
{children}
</div>
)
}

export const SkeletonRectangle: FC<SkeletonProps> = (props) => {
const { className, children, ...rest } = props
return (
<div className={classNames('h-2 rounded-sm opacity-20 bg-text-tertiary my-1', className)} {...rest}>
{children}
</div>
)
}

export const SkeletonPoint: FC = () =>
<div className='text-text-quaternary text-xs font-medium'>·</div>

/** Usage
* <SkeletonContanier>
* <SkeletonRow>
* <SkeletonRectangle className="w-96" />
* <SkeletonPoint />
* <SkeletonRectangle className="w-96" />
* </SkeletonRow>
* <SkeletonRow>
* <SkeletonRectangle className="w-96" />
* </SkeletonRow>
* <SkeletonRow>
*/
4 changes: 3 additions & 1 deletion web/app/components/workflow/nodes/assigner/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const nodeDefault: NodeDefault<AssignerNodeType> = {
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.assigner.assignedVariable') })

if (!errorMessages && value.operation !== WriteMode.clear) {
if (value.operation === WriteMode.set) {
if (value.operation === WriteMode.set || value.operation === WriteMode.increment
|| value.operation === WriteMode.decrement || value.operation === WriteMode.multiply
|| value.operation === WriteMode.divide) {
if (!value.value && typeof value.value !== 'number')
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.assigner.variable') })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from 'reactflow'
import { RiBookOpenLine, RiCloseLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { ChatVarType } from './type'
import { useStore } from '@/app/components/workflow/store'
import ActionButton, { ActionButtonState } from '@/app/components/base/action-button'
import { BubbleX, LongArrowLeft, LongArrowRight } from '@/app/components/base/icons/src/vender/line/others'
Expand Down Expand Up @@ -64,6 +65,10 @@ const ChatVariablePanel = () => {
}, [getEffectedNodes, store])

const handleEdit = (chatVar: ConversationVariable) => {
// set empty object to be editable
if (chatVar.value_type === ChatVarType.Object && JSON.stringify(chatVar.value) === '{}')
chatVar.value = { '': '' }

setCurrentVar(chatVar)
setShowVariableModal(true)
}
Expand Down

0 comments on commit 0dcb03f

Please sign in to comment.