Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 8e22b7f

Browse files
authored
Merge pull request #533 from getFairAI/feat#ao-llama-provider
Feat#ao llama provider
2 parents 873467c + ff2ba9a commit 8e22b7f

24 files changed

Lines changed: 1152 additions & 487 deletions

client/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,24 @@
2020
"deploy": "ts-node --esm ./scripts/deploy.ts"
2121
},
2222
"dependencies": {
23+
"@irys/query": "^0.0.6",
24+
"@irys/sdk": "^0.1.21",
2325
"@apollo/client": "3.7.13",
26+
"@dha-team/arbundles": "^1.0.1",
2427
"@dicebear/collection": "6.0.2",
2528
"@dicebear/core": "6.0.2",
2629
"@emotion/react": "^11.13.0",
2730
"@emotion/styled": "^11.13.0",
2831
"@fair-protocol/sdk": "^2.0.22",
2932
"@fairai/evm-sdk": "0.0.15",
30-
"@irys/query": "^0.0.6",
3133
"@metamask/eth-sig-util": "^7.0.2",
3234
"@mui/icons-material": "^5.15.5",
3335
"@mui/lab": "5.0.0-alpha.120",
3436
"@mui/material": "^5.16.7",
3537
"@mui/x-date-pickers": "6.2.1",
38+
"@permaweb/aoconnect": "^0.0.61",
3639
"@permaweb/arx": "^1.0.0",
37-
"@permaweb/stampjs": "^0.6.2",
40+
"@permaweb/stampjs": "1.0.0",
3841
"@types/dompurify": "^3.0.5",
3942
"@uiw/react-md-editor": "3.20.2",
4043
"@vitejs/plugin-legacy": "^5.4.0",
@@ -61,14 +64,14 @@
6164
"react-sketch-canvas": "^6.2.0",
6265
"redstone-api": "0.4.11",
6366
"rehype-sanitize": "5.0.1",
67+
"typed-assert": "^1.0.9",
6468
"viem": "^2.9.16",
6569
"vite": "^5.4.0",
6670
"warp-contracts": "1.4.5",
6771
"warp-contracts-plugin-deploy": "1.0.9"
6872
},
6973
"devDependencies": {
7074
"@ar.io/sdk": "^2.2.5",
71-
"@irys/sdk": "^0.1.21",
7275
"@rollup/plugin-commonjs": "^25.0.8",
7376
"@testing-library/react": "14.0.0",
7477
"@testing-library/user-event": "14.4.3",

client/src/components/chat-reports-content .tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ const ChatReportsContent = ({
312312
msg: inputValue,
313313
type: 'request',
314314
contentType: 'text/plain',
315-
height: 0,
316315
cid: currentConversationId,
317316
from: currentAddress,
318317
to: state.defaultOperator.arweaveWallet,
@@ -407,7 +406,6 @@ const ChatReportsContent = ({
407406
timestamp: Number(findTag(tx, 'unixTime')) || Date.now() / 1000,
408407
type: 'response',
409408
contentType: 'text/plain',
410-
height: tx.node.block?.height ?? 0,
411409
cid: currentConversationId,
412410
from: tx.node.owner.address,
413411
to:
@@ -450,7 +448,6 @@ const ChatReportsContent = ({
450448
timestamp: Number(findTag(tx, 'unixTime')) || Date.now() / 1000,
451449
type: 'request',
452450
contentType: 'text/plain',
453-
height: tx.node.block?.height ?? 0,
454451
cid: currentConversationId,
455452
from:
456453
tx.node.tags.find((tag: ITag) => tag.name === 'Request-Caller')?.value ||

client/src/components/configuration.tsx

Lines changed: 70 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,26 @@ const Configuration = ({
534534
[state],
535535
);
536536

537+
const isAOProvider = useMemo(
538+
() => currentOperator?.tx?.node?.id === 'ARrzKTW93CuLRbcOo63YlA3l1VEuw8OvZ43RcRMzBnM',
539+
[currentOperator],
540+
);
541+
537542
useEffect(() => {
538-
if (availableModels.length > 0) {
543+
if (currentOperator?.tx?.node?.id === 'ARrzKTW93CuLRbcOo63YlA3l1VEuw8OvZ43RcRMzBnM') {
544+
setConfigValue('modelName', 'Phi2', {
545+
shouldDirty: true,
546+
shouldTouch: true,
547+
shouldValidate: true,
548+
});
549+
} else if (availableModels.length > 0) {
539550
setConfigValue('modelName', availableModels[0].name, {
540551
shouldDirty: true,
541552
shouldTouch: true,
542553
shouldValidate: true,
543554
});
544555
}
545-
}, [availableModels]);
556+
}, [availableModels, currentOperator]);
546557

547558
const checkAssetNamesValidity = useCallback(() => {
548559
const assetNames = assetNamesField.value;
@@ -590,11 +601,25 @@ const Configuration = ({
590601
);
591602
if (operator) {
592603
setCurrentOperator(operator);
604+
// change model
605+
if (operator.tx.node.id === 'ARrzKTW93CuLRbcOo63YlA3l1VEuw8OvZ43RcRMzBnM') {
606+
setConfigValue('modelName', 'Phi2', {
607+
shouldDirty: true,
608+
shouldTouch: true,
609+
shouldValidate: true,
610+
});
611+
} else {
612+
setConfigValue('modelName', availableModels[0].name, {
613+
shouldDirty: true,
614+
shouldTouch: true,
615+
shouldValidate: true,
616+
});
617+
}
593618
} else {
594619
// ifgnore
595620
}
596621
},
597-
[state, setCurrentOperator],
622+
[state, availableModels, setCurrentOperator],
598623
);
599624

600625
return (
@@ -660,10 +685,12 @@ const Configuration = ({
660685
defaultValue={currentOperator?.tx.node.id}
661686
renderValue={(value) => (
662687
<Typography>
663-
{displayShortTxOrAddr(
664-
state.availableOperators.find((op) => op.tx.node.id === value)?.evmWallet ??
665-
'None',
666-
)}
688+
{value === 'ARrzKTW93CuLRbcOo63YlA3l1VEuw8OvZ43RcRMzBnM'
689+
? 'AO provider'
690+
: displayShortTxOrAddr(
691+
state.availableOperators.find((op) => op.tx.node.id === value)?.evmWallet ??
692+
'None',
693+
)}
667694
</Typography>
668695
)}
669696
>
@@ -673,7 +700,11 @@ const Configuration = ({
673700
value={operator.tx.node.id}
674701
sx={{ display: 'flex', alignItems: 'center', justifyContent: spaceBetween }}
675702
>
676-
<Typography>{displayShortTxOrAddr(operator.evmWallet)}</Typography>
703+
<Typography>
704+
{operator.tx.node.id === 'ARrzKTW93CuLRbcOo63YlA3l1VEuw8OvZ43RcRMzBnM'
705+
? 'AO provider'
706+
: displayShortTxOrAddr(operator.evmWallet)}
707+
</Typography>
677708
<Tooltip title={'Operator Fee'}>
678709
<Box display={'flex'} alignItems={'center'} gap={'8px'}>
679710
<Typography>{operator.operatorFee}</Typography>
@@ -706,7 +737,7 @@ const Configuration = ({
706737
}}
707738
/>
708739
</Box>
709-
{!isArbitrumSolution && (
740+
{!isArbitrumSolution && !isAOProvider && (
710741
<Box>
711742
<SelectControl
712743
name={'modelName'}
@@ -737,34 +768,36 @@ const Configuration = ({
737768
{!isArbitrumSolution && isTextSolution && (
738769
<TextConfiguration messages={messages} control={control} />
739770
)}
740-
<FormControl component='fieldset' variant='standard'>
741-
<FormControlLabel
742-
control={
743-
<Checkbox
744-
ref={privateModeField.ref}
745-
value={privateModeField.value}
746-
onChange={privateModeField.onChange}
747-
/>
748-
}
749-
label={
750-
<Typography sx={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
751-
Private Mode
752-
<Tooltip
753-
title={
754-
<Typography variant='caption' sx={{ whiteSpace: 'pre-line' }}>
755-
{
756-
'When this is on, prompts and responses will be encrypted with your keys and will only be acessbile by you.'
757-
}
758-
</Typography>
759-
}
760-
placement='bottom'
761-
>
762-
<InfoOutlined fontSize='small' />
763-
</Tooltip>
764-
</Typography>
765-
}
766-
/>
767-
</FormControl>
771+
{!isAOProvider && (
772+
<FormControl component='fieldset' variant='standard'>
773+
<FormControlLabel
774+
control={
775+
<Checkbox
776+
ref={privateModeField.ref}
777+
value={privateModeField.value}
778+
onChange={privateModeField.onChange}
779+
/>
780+
}
781+
label={
782+
<Typography sx={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
783+
Private Mode
784+
<Tooltip
785+
title={
786+
<Typography variant='caption' sx={{ whiteSpace: 'pre-line' }}>
787+
{
788+
'When this is on, prompts and responses will be encrypted with your keys and will only be acessbile by you.'
789+
}
790+
</Typography>
791+
}
792+
placement='bottom'
793+
>
794+
<InfoOutlined fontSize='small' />
795+
</Tooltip>
796+
</Typography>
797+
}
798+
/>
799+
</FormControl>
800+
)}
768801
{!isArbitrumSolution && (
769802
<>
770803
<SelectControl

client/src/components/conversations.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,28 +258,28 @@ const Conversations = ({
258258
first: 100,
259259
tags: [
260260
{
261-
name: TAG_NAMES.protocolName,
262-
values: [PROTOCOL_NAME],
261+
name: TAG_NAMES.solutionTransaction,
262+
values: [state.solution.node.id],
263263
},
264264
{
265-
name: TAG_NAMES.protocolVersion,
266-
values: [PROTOCOL_VERSION],
265+
name: TAG_NAMES.conversationIdentifier,
266+
values: [el.toString()],
267267
},
268268
{
269269
name: TAG_NAMES.operationName,
270270
values: [INFERENCE_REQUEST],
271271
},
272272
{
273-
name: TAG_NAMES.contentType,
274-
values: [textContentType],
273+
name: TAG_NAMES.protocolName,
274+
values: [PROTOCOL_NAME],
275275
},
276276
{
277-
name: TAG_NAMES.conversationIdentifier,
278-
values: [el.toString()],
277+
name: TAG_NAMES.protocolVersion,
278+
values: [PROTOCOL_VERSION],
279279
},
280280
{
281-
name: TAG_NAMES.solutionTransaction,
282-
values: [state.solution.node.id],
281+
name: TAG_NAMES.contentType,
282+
values: [textContentType],
283283
},
284284
],
285285
},

client/src/components/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ const Navbar = ({ userScrolledDown }: { userScrolledDown: boolean }) => {
234234
<div className='flex-col w-full justify-start'>
235235
<Toolbar className='flex justify-between'>
236236
<Box display={'flex'} flexDirection={'row'} alignItems={'center'}>
237-
<Link to='/' style={{ width: '150px', height: '50px' }}>
237+
<Link to='/' style={{ width: '150px', height: '50px' }} replace={true}>
238238
<Logo />
239239
</Link>
240240
<Typography

0 commit comments

Comments
 (0)